Bug 1201145 - Make android intent & web activities coexist peacefully r=snorp

This commit is contained in:
Fabrice Desré 2015-09-04 14:06:49 -07:00
parent 486eb86701
commit bfcb2e2e41
6 changed files with 21 additions and 8 deletions

View File

@ -12,6 +12,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
Cu.import("resource://gre/modules/AppsUtils.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "DOMApplicationRegistry",
"resource://gre/modules/Webapps.jsm");
@ -322,10 +323,17 @@ let Activities = {
// Don't do this check until we have passed to UIGlue so the glue
// can choose to launch its own activity if needed.
if (aResults.options.length === 0) {
self.trySendAndCleanup(aMsg.id, "Activity:FireError", {
"id": aMsg.id,
"error": "NO_PROVIDER"
});
if (AppConstants.MOZ_B2GDROID) {
// Fallback on the Android Intent mapper.
let glue = Cc["@mozilla.org/dom/activities/android-ui-glue;1"]
.createInstance(Ci.nsIActivityUIGlue);
glue.chooseActivity(aMsg.options, aResults.options, getActivityChoice);
} else {
self.trySendAndCleanup(aMsg.id, "Activity:FireError", {
"id": aMsg.id,
"error": "NO_PROVIDER"
});
}
return;
}

View File

@ -419,6 +419,7 @@
@BINPATH@/components/htmlMenuBuilder.manifest
@BINPATH@/components/Activities.manifest
@BINPATH@/components/AndroidActivitiesGlue.js
@BINPATH@/components/ActivitiesGlue.js
@BINPATH@/components/ActivityProxy.js
@BINPATH@/components/ActivityRequestHandler.js

View File

@ -119,6 +119,10 @@ category update-timer Snippets @mozilla.org/snippets;1,getService,snippets-updat
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
# AndroidActivitiesGlue.js
component {e4deb5f6-d5e3-4fce-bc53-901dd9951c48} AndroidActivitiesGlue.js
#ifdef MOZ_B2GDROID
contract @mozilla.org/dom/activities/android-ui-glue;1 {e4deb5f6-d5e3-4fce-bc53-901dd9951c48}
#else
contract @mozilla.org/dom/activities/ui-glue;1 {e4deb5f6-d5e3-4fce-bc53-901dd9951c48}
#endif

View File

@ -12,8 +12,8 @@ XPIDL_MODULE = 'MobileComponents'
EXTRA_COMPONENTS += [
'AboutRedirector.js',
'ActivitiesGlue.js',
'AddonUpdateService.js',
'AndroidActivitiesGlue.js',
'BlocklistPrompt.js',
'BrowserCLH.js',
'ColorPicker.js',

View File

@ -414,7 +414,7 @@
@BINPATH@/components/htmlMenuBuilder.manifest
@BINPATH@/components/Activities.manifest
@BINPATH@/components/ActivitiesGlue.js
@BINPATH@/components/AndroidActivitiesGlue.js
@BINPATH@/components/ActivityProxy.js
@BINPATH@/components/ActivityRequestHandler.js
@BINPATH@/components/ActivityWrapper.js