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

Unified Diff: components/favicon/core/large_icon_service.cc

Issue 2896803002: [LargeIconService] Make check_seen param optional for fetching (Closed)
Patch Set: Comments on unit-test Created 3 years, 7 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: components/favicon/core/large_icon_service.cc
diff --git a/components/favicon/core/large_icon_service.cc b/components/favicon/core/large_icon_service.cc
index 387f5a714ac5fd70fa3459c25609609ee6ccd1f5..df9f2e32e5a1db688c0f269cb33f14789e74bf9e 100644
--- a/components/favicon/core/large_icon_service.cc
+++ b/components/favicon/core/large_icon_service.cc
@@ -40,10 +40,12 @@ const base::Feature kLargeIconServiceFetchingFeature{
const char kGoogleServerV2RequestFormat[] =
"https://t0.gstatic.com/faviconV2?"
- "client=chrome&drop_404_icon=true&check_seen=true&"
+ "client=chrome&drop_404_icon=true&%s"
"size=%d&min_size=%d&max_size=%d&fallback_opts=TYPE,SIZE,URL&url=%s";
const char kGoogleServerV2RequestFormatParam[] = "request_format";
+const char kCheckSeenParam[] = "check_seen=true&";
+
const int kGoogleServerV2EnforcedMinSizeInPixel = 32;
const char kGoogleServerV2EnforcedMinSizeInPixelParam[] =
"enforced_min_size_in_pixel";
@@ -66,7 +68,8 @@ GURL TrimPageUrlForGoogleServer(const GURL& page_url) {
GURL GetRequestUrlForGoogleServerV2(const GURL& page_url,
int min_source_size_in_pixel,
- int desired_size_in_pixel) {
+ int desired_size_in_pixel,
+ bool may_page_url_be_private) {
std::string url_format = base::GetFieldTrialParamValueByFeature(
kLargeIconServiceFetchingFeature, kGoogleServerV2RequestFormatParam);
double desired_to_max_size_factor = base::GetFieldTrialParamByFeatureAsDouble(
@@ -86,8 +89,8 @@ GURL GetRequestUrlForGoogleServerV2(const GURL& page_url,
return GURL(base::StringPrintf(
url_format.empty() ? kGoogleServerV2RequestFormat : url_format.c_str(),
- desired_size_in_pixel, min_source_size_in_pixel, max_size_in_pixel,
- page_url.spec().c_str()));
+ may_page_url_be_private ? kCheckSeenParam : "", desired_size_in_pixel,
+ min_source_size_in_pixel, max_size_in_pixel, page_url.spec().c_str()));
}
bool IsDbResultAdequate(const favicon_base::FaviconRawBitmapResult& db_result,
@@ -345,12 +348,14 @@ void LargeIconService::
const GURL& page_url,
int min_source_size_in_pixel,
int desired_size_in_pixel,
+ bool may_page_url_be_private,
const base::Callback<void(bool success)>& callback) {
DCHECK_LE(0, min_source_size_in_pixel);
const GURL trimmed_page_url = TrimPageUrlForGoogleServer(page_url);
const GURL server_request_url = GetRequestUrlForGoogleServerV2(
- trimmed_page_url, min_source_size_in_pixel, desired_size_in_pixel);
+ trimmed_page_url, min_source_size_in_pixel, desired_size_in_pixel,
+ may_page_url_be_private);
// Do not download if the URL is invalid after trimming, or there is a
// previous cache miss recorded for |server_request_url|.
« no previous file with comments | « components/favicon/core/large_icon_service.h ('k') | components/favicon/core/large_icon_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698