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

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 InstallWebApk from infobar. Created 4 years, 4 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..57853e49d69d42ef95a4de06acd61eab9fa42ff2 100644
--- a/chrome/browser/android/banners/app_banner_manager_android.cc
+++ b/chrome/browser/android/banners/app_banner_manager_android.cc
@@ -12,6 +12,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/android/banners/app_banner_infobar_delegate_android.h"
#include "chrome/browser/android/shortcut_helper.h"
+#include "chrome/browser/android/shortcut_info.h"
#include "chrome/browser/android/webapk/chrome_webapk_host.h"
#include "chrome/browser/android/webapk/webapk_web_manifest_checker.h"
#include "chrome/browser/banners/app_banner_metrics.h"
@@ -188,9 +189,10 @@ void AppBannerManagerAndroid::ShowBanner() {
infobars::InfoBar* infobar = nullptr;
if (native_app_data_.is_null()) {
bool is_webapk = ChromeWebApkHost::AreWebApkEnabled();
+ std::unique_ptr<ShortcutInfo> info = CreateShortcutInfo();
std::unique_ptr<AppBannerInfoBarDelegateAndroid> delegate(
new AppBannerInfoBarDelegateAndroid(
- GetWeakPtr(), app_title_, manifest_url_, manifest_, icon_url_,
+ GetWeakPtr(), app_title_, manifest_url_, std::move(info), icon_url_,
std::move(icon_), event_request_id(), is_webapk));
infobar = new AppBannerInfoBarAndroid(
@@ -224,6 +226,17 @@ void AppBannerManagerAndroid::ShowBanner() {
}
}
+std::unique_ptr<ShortcutInfo> AppBannerManagerAndroid::CreateShortcutInfo() {
dominickn 2016/09/01 05:22:00 Put this method in the anonymous namespace in AppB
Xi Han 2016/09/01 18:44:14 Done.
+ std::unique_ptr<ShortcutInfo> info_ptr(new ShortcutInfo(GURL::EmptyGURL()));
+ if (manifest_.IsEmpty())
+ return info_ptr;
+ 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;
+}
+
bool AppBannerManagerAndroid::CanHandleNonWebApp(const std::string& platform,
const GURL& url,
const std::string& id) {

Powered by Google App Engine
This is Rietveld 408576698