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

Unified Diff: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc

Issue 1308533006: webapps: allow callers of icon downloader/selector to specify a minimum size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webapps-splashscreen-icon
Patch Set: Address review comments Created 5 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/webapps/add_to_homescreen_data_fetcher.cc
diff --git a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
index 46b0edff59d2879bac447d8f482b7a5d1a38e64a..55929dfa6b021d0c4f462217988591f429ff4735 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
@@ -34,8 +34,10 @@ using content::Manifest;
AddToHomescreenDataFetcher::AddToHomescreenDataFetcher(
content::WebContents* web_contents,
- int ideal_splash_image_size_in_dp,
int ideal_icon_size_in_dp,
+ int minimum_icon_size_in_dp,
+ int ideal_splash_image_size_in_dp,
+ int minimum_splash_image_size_in_dp,
Observer* observer)
: WebContentsObserver(web_contents),
weak_observer_(observer),
@@ -45,8 +47,10 @@ AddToHomescreenDataFetcher::AddToHomescreenDataFetcher(
icon_timeout_timer_(false, false),
shortcut_info_(dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(
web_contents->GetURL())),
+ ideal_icon_size_in_dp_(ideal_icon_size_in_dp),
+ minimum_icon_size_in_dp_(minimum_icon_size_in_dp),
ideal_splash_image_size_in_dp_(ideal_splash_image_size_in_dp),
- ideal_icon_size_in_dp_(ideal_icon_size_in_dp) {
+ minimum_splash_image_size_in_dp_(minimum_splash_image_size_in_dp) {
// Send a message to the renderer to retrieve information about the page.
is_waiting_for_web_application_info_ = true;
Send(new ChromeViewMsg_GetWebApplicationInfo(routing_id()));
@@ -109,6 +113,7 @@ void AddToHomescreenDataFetcher::OnDidGetManifest(
GURL icon_src = ManifestIconSelector::FindBestMatchingIcon(
manifest.icons,
ideal_icon_size_in_dp_,
+ minimum_icon_size_in_dp_,
gfx::Screen::GetScreenFor(web_contents()->GetNativeView()));
// If fetching the Manifest icon fails, fallback to the best favicon
@@ -117,6 +122,7 @@ void AddToHomescreenDataFetcher::OnDidGetManifest(
web_contents(),
icon_src,
ideal_icon_size_in_dp_,
+ minimum_icon_size_in_dp_,
base::Bind(&AddToHomescreenDataFetcher::OnManifestIconFetched,
this))) {
FetchFavicon();
@@ -126,6 +132,7 @@ void AddToHomescreenDataFetcher::OnDidGetManifest(
splash_screen_url_ = ManifestIconSelector::FindBestMatchingIcon(
manifest.icons,
ideal_splash_image_size_in_dp_,
+ minimum_splash_image_size_in_dp_,
gfx::Screen::GetScreenFor(web_contents()->GetNativeView()));
weak_observer_->OnUserTitleAvailable(shortcut_info_.user_title);
@@ -165,6 +172,7 @@ void AddToHomescreenDataFetcher::FetchSplashScreenImage(
web_contents(),
splash_screen_url_,
ideal_splash_image_size_in_dp_,
+ minimum_splash_image_size_in_dp_,
webapp_id);
}

Powered by Google App Engine
This is Rietveld 408576698