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

Side by Side Diff: components/favicon/core/large_icon_service.cc

Issue 2794343002: Network traffic annotation added to image_data_fetcher. (Closed)
Patch Set: Android and iOS files added. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/favicon/core/large_icon_service.h" 5 #include "components/favicon/core/large_icon_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (!server_request_url.is_valid() || !trimmed_page_url.is_valid() || 332 if (!server_request_url.is_valid() || !trimmed_page_url.is_valid() ||
333 !image_fetcher_ || 333 !image_fetcher_ ||
334 favicon_service_->WasUnableToDownloadFavicon(server_request_url)) { 334 favicon_service_->WasUnableToDownloadFavicon(server_request_url)) {
335 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 335 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
336 base::Bind(callback, false)); 336 base::Bind(callback, false));
337 return; 337 return;
338 } 338 }
339 339
340 image_fetcher_->SetDataUseServiceName( 340 image_fetcher_->SetDataUseServiceName(
341 data_use_measurement::DataUseUserData::LARGE_ICON_SERVICE); 341 data_use_measurement::DataUseUserData::LARGE_ICON_SERVICE);
342 net::NetworkTrafficAnnotationTag traffic_annotation =
343 net::DefineNetworkTrafficAnnotation("...", R"(
pkotwicz 2017/05/12 17:10:31 favicon_component
Ramin Halavati 2017/05/13 08:51:28 Done.
344 semantics {
345 sender: "..."
pkotwicz 2017/05/12 17:10:31 Favicon component
Ramin Halavati 2017/05/13 08:51:28 Done.
346 description: "..."
pkotwicz 2017/05/12 17:10:31 Sends a request to a Google server to retrieve the
Ramin Halavati 2017/05/13 08:51:28 Done.
347 trigger: "..."
pkotwicz 2017/05/12 17:10:31 A request can be sent for signed-in users when Chr
Ramin Halavati 2017/05/13 08:51:28 Done.
348 data: "..."
pkotwicz 2017/05/12 17:10:31 Page URL and desired icon size
Ramin Halavati 2017/05/13 08:51:29 Done.
349 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL
pkotwicz 2017/05/12 17:10:31 GOOGLE_OWNED_SERVICE
Ramin Halavati 2017/05/13 08:51:28 Done.
350 }
351 policy {
352 cookies_allowed: false/true
353 cookies_store: "..."
354 setting: "..."
355 chrome_policy {
356 [POLICY_NAME] {
357 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
358 [POLICY_NAME]: ... //(value to disable it)
359 }
360 }
361 policy_exception_justification: "..."
pkotwicz 2017/05/12 17:10:31 For the policy block, I think it should say this:
Ramin Halavati 2017/05/13 08:51:28 Done.
362 })");
342 image_fetcher_->StartOrQueueNetworkRequest( 363 image_fetcher_->StartOrQueueNetworkRequest(
343 server_request_url.spec(), server_request_url, 364 server_request_url.spec(), server_request_url,
344 base::Bind(&OnFetchIconFromGoogleServerComplete, favicon_service_, 365 base::Bind(&OnFetchIconFromGoogleServerComplete, favicon_service_,
345 page_url, callback)); 366 page_url, callback),
367 traffic_annotation);
346 } 368 }
347 369
348 base::CancelableTaskTracker::TaskId 370 base::CancelableTaskTracker::TaskId
349 LargeIconService::GetLargeIconOrFallbackStyleImpl( 371 LargeIconService::GetLargeIconOrFallbackStyleImpl(
350 const GURL& page_url, 372 const GURL& page_url,
351 int min_source_size_in_pixel, 373 int min_source_size_in_pixel,
352 int desired_size_in_pixel, 374 int desired_size_in_pixel,
353 const favicon_base::LargeIconCallback& raw_bitmap_callback, 375 const favicon_base::LargeIconCallback& raw_bitmap_callback,
354 const favicon_base::LargeIconImageCallback& image_callback, 376 const favicon_base::LargeIconImageCallback& image_callback,
355 base::CancelableTaskTracker* tracker) { 377 base::CancelableTaskTracker* tracker) {
356 DCHECK_LE(1, min_source_size_in_pixel); 378 DCHECK_LE(1, min_source_size_in_pixel);
357 DCHECK_LE(0, desired_size_in_pixel); 379 DCHECK_LE(0, desired_size_in_pixel);
358 380
359 scoped_refptr<LargeIconWorker> worker = new LargeIconWorker( 381 scoped_refptr<LargeIconWorker> worker = new LargeIconWorker(
360 min_source_size_in_pixel, desired_size_in_pixel, raw_bitmap_callback, 382 min_source_size_in_pixel, desired_size_in_pixel, raw_bitmap_callback,
361 image_callback, background_task_runner_, tracker); 383 image_callback, background_task_runner_, tracker);
362 384
363 // TODO(beaudoin): For now this is just a wrapper around 385 // TODO(beaudoin): For now this is just a wrapper around
364 // GetLargestRawFaviconForPageURL. Add the logic required to select the best 386 // GetLargestRawFaviconForPageURL. Add the logic required to select the best
365 // possible large icon. Also add logic to fetch-on-demand when the URL of 387 // possible large icon. Also add logic to fetch-on-demand when the URL of
366 // a large icon is known but its bitmap is not available. 388 // a large icon is known but its bitmap is not available.
367 return favicon_service_->GetLargestRawFaviconForPageURL( 389 return favicon_service_->GetLargestRawFaviconForPageURL(
368 page_url, large_icon_types_, min_source_size_in_pixel, 390 page_url, large_icon_types_, min_source_size_in_pixel,
369 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); 391 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker);
370 } 392 }
371 393
372 } // namespace favicon 394 } // namespace favicon
OLDNEW
« no previous file with comments | « chrome/browser/search/thumbnail_source.cc ('k') | components/favicon/core/large_icon_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698