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

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

Issue 573073002: Use Web Manifest when creating a shortcut on Chrome Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc
index 00ccdb87411e72814c04f9307df1a01e9be38688..58e0d125f4ea3c03cbd2fd24ef56cf817ff56b7b 100644
--- a/chrome/browser/android/shortcut_helper.cc
+++ b/chrome/browser/android/shortcut_helper.cc
@@ -23,6 +23,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/frame_navigate_params.h"
+#include "content/public/common/manifest.h"
#include "jni/ShortcutHelper_jni.h"
#include "ui/gfx/android/java_bitmap.h"
#include "ui/gfx/codec/png_codec.h"
@@ -71,6 +72,16 @@ void ShortcutHelper::OnDidGetWebApplicationInfo(
title_ = web_app_info.title.empty() ? web_contents()->GetTitle()
: web_app_info.title;
+ web_contents()->GetManifest(base::Bind(&ShortcutHelper::OnDidGetManifest,
+ base::Unretained(this)));
+}
+
+void ShortcutHelper::OnDidGetManifest(const content::Manifest& manifest) {
+ if (!manifest.short_name.is_null())
+ title_ = manifest.short_name.string();
+ else if (!manifest.name.is_null())
+ title_ = manifest.name.string();
+
JNIEnv* env = base::android::AttachCurrentThread();
Mike West 2014/09/17 07:57:00 Nit: For clarity, I'd suggest breaking this block
mlamouri (slow - plz ping) 2014/09/17 08:47:11 Done.
ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
ScopedJavaLocalRef<jstring> j_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