Bug 776027 - Pass web activities to Java. r=wesj
authorJosh Dover <gerfuls@gmail.com>
Fri, 25 Apr 2014 16:29:00 +0200
changeset 180950 fac267a41e5c011df9f92cbf2688e9bfba2e05bb
parent 180949 025898d5577cd0eee55ce5c5ec757fd55daccac7
child 180951 774890574009c36aaa0bb47301dde18ae3f7cc82
push id26687
push usercbook@mozilla.com
push dateWed, 30 Apr 2014 13:02:09 +0000
treeherdermozilla-central@727238c13756 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs776027
milestone32.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 776027 - Pass web activities to Java. r=wesj
mobile/android/app/mobile.js
mobile/android/components/ActivitiesGlue.js
mobile/android/components/MobileComponents.manifest
mobile/android/components/moz.build
mobile/android/installer/package-manifest.in
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -579,16 +579,18 @@ pref("media.video-queue.default-size", 3
 
 // optimize images memory usage
 pref("image.mem.decodeondraw", true);
 pref("image.mem.min_discard_timeout_ms", 10000);
 
 #ifdef NIGHTLY_BUILD
 // Shumway component (SWF player) is disabled by default. Also see bug 904346.
 pref("shumway.disabled", true);
+// Enabled system messages for web activity support
+pref("dom.sysmsg.enabled", true);
 #endif
 
 // enable touch events interfaces
 pref("dom.w3c_touch_events.enabled", 1);
 
 #ifdef MOZ_SAFE_BROWSING
 pref("browser.safebrowsing.enabled", true);
 pref("browser.safebrowsing.malware.enabled", true);
new file mode 100644
--- /dev/null
+++ b/mobile/android/components/ActivitiesGlue.js
@@ -0,0 +1,31 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict"
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Messaging.jsm");
+
+function ActivitiesGlue() { }
+
+ActivitiesGlue.prototype = {
+  QueryInterface: XPCOMUtils.generateQI([Ci.nsIActivityUIGlue]),
+  classID: Components.ID("{e4deb5f6-d5e3-4fce-bc53-901dd9951c48}"),
+
+  // Ignore aActivities results on Android, go straight to Android intents.
+  chooseActivity: function ap_chooseActivity(aOptions, aActivities, aCallback) {
+    sendMessageToJava({
+      type: "WebActivity:Open",
+      activity: { name: aOptions.name, data: aOptions.data }
+    }, (result) => {
+      aCallback.handleEvent(Ci.nsIActivityUIGlueCallback.NATIVE_ACTIVITY, result);
+    });
+  }
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivitiesGlue]);
--- a/mobile/android/components/MobileComponents.manifest
+++ b/mobile/android/components/MobileComponents.manifest
@@ -115,8 +115,12 @@ category update-timer Snippets @mozilla.
 component {8f7002cb-e959-4f0a-a2e8-563232564385} WebappsUpdateTimer.js
 contract @mozilla.org/webapps-update-timer;1 {8f7002cb-e959-4f0a-a2e8-563232564385}
 category update-timer WebappsUpdateTimer @mozilla.org/webapps-update-timer;1,getService,webapp-background-update-timer,browser.webapps.updateInterval,86400
 #endif
 
 # ColorPicker.js
 component {430b987f-bb9f-46a3-99a5-241749220b29} ColorPicker.js
 contract @mozilla.org/colorpicker;1 {430b987f-bb9f-46a3-99a5-241749220b29}
+
+# ActivitiesGlue.js
+component {e4deb5f6-d5e3-4fce-bc53-901dd9951c48} ActivitiesGlue.js
+contract @mozilla.org/dom/activities/ui-glue;1 {e4deb5f6-d5e3-4fce-bc53-901dd9951c48}
--- a/mobile/android/components/moz.build
+++ b/mobile/android/components/moz.build
@@ -6,16 +6,17 @@
 
 XPIDL_SOURCES += [
     'SessionStore.idl',
 ]
 
 XPIDL_MODULE = 'MobileComponents'
 
 EXTRA_COMPONENTS += [
+    'ActivitiesGlue.js',
     'AddonUpdateService.js',
     'BlocklistPrompt.js',
     'ColorPicker.js',
     'ContentDispatchChooser.js',
     'ContentPermissionPrompt.js',
     'DownloadManagerUI.js',
     'FilePicker.js',
     'LoginManagerPrompter.js',
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -128,16 +128,17 @@
 @BINPATH@/components/content_htmldoc.xpt
 @BINPATH@/components/content_html.xpt
 @BINPATH@/components/content_webrtc.xpt
 @BINPATH@/components/content_xslt.xpt
 @BINPATH@/components/cookie.xpt
 @BINPATH@/components/directory.xpt
 @BINPATH@/components/docshell.xpt
 @BINPATH@/components/dom.xpt
+@BINPATH@/components/dom_activities.xpt
 @BINPATH@/components/dom_apps.xpt
 @BINPATH@/components/dom_base.xpt
 @BINPATH@/components/dom_canvas.xpt
 @BINPATH@/components/dom_core.xpt
 @BINPATH@/components/dom_css.xpt
 @BINPATH@/components/dom_devicestorage.xpt
 @BINPATH@/components/dom_events.xpt
 @BINPATH@/components/dom_geolocation.xpt
@@ -394,16 +395,23 @@
 
 @BINPATH@/components/Push.js
 @BINPATH@/components/Push.manifest
 
 @BINPATH@/components/SystemMessageInternal.js
 @BINPATH@/components/SystemMessageManager.js
 @BINPATH@/components/SystemMessageManager.manifest
 
+@BINPATH@/components/Activities.manifest
+@BINPATH@/components/ActivitiesGlue.js
+@BINPATH@/components/ActivityProxy.js
+@BINPATH@/components/ActivityRequestHandler.js
+@BINPATH@/components/ActivityWrapper.js
+@BINPATH@/components/ActivityMessageConfigurator.js
+
 @BINPATH@/components/TCPSocket.js
 @BINPATH@/components/TCPSocketParentIntermediary.js
 @BINPATH@/components/TCPServerSocket.js
 @BINPATH@/components/TCPSocket.manifest
 
 #ifdef MOZ_WEBRTC
 @BINPATH@/components/PeerConnection.js
 @BINPATH@/components/PeerConnection.manifest