| Index: chrome/browser/android/shortcut_helper.cc
|
| diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc
|
| index 9a0674f440f3f56984eeeaf7f5f7eb87eb239df3..0425187adcf623bbad2bd757fd70c4363f6d3c9a 100644
|
| --- a/chrome/browser/android/shortcut_helper.cc
|
| +++ b/chrome/browser/android/shortcut_helper.cc
|
| @@ -19,6 +19,7 @@
|
| #include "chrome/browser/android/webapk/chrome_webapk_host.h"
|
| #include "chrome/browser/android/webapk/webapk_install_service.h"
|
| #include "chrome/browser/android/webapk/webapk_metrics.h"
|
| +#include "chrome/browser/installable/installable_manager.h"
|
| #include "chrome/browser/manifest/manifest_icon_downloader.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "content/public/browser/browser_thread.h"
|
| @@ -35,9 +36,7 @@ using content::Manifest;
|
| namespace {
|
|
|
| int g_ideal_homescreen_icon_size = -1;
|
| -int g_minimum_homescreen_icon_size = -1;
|
| int g_ideal_splash_image_size = -1;
|
| -int g_minimum_splash_image_size = -1;
|
| int g_ideal_badge_icon_size = -1;
|
|
|
| int g_default_rgb_icon_value = 145;
|
| @@ -52,18 +51,14 @@ void GetHomescreenIconAndSplashImageSizes() {
|
| base::android::JavaIntArrayToIntVector(env, java_size_array.obj(), &sizes);
|
|
|
| // Check that the size returned is what is expected.
|
| - DCHECK(sizes.size() == 5);
|
| + DCHECK(sizes.size() == 3);
|
|
|
| // This ordering must be kept up to date with the Java ShortcutHelper.
|
| - g_ideal_homescreen_icon_size = sizes[0];
|
| - g_minimum_homescreen_icon_size = sizes[1];
|
| - g_ideal_splash_image_size = sizes[2];
|
| - g_minimum_splash_image_size = sizes[3];
|
| - g_ideal_badge_icon_size = sizes[4];
|
| -
|
| - // Try to ensure that the data returned is sane.
|
| - DCHECK(g_minimum_homescreen_icon_size <= g_ideal_homescreen_icon_size);
|
| - DCHECK(g_minimum_splash_image_size <= g_ideal_splash_image_size);
|
| + g_ideal_homescreen_icon_size =
|
| + std::max(sizes[0], InstallableManager::GetMinimumIconSizeInPx());
|
| + g_ideal_splash_image_size =
|
| + std::max(sizes[1], InstallableManager::GetMinimumIconSizeInPx());
|
| + g_ideal_badge_icon_size = sizes[2];
|
| }
|
|
|
| // Adds a shortcut which opens in a fullscreen window to the launcher.
|
| @@ -143,7 +138,7 @@ void ShortcutHelper::AddToLauncherWithSkBitmap(
|
| info, webapp_id, icon_bitmap,
|
| base::Bind(&ShortcutHelper::FetchSplashScreenImage, web_contents,
|
| info.splash_image_url, info.ideal_splash_image_size_in_px,
|
| - info.minimum_splash_image_size_in_px, webapp_id));
|
| + webapp_id));
|
| GooglePlayInstallState state =
|
| ChromeWebApkHost::GetGooglePlayInstallState();
|
| if (state != GooglePlayInstallState::SUPPORTED)
|
| @@ -180,24 +175,12 @@ int ShortcutHelper::GetIdealHomescreenIconSizeInPx() {
|
| return g_ideal_homescreen_icon_size;
|
| }
|
|
|
| -int ShortcutHelper::GetMinimumHomescreenIconSizeInPx() {
|
| - if (g_minimum_homescreen_icon_size == -1)
|
| - GetHomescreenIconAndSplashImageSizes();
|
| - return g_minimum_homescreen_icon_size;
|
| -}
|
| -
|
| int ShortcutHelper::GetIdealSplashImageSizeInPx() {
|
| if (g_ideal_splash_image_size == -1)
|
| GetHomescreenIconAndSplashImageSizes();
|
| return g_ideal_splash_image_size;
|
| }
|
|
|
| -int ShortcutHelper::GetMinimumSplashImageSizeInPx() {
|
| - if (g_minimum_splash_image_size == -1)
|
| - GetHomescreenIconAndSplashImageSizes();
|
| - return g_minimum_splash_image_size;
|
| -}
|
| -
|
| int ShortcutHelper::GetIdealBadgeIconSizeInPx() {
|
| if (g_ideal_badge_icon_size == -1)
|
| GetHomescreenIconAndSplashImageSizes();
|
| @@ -209,13 +192,12 @@ void ShortcutHelper::FetchSplashScreenImage(
|
| content::WebContents* web_contents,
|
| const GURL& image_url,
|
| const int ideal_splash_image_size_in_px,
|
| - const int minimum_splash_image_size_in_px,
|
| const std::string& webapp_id) {
|
| // This is a fire and forget task. It is not vital for the splash screen image
|
| // to be downloaded so if the downloader returns false there is no fallback.
|
| ManifestIconDownloader::Download(
|
| web_contents, image_url, ideal_splash_image_size_in_px,
|
| - minimum_splash_image_size_in_px,
|
| + InstallableManager::GetMinimumIconSizeInPx(),
|
| base::Bind(&ShortcutHelper::StoreWebappSplashImage, webapp_id));
|
| }
|
|
|
|
|