Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1606)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java

Issue 1224273003: webapps: propogate name and shortName from manifest to Java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add back explict destructor Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
index 7dd850c688043e25b2db4080bcef64c375a9ebf5..191d34935b21058da2b6a1c55194123a8bbdced6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
@@ -30,7 +30,10 @@ public class ShortcutHelper {
public static final String EXTRA_ICON = "org.chromium.chrome.browser.webapp_icon";
public static final String EXTRA_ID = "org.chromium.chrome.browser.webapp_id";
public static final String EXTRA_MAC = "org.chromium.chrome.browser.webapp_mac";
+ // EXTRA_TITLE is present for backward compatibility reasons
public static final String EXTRA_TITLE = "org.chromium.chrome.browser.webapp_title";
+ public static final String EXTRA_NAME = "org.chromium.chrome.browser.webapp_name";
+ public static final String EXTRA_SHORT_NAME = "org.chromium.chrome.browser.webapp_short_name";
public static final String EXTRA_URL = "org.chromium.chrome.browser.webapp_url";
public static final String EXTRA_ORIENTATION = ScreenOrientationConstants.EXTRA_ORIENTATION;
public static final String EXTRA_SOURCE = "org.chromium.chrome.browser.webapp_source";
@@ -38,7 +41,7 @@ public class ShortcutHelper {
/** Observes the data fetching pipeline. */
public interface ShortcutHelperObserver {
/** Called when the title of the page is available. */
- void onTitleAvailable(String title);
+ void onUserTitleAvailable(String title);
/** Called when the icon to use in the launcher is available. */
void onIconAvailable(Bitmap icon);
@@ -114,8 +117,8 @@ public class ShortcutHelper {
}
@CalledByNative
- private void onTitleAvailable(String title) {
- mObserver.onTitleAvailable(title);
+ private void onUserTitleAvailable(String title) {
+ mObserver.onUserTitleAvailable(title);
}
@CalledByNative
@@ -150,8 +153,8 @@ public class ShortcutHelper {
*/
@SuppressWarnings("unused")
@CalledByNative
- private static void addShortcut(Context context, String url, String title, Bitmap icon,
- boolean isWebappCapable, int orientation, int source) {
+ private static void addShortcut(Context context, String url, String userTitle, String name,
+ String shortName, Bitmap icon, boolean isWebappCapable, int orientation, int source) {
Intent shortcutIntent;
if (isWebappCapable) {
// Encode the icon as a base64 string (Launcher drops Bitmaps in the Intent).
@@ -168,7 +171,8 @@ public class ShortcutHelper {
shortcutIntent.setAction(sDelegate.getFullscreenAction());
shortcutIntent.putExtra(EXTRA_ICON, encodedIcon);
shortcutIntent.putExtra(EXTRA_ID, UUID.randomUUID().toString());
- shortcutIntent.putExtra(EXTRA_TITLE, title);
+ shortcutIntent.putExtra(EXTRA_NAME, name);
+ shortcutIntent.putExtra(EXTRA_SHORT_NAME, shortName);
shortcutIntent.putExtra(EXTRA_URL, url);
shortcutIntent.putExtra(EXTRA_ORIENTATION, orientation);
shortcutIntent.putExtra(EXTRA_MAC, getEncodedMac(context, url));
@@ -182,7 +186,7 @@ public class ShortcutHelper {
shortcutIntent.putExtra(EXTRA_SOURCE, source);
shortcutIntent.setPackage(context.getPackageName());
sDelegate.sendBroadcast(
- context, BookmarkUtils.createAddToHomeIntent(shortcutIntent, title, icon, url));
+ context, BookmarkUtils.createAddToHomeIntent(shortcutIntent, userTitle, icon, url));
// Alert the user about adding the shortcut.
final String shortUrl = UrlUtilities.getDomainAndRegistry(url, true);
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698