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

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

Issue 2724723002: [WebAPKs]: Reduce the parameters of ShortcutHelper::AddToLauncherWithSkBitmap() (Closed)
Patch Set: Created 3 years, 10 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 866e58341fa5b867e5f6e3c81061e704eed5d48d..cedc71d490686866c0570ff3fd8bb303ec34c15a 100644
--- a/chrome/browser/android/banners/app_banner_manager_android.cc
+++ b/chrome/browser/android/banners/app_banner_manager_android.cc
@@ -39,7 +39,10 @@ namespace {
std::unique_ptr<ShortcutInfo> CreateShortcutInfo(
const GURL& manifest_url,
const content::Manifest& manifest,
- const GURL& icon_url) {
+ const GURL& icon_url,
+ const GURL& splash_image_url,
+ int ideal_splash_image_size_in_px,
+ int minimum_splash_image_size_in_px) {
auto shortcut_info = base::MakeUnique<ShortcutInfo>(GURL());
if (!manifest.IsEmpty()) {
shortcut_info->UpdateFromManifest(manifest);
@@ -47,6 +50,10 @@ std::unique_ptr<ShortcutInfo> CreateShortcutInfo(
shortcut_info->best_primary_icon_url = icon_url;
shortcut_info->UpdateSource(ShortcutInfo::SOURCE_APP_BANNER);
}
+ shortcut_info->splash_image_url = splash_image_url;
+ shortcut_info->ideal_splash_image_size_in_px = ideal_splash_image_size_in_px;
+ shortcut_info->minimum_splash_image_size_in_px =
+ minimum_splash_image_size_in_px;
return shortcut_info;
}
@@ -67,25 +74,6 @@ AppBannerManagerAndroid::~AppBannerManagerAndroid() {
java_banner_manager_.Reset();
}
-base::Closure AppBannerManagerAndroid::FetchWebappSplashScreenImageCallback(
- const std::string& webapp_id) {
- content::WebContents* contents = web_contents();
- DCHECK(contents);
-
- int ideal_splash_image_size_in_px =
- ShortcutHelper::GetIdealSplashImageSizeInPx();
- int minimum_splash_image_size_in_px =
- ShortcutHelper::GetMinimumSplashImageSizeInPx();
- GURL image_url = ManifestIconSelector::FindBestMatchingIcon(
- manifest_.icons, ideal_splash_image_size_in_px,
- minimum_splash_image_size_in_px,
- content::Manifest::Icon::IconPurpose::ANY);
-
- return base::Bind(&ShortcutHelper::FetchSplashScreenImage, contents,
- image_url, ideal_splash_image_size_in_px,
- minimum_splash_image_size_in_px, webapp_id);
-}
-
const base::android::ScopedJavaGlobalRef<jobject>&
AppBannerManagerAndroid::GetJavaBannerManager() const {
return java_banner_manager_;
@@ -238,10 +226,22 @@ void AppBannerManagerAndroid::ShowBanner() {
DCHECK(contents);
if (native_app_data_.is_null()) {
+ int ideal_splash_image_size_in_px =
+ ShortcutHelper::GetIdealSplashImageSizeInPx();
+ int minimum_splash_image_size_in_px =
+ ShortcutHelper::GetMinimumSplashImageSizeInPx();
dominickn 2017/03/01 02:29:39 Can you move all of this into CreateShortcutInfo?
+ GURL splash_image_url = ManifestIconSelector::FindBestMatchingIcon(
+ manifest_.icons, ideal_splash_image_size_in_px,
+ minimum_splash_image_size_in_px,
+ content::Manifest::Icon::IconPurpose::ANY);
+
// TODO(zpeng): Add badge to WebAPK installation flow.
+ std::unique_ptr<ShortcutInfo> shortcut_info = CreateShortcutInfo(
+ manifest_url_, manifest_, primary_icon_url_, splash_image_url,
+ ideal_splash_image_size_in_px, minimum_splash_image_size_in_px);
+
if (AppBannerInfoBarDelegateAndroid::Create(
- contents, GetWeakPtr(), app_title_,
- CreateShortcutInfo(manifest_url_, manifest_, primary_icon_url_),
+ contents, GetWeakPtr(), app_title_, std::move(shortcut_info),
std::move(primary_icon_), event_request_id(),
webapk::INSTALL_SOURCE_BANNER)) {
RecordDidShowBanner("AppBanner.WebApp.Shown");

Powered by Google App Engine
This is Rietveld 408576698