Bug 962815 - Update pin button after pin decision is made. r=rsilveira
authorMarina Samuel <msamuel@mozilla.com>
Wed, 29 Jan 2014 16:20:29 -0500
changeset 181864 a24ad25815b9048aca3fedbffaa01817c7d63a8f
parent 181863 e50578e8c8a4fb3e11e06e74eef622cd33ab24b9
child 181865 059883f2def1d6e5c39316d1b50804ddb088b7ee
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrsilveira
bugs962815
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 962815 - Update pin button after pin decision is made. r=rsilveira
browser/metro/base/content/appbar.js
widget/windows/winrt/MetroApp.cpp
--- a/browser/metro/base/content/appbar.js
+++ b/browser/metro/base/content/appbar.js
@@ -20,26 +20,35 @@ var Appbar = {
     window.addEventListener('MozContextActionsChange', this, false);
 
     // browser events we need to update button state on
     Elements.browsers.addEventListener('URLChanged', this, true);
     Elements.tabList.addEventListener('TabSelect', this, true);
 
     // tilegroup selection events for all modules get bubbled up
     window.addEventListener("selectionchange", this, false);
+    Services.obs.addObserver(this, "metro_on_async_tile_created", false);
 
     // gather appbar telemetry data
     try {
       UITelemetry.addSimpleMeasureFunction("metro-appbar",
                                            this.getAppbarMeasures.bind(this));
     } catch (ex) {
       // swallow exception that occurs if metro-appbar measure is already set up
     }
   },
 
+  observe: function(aSubject, aTopic, aData) {
+    switch (aTopic) {
+      case "metro_on_async_tile_created":
+        this._updatePinButton();
+        break;
+    }
+  },
+
   handleEvent: function Appbar_handleEvent(aEvent) {
     switch (aEvent.type) {
       case 'URLChanged':
       case 'TabSelect':
         this.update();
         this.flushActiveTileset(aEvent.lastTab);
         break;
 
--- a/widget/windows/winrt/MetroApp.cpp
+++ b/widget/windows/winrt/MetroApp.cpp
@@ -153,16 +153,17 @@ MetroApp::OnResuming(IInspectable* aSend
   return S_OK;
 }
 
 HRESULT
 MetroApp::OnAsyncTileCreated(ABI::Windows::Foundation::IAsyncOperation<bool>* aOperation,
                              AsyncStatus aStatus)
 {
   WinUtils::Log("Async operation status: %d", aStatus);
+  MetroUtils::FireObserver("metro_on_async_tile_created");
   return S_OK;
 }
 
 // static
 void
 MetroApp::SetBaseWidget(MetroWidget* aPtr)
 {
   LogThread();