Bug 1282410 - part2 : open media with external apps. draft
authorAlastor Wu <alwu@mozilla.com>
Fri, 01 Jul 2016 14:33:10 +0800
changeset 383090 a2b2bfac6fe47b9f746b70993e72be55be5d828d
parent 383089 2ac9585b35076bf12a24e5ad298187813b3a3bd5
child 383091 43d2acba7bc647f1ea78f69d7c3c55c32c85fefd
push id21926
push useralwu@mozilla.com
push dateFri, 01 Jul 2016 06:32:26 +0000
bugs1282410
milestone50.0a1
Bug 1282410 - part2 : open media with external apps. MozReview-Commit-ID: 1yh4LJRF9ev
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4680,16 +4680,17 @@ var BrowserEventHandler = {
       Services.obs.addObserver(this, "dom-touch-listener-added", false);
       BrowserApp.deck.addEventListener("touchstart", this, true);
     } else {
       BrowserApp.deck.addEventListener("touchend", this, true);
     }
 
     BrowserApp.deck.addEventListener("DOMUpdatePageReport", PopupBlockerObserver.onUpdatePageReport, false);
     BrowserApp.deck.addEventListener("MozMouseHittest", this, true);
+    BrowserApp.deck.addEventListener("OpenMediaWithExtenalApp", this, false);
 
     InitLater(() => BrowserApp.deck.addEventListener("click", InputWidgetHelper, true));
     InitLater(() => BrowserApp.deck.addEventListener("click", SelectHelper, true));
 
     // ReaderViews support backPress listeners.
     Messaging.addListener(() => {
       return Reader.onBackPress(BrowserApp.selectedTab.id);
     }, "Browser:OnBackPressed");
@@ -4703,16 +4704,19 @@ var BrowserEventHandler = {
       case 'touchend':
         if (this._inCluster) {
           aEvent.preventDefault();
         }
         break;
       case 'MozMouseHittest':
         this._handleRetargetedTouchStart(aEvent);
         break;
+      case 'OpenMediaWithExtenalApp':
+        ExternalApps.openExternal(aEvent.target);
+        break;
     }
   },
 
   _handleTouchStart: function(aEvent) {
     if (!BrowserApp.isBrowserContentDocumentDisplayed() || aEvent.touches.length > 1 || aEvent.defaultPrevented)
       return;
 
     let target = aEvent.target;
@@ -6770,17 +6774,17 @@ var SearchEngines = {
               formData.push({ name: escape(formElement.name), value: escape(formElement.value) });
               break;
             }
           }
         }
       }
     };
 
-    // Return valid, pre-sorted queryParams. 
+    // Return valid, pre-sorted queryParams.
     return formData.filter(a => a.name && a.value).sort((a, b) => {
       // nsIBrowserSearchService.hasEngineWithURL() ensures sort, but this helps.
       if (a.name > b.name) {
         return 1;
       }
       if (b.name > a.name) {
         return -1;
       }