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

Unified Diff: chrome/browser/android/shortcut_helper.cc

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: Error uploading patchset, trying again 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
Index: chrome/browser/android/shortcut_helper.cc
diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc
index 5322e840f79f9bf69100f3f9a327f6b10955384f..8f37404c6ef9f44df71d33e7998144f1c71b9fb1 100644
--- a/chrome/browser/android/shortcut_helper.cc
+++ b/chrome/browser/android/shortcut_helper.cc
@@ -26,11 +26,15 @@
#include "ui/gfx/color_analysis.h"
#include "url/gurl.h"
-ShortcutBuilder::ShortcutBuilder(content::WebContents* web_contents)
+ShortcutBuilder::ShortcutBuilder(content::WebContents* web_contents,
+ string16 title)
: is_webapp_capable_(false) {
Observe(web_contents);
url_ = web_contents->GetURL();
- title_ = web_contents->GetTitle();
+ if (title.length() != 0)
gone 2013/09/13 00:31:53 nit: > 0
Ramya 2013/09/13 01:04:34 Done.
+ title_ = title;
+ else
+ title_ = web_contents->GetTitle();
// Send a message to the renderer to retrieve information about the page.
Send(new ChromeViewMsg_RetrieveWebappInformation(routing_id(), url_));
@@ -108,9 +112,10 @@ void ShortcutBuilder::Destroy() {
delete this;
}
-void ShortcutHelper::AddShortcut(content::WebContents* web_contents) {
+void ShortcutHelper::AddShortcut(content::WebContents* web_contents,
+ string16 title) {
// The ShortcutBuilder deletes itself when it's done.
- new ShortcutBuilder(web_contents);
+ new ShortcutBuilder(web_contents, title);
}
bool ShortcutHelper::RegisterShortcutHelper(JNIEnv* env) {
@@ -167,7 +172,12 @@ void ShortcutHelper::AddShortcutInBackground(
// background tasks to pull all the data required.
// Note that we don't actually care about the tab here -- we just want
// its otherwise inaccessible WebContents.
-static void AddShortcut(JNIEnv* env, jclass clazz, jint tab_android_ptr) {
+static void AddShortcut(JNIEnv* env,
+ jclass clazz,
+ jint tab_android_ptr,
+ jstring title) {
TabAndroid* tab = reinterpret_cast<TabAndroid*>(tab_android_ptr);
- ShortcutHelper::AddShortcut(tab->web_contents());
+ ShortcutHelper::AddShortcut(
+ tab->web_contents(),
+ base::android::ConvertJavaStringToUTF16(env, title));
}

Powered by Google App Engine
This is Rietveld 408576698