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

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

Issue 23530057: Merge 222950 "Adding a dialog on click of "add to homescreen" me..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1629/src/
Patch Set: 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 | « chrome/browser/android/shortcut_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/shortcut_helper.cc
===================================================================
--- chrome/browser/android/shortcut_helper.cc (revision 223100)
+++ chrome/browser/android/shortcut_helper.cc (working copy)
@@ -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,
+ const string16& title)
: is_webapp_capable_(false) {
Observe(web_contents);
url_ = web_contents->GetURL();
- title_ = web_contents->GetTitle();
+ if (title.length() > 0)
+ 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 @@
delete this;
}
-void ShortcutHelper::AddShortcut(content::WebContents* web_contents) {
+void ShortcutHelper::AddShortcut(content::WebContents* web_contents,
+ const 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 @@
// 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));
}
« no previous file with comments | « chrome/browser/android/shortcut_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698