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

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

Issue 24063004: Adding a dialog on click of "add to homescreen" menu item to edit the title. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed Created 7 years, 3 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/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.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 354454644084a2911a540538130c4dc04cc5773b..0cec58a0e07d1a9b0db5c7285e6d8205f0a8bbd5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
@@ -37,19 +37,21 @@ public class ShortcutHelper {
/**
* Adds a shortcut for the current Tab.
* @param tab Tab to create a shortcut for.
+ * @param userRequestedTitle Updated title for the shortcut.
*/
- public static void addShortcut(TabBase tab) {
+ public static void addShortcut(TabBase tab, String userRequestedTitle) {
if (sWebappActivityPackageName == null || sWebappActivityClassName == null) {
Log.e("ShortcutHelper", "ShortcutHelper is uninitialized. Aborting.");
return;
}
- nativeAddShortcut(tab.getNativePtr());
+ nativeAddShortcut(tab.getNativePtr(), userRequestedTitle);
}
/**
* Called when we have to fire an Intent to add a shortcut to the homescreen.
* If the webpage indicated that it was capable of functioning as a webapp, it is added as a
- * shortcut to a webapp Activity rather than as a general bookmark.
+ * shortcut to a webapp Activity rather than as a general bookmark. User is sent to the
+ * homescreen as soon as the shortcut is created.
*/
@SuppressWarnings("unused")
@CalledByNative
@@ -74,7 +76,12 @@ public class ShortcutHelper {
green, blue);
}
context.sendBroadcast(addIntent);
+ // User is sent to the homescreen as soon as the shortcut is created.
+ Intent homeIntent = new Intent(Intent.ACTION_MAIN);
+ homeIntent.addCategory(Intent.CATEGORY_HOME);
+ homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(homeIntent);
}
- private static native void nativeAddShortcut(int tabAndroidPtr);
+ private static native void nativeAddShortcut(int tabAndroidPtr, String userRequestedTitle);
}
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/ShortcutHelperTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698