OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ntp_tiles/chrome_most_visited_sites_factory.h" | 5 #include "chrome/browser/ntp_tiles/chrome_most_visited_sites_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "chrome/browser/favicon/favicon_service_factory.h" | 13 #include "chrome/browser/favicon/favicon_service_factory.h" |
14 #include "chrome/browser/history/top_sites_factory.h" | 14 #include "chrome/browser/history/top_sites_factory.h" |
15 #include "chrome/browser/ntp_tiles/chrome_popular_sites_factory.h" | 15 #include "chrome/browser/ntp_tiles/chrome_popular_sites_factory.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/search/suggestions/image_decoder_impl.h" | 17 #include "chrome/browser/search/suggestions/image_decoder_impl.h" |
18 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" | 18 #include "chrome/browser/search/suggestions/suggestions_service_factory.h" |
19 #include "chrome/browser/supervised_user/supervised_user_service.h" | 19 #include "chrome/browser/supervised_user/supervised_user_service.h" |
20 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 20 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
21 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" | 21 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" |
22 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 22 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
23 #include "chrome/browser/thumbnails/thumbnail_list_source.h" | 23 #include "chrome/browser/thumbnails/thumbnail_list_source.h" |
24 #include "components/history/core/browser/top_sites.h" | 24 #include "components/history/core/browser/top_sites.h" |
25 #include "components/image_fetcher/core/image_fetcher_impl.h" | 25 #include "components/image_fetcher/core/image_fetcher_impl.h" |
26 #include "components/ntp_tiles/icon_cacher_impl.h" | 26 #include "components/ntp_tiles/icon_cacher_impl.h" |
27 #include "components/ntp_tiles/metrics.h" | 27 #include "components/ntp_tiles/metrics.h" |
28 #include "components/ntp_tiles/most_visited_sites.h" | 28 #include "components/ntp_tiles/most_visited_sites.h" |
29 #include "net/traffic_annotation/network_traffic_annotation.h" | |
29 | 30 |
30 using suggestions::SuggestionsServiceFactory; | 31 using suggestions::SuggestionsServiceFactory; |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 class SupervisorBridge : public ntp_tiles::MostVisitedSitesSupervisor, | 35 class SupervisorBridge : public ntp_tiles::MostVisitedSitesSupervisor, |
35 public SupervisedUserServiceObserver { | 36 public SupervisedUserServiceObserver { |
36 public: | 37 public: |
37 explicit SupervisorBridge(Profile* profile); | 38 explicit SupervisorBridge(Profile* profile); |
38 ~SupervisorBridge() override; | 39 ~SupervisorBridge() override; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 } // namespace | 107 } // namespace |
107 | 108 |
108 // static | 109 // static |
109 std::unique_ptr<ntp_tiles::MostVisitedSites> | 110 std::unique_ptr<ntp_tiles::MostVisitedSites> |
110 ChromeMostVisitedSitesFactory::NewForProfile(Profile* profile) { | 111 ChromeMostVisitedSitesFactory::NewForProfile(Profile* profile) { |
111 // MostVisitedSites doesn't exist in incognito profiles. | 112 // MostVisitedSites doesn't exist in incognito profiles. |
112 if (profile->IsOffTheRecord()) { | 113 if (profile->IsOffTheRecord()) { |
113 return nullptr; | 114 return nullptr; |
114 } | 115 } |
115 | 116 |
117 net::NetworkTrafficAnnotationTag traffic_annotation = | |
Marc Treib
2017/05/09 09:43:46
icon_cacher_traffic_annotation
Ramin Halavati
2017/05/09 11:08:23
Done.
| |
118 net::DefineNetworkTrafficAnnotation("...", R"( | |
119 semantics { | |
120 sender: "..." | |
sfiera
2017/05/09 10:08:17
Popular Sites New Tab Fetch
Ramin Halavati
2017/05/09 11:08:23
Done.
| |
121 description: "..." | |
sfiera
2017/05/09 10:08:17
Google Chrome may display a list of regionally-pop
Ramin Halavati
2017/05/09 11:08:23
Done.
| |
122 trigger: "..." | |
sfiera
2017/05/09 10:08:17
Whenever a popular site would be displayed, but it
Ramin Halavati
2017/05/09 11:08:23
Done.
| |
123 data: "..." | |
sfiera
2017/05/09 10:08:17
None
Ramin Halavati
2017/05/09 11:08:23
Shouldn't it be URL of the required icon?
sfiera
2017/05/09 11:20:20
Well, yes, all HTTP requests include the URL of th
Ramin Halavati
2017/05/09 13:16:47
Acknowledged.
| |
124 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER/LOCAL | |
sfiera
2017/05/09 10:08:17
WEBSITE
Ramin Halavati
2017/05/09 11:08:23
Done.
| |
125 } | |
126 policy { | |
127 cookies_allowed: false/true | |
sfiera
2017/05/09 10:08:17
false
Ramin Halavati
2017/05/09 11:08:23
Done.
| |
128 cookies_store: "..." | |
129 setting: "..." | |
sfiera
2017/05/09 10:08:17
This is in progress—an experiment exists, but noth
Ramin Halavati
2017/05/09 11:08:23
Done.
| |
130 chrome_policy { | |
131 [POLICY_NAME] { | |
132 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
133 [POLICY_NAME]: ... //(value to disable it) | |
134 } | |
135 } | |
136 policy_exception_justification: "..." | |
137 })"); | |
116 return base::MakeUnique<ntp_tiles::MostVisitedSites>( | 138 return base::MakeUnique<ntp_tiles::MostVisitedSites>( |
117 profile->GetPrefs(), TopSitesFactory::GetForProfile(profile), | 139 profile->GetPrefs(), TopSitesFactory::GetForProfile(profile), |
118 SuggestionsServiceFactory::GetForProfile(profile), | 140 SuggestionsServiceFactory::GetForProfile(profile), |
119 #if defined(OS_ANDROID) | 141 #if defined(OS_ANDROID) |
120 ChromePopularSitesFactory::NewForProfile(profile), | 142 ChromePopularSitesFactory::NewForProfile(profile), |
121 #else | 143 #else |
122 nullptr, | 144 nullptr, |
123 #endif | 145 #endif |
124 base::MakeUnique<ntp_tiles::IconCacherImpl>( | 146 base::MakeUnique<ntp_tiles::IconCacherImpl>( |
125 FaviconServiceFactory::GetForProfile( | 147 FaviconServiceFactory::GetForProfile( |
126 profile, ServiceAccessType::IMPLICIT_ACCESS), | 148 profile, ServiceAccessType::IMPLICIT_ACCESS), |
127 base::MakeUnique<image_fetcher::ImageFetcherImpl>( | 149 base::MakeUnique<image_fetcher::ImageFetcherImpl>( |
128 base::MakeUnique<suggestions::ImageDecoderImpl>(), | 150 base::MakeUnique<suggestions::ImageDecoderImpl>(), |
129 profile->GetRequestContext())), | 151 profile->GetRequestContext(), traffic_annotation)), |
sfiera
2017/05/09 10:08:17
Isn't it necessary to update the iOS factory too?
Ramin Halavati
2017/05/09 11:08:23
I didn't quite get it. You mean instead of constru
sfiera
2017/05/09 11:20:20
Yes. I think it's better for the annotation to be
| |
130 base::MakeUnique<SupervisorBridge>(profile)); | 152 base::MakeUnique<SupervisorBridge>(profile)); |
131 } | 153 } |
OLD | NEW |