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

Side by Side Diff: chrome/browser/favicon/large_icon_service_factory.cc

Issue 2794343002: Network traffic annotation added to image_data_fetcher. (Closed)
Patch Set: Annotation moved to callers. 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 "chrome/browser/favicon/large_icon_service_factory.h" 5 #include "chrome/browser/favicon/large_icon_service_factory.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "base/task_scheduler/post_task.h" 8 #include "base/task_scheduler/post_task.h"
9 #include "chrome/browser/favicon/favicon_service_factory.h" 9 #include "chrome/browser/favicon/favicon_service_factory.h"
10 #include "chrome/browser/profiles/incognito_helpers.h" 10 #include "chrome/browser/profiles/incognito_helpers.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/search/suggestions/image_decoder_impl.h" 12 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
13 #include "components/favicon/core/favicon_service.h" 13 #include "components/favicon/core/favicon_service.h"
14 #include "components/favicon/core/large_icon_service.h" 14 #include "components/favicon/core/large_icon_service.h"
15 #include "components/image_fetcher/core/image_decoder.h" 15 #include "components/image_fetcher/core/image_decoder.h"
16 #include "components/image_fetcher/core/image_fetcher_impl.h" 16 #include "components/image_fetcher/core/image_fetcher_impl.h"
17 #include "components/keyed_service/content/browser_context_dependency_manager.h" 17 #include "components/keyed_service/content/browser_context_dependency_manager.h"
18 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
19 #include "net/traffic_annotation/network_traffic_annotation.h"
19 20
20 // static 21 // static
21 favicon::LargeIconService* LargeIconServiceFactory::GetForBrowserContext( 22 favicon::LargeIconService* LargeIconServiceFactory::GetForBrowserContext(
22 content::BrowserContext* context) { 23 content::BrowserContext* context) {
23 return static_cast<favicon::LargeIconService*>( 24 return static_cast<favicon::LargeIconService*>(
24 GetInstance()->GetServiceForBrowserContext(context, true)); 25 GetInstance()->GetServiceForBrowserContext(context, true));
25 } 26 }
26 27
27 // static 28 // static
28 LargeIconServiceFactory* LargeIconServiceFactory::GetInstance() { 29 LargeIconServiceFactory* LargeIconServiceFactory::GetInstance() {
(...skipping 13 matching lines...) Expand all
42 content::BrowserContext* context) const { 43 content::BrowserContext* context) const {
43 return chrome::GetBrowserContextRedirectedInIncognito(context); 44 return chrome::GetBrowserContextRedirectedInIncognito(context);
44 } 45 }
45 46
46 KeyedService* LargeIconServiceFactory::BuildServiceInstanceFor( 47 KeyedService* LargeIconServiceFactory::BuildServiceInstanceFor(
47 content::BrowserContext* context) const { 48 content::BrowserContext* context) const {
48 Profile* profile = Profile::FromBrowserContext(context); 49 Profile* profile = Profile::FromBrowserContext(context);
49 favicon::FaviconService* favicon_service = 50 favicon::FaviconService* favicon_service =
50 FaviconServiceFactory::GetForProfile(profile, 51 FaviconServiceFactory::GetForProfile(profile,
51 ServiceAccessType::EXPLICIT_ACCESS); 52 ServiceAccessType::EXPLICIT_ACCESS);
53 net::NetworkTrafficAnnotationTag traffic_annotation =
54 net::DefineNetworkTrafficAnnotation("...", R"(
55 semantics {
56 sender: "..."
57 description: "..."
58 trigger: "..."
59 data: "..."
60 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL
61 }
62 policy {
63 cookies_allowed: false/true
64 cookies_store: "..."
65 setting: "..."
66 chrome_policy {
67 [POLICY_NAME] {
68 policy_options {mode: MANDATORY/RECOMMENDED/UNSET}
69 [POLICY_NAME]: ... //(value to disable it)
70 }
71 }
72 policy_exception_justification: "..."
73 })");
52 return new favicon::LargeIconService( 74 return new favicon::LargeIconService(
53 favicon_service, 75 favicon_service,
54 base::CreateTaskRunnerWithTraits( 76 base::CreateTaskRunnerWithTraits(
55 {base::MayBlock(), base::TaskPriority::BACKGROUND, 77 {base::MayBlock(), base::TaskPriority::BACKGROUND,
56 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}), 78 base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}),
57 base::MakeUnique<image_fetcher::ImageFetcherImpl>( 79 base::MakeUnique<image_fetcher::ImageFetcherImpl>(
58 base::MakeUnique<suggestions::ImageDecoderImpl>(), 80 base::MakeUnique<suggestions::ImageDecoderImpl>(),
59 profile->GetRequestContext())); 81 profile->GetRequestContext(), traffic_annotation));
60 } 82 }
61 83
62 bool LargeIconServiceFactory::ServiceIsNULLWhileTesting() const { 84 bool LargeIconServiceFactory::ServiceIsNULLWhileTesting() const {
63 return true; 85 return true;
64 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698