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

Unified Diff: chrome/browser/banners/app_banner_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: Fix test failure 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/banners/app_banner_data_fetcher.cc
diff --git a/chrome/browser/banners/app_banner_data_fetcher.cc b/chrome/browser/banners/app_banner_data_fetcher.cc
index 21e29df41b928b79dd8ce2651a5b76bef3fc8bcb..fb6690502aa8a41dcf336289ed4f608245473506 100644
--- a/chrome/browser/banners/app_banner_data_fetcher.cc
+++ b/chrome/browser/banners/app_banner_data_fetcher.cc
@@ -74,14 +74,17 @@ void AppBannerDataFetcher::SetTimeDeltaForTesting(int days) {
AppBannerDataFetcher::AppBannerDataFetcher(
content::WebContents* web_contents,
base::WeakPtr<Delegate> delegate,
- int ideal_icon_size_in_dp)
+ int ideal_icon_size_in_dp,
+ int minimum_icon_size_in_dp)
: WebContentsObserver(web_contents),
- ideal_icon_size_in_dp_(ideal_icon_size_in_dp),
weak_delegate_(delegate),
+ ideal_icon_size_in_dp_(ideal_icon_size_in_dp),
+ minimum_icon_size_in_dp_(minimum_icon_size_in_dp),
is_active_(false),
was_canceled_by_page_(false),
page_requested_prompt_(false),
event_request_id_(-1) {
+ DCHECK(minimum_icon_size_in_dp <= ideal_icon_size_in_dp);
}
void AppBannerDataFetcher::Start(const GURL& validated_url,
@@ -320,6 +323,7 @@ void AppBannerDataFetcher::OnHasServiceWorker(
ManifestIconSelector::FindBestMatchingIcon(
web_app_data_.icons,
ideal_icon_size_in_dp_,
+ minimum_icon_size_in_dp_,
gfx::Screen::GetScreenFor(web_contents->GetNativeView()));
if (!FetchAppIcon(web_contents, icon_url)) {
@@ -334,6 +338,7 @@ bool AppBannerDataFetcher::FetchAppIcon(content::WebContents* web_contents,
web_contents,
icon_url,
ideal_icon_size_in_dp_,
+ minimum_icon_size_in_dp_,
base::Bind(&AppBannerDataFetcher::OnAppIconFetched,
this));
}
« no previous file with comments | « chrome/browser/banners/app_banner_data_fetcher.h ('k') | chrome/browser/banners/app_banner_data_fetcher_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698