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

Unified Diff: chrome/browser/android/banners/app_banner_manager_android.cc

Issue 2290603005: Trigger app banner when add to homescreen is pressed and WebAPKs are enabled. (Closed)
Patch Set: Remove the extra constructor in AppBannerInfoBarDelegateAndroid. Created 4 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/banners/app_banner_manager_android.cc
diff --git a/chrome/browser/android/banners/app_banner_manager_android.cc b/chrome/browser/android/banners/app_banner_manager_android.cc
index d7ba9c2dc61d2f8311e06b84d11a1c68bc62bbea..64bfec99ad5f231d1084d82b63e963cfc3d2229a 100644
--- a/chrome/browser/android/banners/app_banner_manager_android.cc
+++ b/chrome/browser/android/banners/app_banner_manager_android.cc
@@ -40,6 +40,20 @@ const char kReferrerName[] = "referrer";
const char kIdName[] = "id";
const char kPlayInlineReferrer[] = "playinline=chrome_inline";
+std::unique_ptr<ShortcutInfo> CreateShortcutInfo(
+ const GURL& manifest_url,
+ const content::Manifest& manifest,
+ const GURL& icon_url) {
+ std::unique_ptr<ShortcutInfo> info_ptr(new ShortcutInfo(GURL::EmptyGURL()));
+ if (!manifest.IsEmpty()) {
+ info_ptr->UpdateFromManifest(manifest);
+ info_ptr->manifest_url = manifest_url;
+ info_ptr->icon_url = icon_url;
+ info_ptr->UpdateSource(ShortcutInfo::SOURCE_APP_BANNER);
+ }
+ return info_ptr;
+}
+
} // anonymous namespace
namespace banners {
@@ -190,8 +204,9 @@ void AppBannerManagerAndroid::ShowBanner() {
bool is_webapk = ChromeWebApkHost::AreWebApkEnabled();
std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate(
new AppBannerInfoBarDelegateAndroid(
- GetWeakPtr(), app_title_, manifest_url_, manifest_, icon_url_,
- std::move(icon_), event_request_id(), is_webapk));
+ GetWeakPtr(), app_title_, manifest_url_,
+ CreateShortcutInfo(manifest_url_, manifest_, icon_url_),
+ icon_url_, std::move(icon_), event_request_id(), is_webapk));
infobar = new AppBannerInfoBarAndroid(
std::move(delegate), manifest_.start_url, is_webapk);

Powered by Google App Engine
This is Rietveld 408576698