Bug 776027 - Pass web activities to Java. r=wesj
☠☠ backed out by 361d1c3b9fc5 ☠ ☠
authorJosh Dover <gerfuls@gmail.com>
Mon, 14 Apr 2014 17:47:00 +0200
changeset 178398 ec54368243da36dacccca850735876ea454a0fdf
parent 178397 2ada015179801c0889ac82e203774eaca2bbd5ef
child 178399 46b4833e84c3788ffbb898af6f10c0e02334293b
push id6314
push usercbook@mozilla.com
push dateTue, 15 Apr 2014 09:15:50 +0000
treeherderfx-team@b90d50c9d8be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs776027
milestone31.0a1
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
@@ -585,16 +585,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
@@ -113,8 +113,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
@@ -129,16 +129,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
@@ -393,16 +394,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