OLD | NEW |
---|---|
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 Loading... | |
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("favicon_component", R"( | |
344 semantics { | |
345 sender: "Favicon Component" | |
346 description: | |
347 "Sends a request to a Google server to retrieve the favicon bitmap " | |
msramek
2017/05/18 11:25:18
Since the payload is sensitive, can you please ela
pkotwicz
2017/05/18 15:47:43
There are multiple places where the payload can co
msramek
2017/05/18 16:02:16
So, my point is that we generally only share user'
jkrcal
2017/05/19 06:18:21
I would replace the "For instance, ..." sentence b
Ramin Halavati
2017/05/19 06:37:37
Done.
| |
348 "for a page URL." | |
349 trigger: | |
350 "A request can be sent for signed-in users when Chrome does not " | |
351 "have a favicon for a particular page. For instance, this is used " | |
352 "by the new tab page for the 'most visited' tiles." | |
353 data: "Page URL and desired icon size." | |
354 destination: GOOGLE_OWNED_SERVICE | |
355 } | |
356 policy { | |
357 cookies_allowed: false | |
358 setting: "This feature cannot be disabled by settings." | |
359 policy_exception_justification: "Not implemented." | |
360 })"); | |
342 image_fetcher_->StartOrQueueNetworkRequest( | 361 image_fetcher_->StartOrQueueNetworkRequest( |
343 server_request_url.spec(), server_request_url, | 362 server_request_url.spec(), server_request_url, |
344 base::Bind(&OnFetchIconFromGoogleServerComplete, favicon_service_, | 363 base::Bind(&OnFetchIconFromGoogleServerComplete, favicon_service_, |
345 page_url, callback)); | 364 page_url, callback), |
365 traffic_annotation); | |
346 } | 366 } |
347 | 367 |
348 base::CancelableTaskTracker::TaskId | 368 base::CancelableTaskTracker::TaskId |
349 LargeIconService::GetLargeIconOrFallbackStyleImpl( | 369 LargeIconService::GetLargeIconOrFallbackStyleImpl( |
350 const GURL& page_url, | 370 const GURL& page_url, |
351 int min_source_size_in_pixel, | 371 int min_source_size_in_pixel, |
352 int desired_size_in_pixel, | 372 int desired_size_in_pixel, |
353 const favicon_base::LargeIconCallback& raw_bitmap_callback, | 373 const favicon_base::LargeIconCallback& raw_bitmap_callback, |
354 const favicon_base::LargeIconImageCallback& image_callback, | 374 const favicon_base::LargeIconImageCallback& image_callback, |
355 base::CancelableTaskTracker* tracker) { | 375 base::CancelableTaskTracker* tracker) { |
356 DCHECK_LE(1, min_source_size_in_pixel); | 376 DCHECK_LE(1, min_source_size_in_pixel); |
357 DCHECK_LE(0, desired_size_in_pixel); | 377 DCHECK_LE(0, desired_size_in_pixel); |
358 | 378 |
359 scoped_refptr<LargeIconWorker> worker = new LargeIconWorker( | 379 scoped_refptr<LargeIconWorker> worker = new LargeIconWorker( |
360 min_source_size_in_pixel, desired_size_in_pixel, raw_bitmap_callback, | 380 min_source_size_in_pixel, desired_size_in_pixel, raw_bitmap_callback, |
361 image_callback, background_task_runner_, tracker); | 381 image_callback, background_task_runner_, tracker); |
362 | 382 |
363 // TODO(beaudoin): For now this is just a wrapper around | 383 // TODO(beaudoin): For now this is just a wrapper around |
364 // GetLargestRawFaviconForPageURL. Add the logic required to select the best | 384 // GetLargestRawFaviconForPageURL. Add the logic required to select the best |
365 // possible large icon. Also add logic to fetch-on-demand when the URL of | 385 // 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. | 386 // a large icon is known but its bitmap is not available. |
367 return favicon_service_->GetLargestRawFaviconForPageURL( | 387 return favicon_service_->GetLargestRawFaviconForPageURL( |
368 page_url, large_icon_types_, min_source_size_in_pixel, | 388 page_url, large_icon_types_, min_source_size_in_pixel, |
369 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); | 389 base::Bind(&LargeIconWorker::OnIconLookupComplete, worker), tracker); |
370 } | 390 } |
371 | 391 |
372 } // namespace favicon | 392 } // namespace favicon |
OLD | NEW |