diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java
index e9cd250d5a6..45afccaaf28 100644
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -1208,7 +1208,7 @@ public class GeckoAppShell
context.getResources().getString(R.string.share_title));
}
- final Uri uri = normalizeUriScheme(Uri.parse(targetURI));
+ final Uri uri = normalizeUriScheme(targetURI.indexOf(':') >= 0 ? Uri.parse(targetURI) : new Uri.Builder().scheme(targetURI).build());
if (mimeType.length() > 0) {
Intent intent = getIntentForActionString(action);
intent.setDataAndType(uri, mimeType);
diff --git a/mobile/android/base/resources/values/styles.xml b/mobile/android/base/resources/values/styles.xml
index bfc1ec817b1..5bf5737d989 100644
--- a/mobile/android/base/resources/values/styles.xml
+++ b/mobile/android/base/resources/values/styles.xml
@@ -536,6 +536,7 @@
- ?android:textAppearanceSmall
- wrap_content
- wrap_content
+ - 160dp
- #fff
- center_vertical
diff --git a/mobile/android/base/widget/ButtonToast.java b/mobile/android/base/widget/ButtonToast.java
index 4a4f44def7e..c1a346b93fb 100644
--- a/mobile/android/base/widget/ButtonToast.java
+++ b/mobile/android/base/widget/ButtonToast.java
@@ -116,7 +116,7 @@ public class ButtonToast {
mMessageView.setText(t.message);
mButton.setText(t.buttonMessage);
mButton.setCompoundDrawablePadding(mView.getContext().getResources().getDimensionPixelSize(R.dimen.toast_button_padding));
- mButton.setCompoundDrawablesWithIntrinsicBounds(null, null, t.buttonDrawable, null);
+ mButton.setCompoundDrawablesWithIntrinsicBounds(t.buttonDrawable, null, null, null);
mHideHandler.removeCallbacks(mHideRunnable);
mHideHandler.postDelayed(mHideRunnable, TOAST_DURATION);
diff --git a/mobile/android/components/ContentDispatchChooser.js b/mobile/android/components/ContentDispatchChooser.js
index 430d27d2d25..376789765df 100644
--- a/mobile/android/components/ContentDispatchChooser.js
+++ b/mobile/android/components/ContentDispatchChooser.js
@@ -9,6 +9,10 @@ const Cc = Components.classes;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
+function sendMessageToJava(aMessage) {
+ return Services.androidBridge.handleGeckoMessage(JSON.stringify(aMessage));
+}
+
function ContentDispatchChooser() {}
ContentDispatchChooser.prototype =
@@ -49,13 +53,25 @@ ContentDispatchChooser.prototype =
let win = this._getChromeWin();
if (win && win.NativeWindow) {
let bundle = Services.strings.createBundle("chrome://browser/locale/handling.properties");
- let text = bundle.GetStringFromName("protocol.failed");
- win.NativeWindow.toast.show(text, "long");
+ let failedText = bundle.GetStringFromName("protocol.failed");
+ let searchText = bundle.GetStringFromName("protocol.toast.search");
+
+ win.NativeWindow.toast.show(failedText, "long", {
+ button: {
+ label: searchText,
+ callback: function() {
+ let message = {
+ type: "Intent:Open",
+ url: "market://search?q=" + aURI.scheme,
+ };
+
+ sendMessageToJava(message);
+ }
+ }
+ });
}
}
- }
-
+ },
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentDispatchChooser]);
-
diff --git a/mobile/android/locales/en-US/chrome/handling.properties b/mobile/android/locales/en-US/chrome/handling.properties
index 3e08919ec5d..44858a39071 100644
--- a/mobile/android/locales/en-US/chrome/handling.properties
+++ b/mobile/android/locales/en-US/chrome/handling.properties
@@ -2,4 +2,6 @@
# 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/.
-protocol.failed=Couldn't find an application to open this link
+protocol.failed=Couldn't find an app to open this link
+# A very short string shown in the button toast when no application can open the url
+protocol.toast.search=Search