Bug 962815 - Update pin button after pin decision is made. r=rsilveira a=metro-only
authorMarina Samuel <msamuel@mozilla.com>
Wed, 29 Jan 2014 16:20:29 -0500
changeset 176130 cf139f1f98909d42d469c5ef6761c7e79c9893ee
parent 176129 3c330ec8424ceb9eb31158b24000237f29e8de72
child 176131 b08677d9f100d6f4478209a0b92a6ddd300dcb78
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrsilveira, metro-only
bugs962815
milestone28.0a2
Bug 962815 - Update pin button after pin decision is made. r=rsilveira a=metro-only
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();