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

Side by Side Diff: components/ntp_tiles/most_visited_sites.h

Issue 2179233003: Start PopularSites fetch from separate function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 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 #ifndef COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ 5 #ifndef COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_
6 #define COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ 6 #define COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 Suggestion(Suggestion&&); 145 Suggestion(Suggestion&&);
146 Suggestion& operator=(Suggestion&&); 146 Suggestion& operator=(Suggestion&&);
147 147
148 private: 148 private:
149 DISALLOW_COPY_AND_ASSIGN(Suggestion); 149 DISALLOW_COPY_AND_ASSIGN(Suggestion);
150 }; 150 };
151 151
152 MostVisitedSites(scoped_refptr<base::SequencedWorkerPool> blocking_pool, 152 MostVisitedSites(scoped_refptr<base::SequencedWorkerPool> blocking_pool,
153 PrefService* prefs, 153 PrefService* prefs,
154 const TemplateURLService* template_url_service,
155 variations::VariationsService* variations_service,
156 net::URLRequestContextGetter* download_context,
157 const base::FilePath& popular_sites_directory,
158 scoped_refptr<history::TopSites> top_sites, 154 scoped_refptr<history::TopSites> top_sites,
159 suggestions::SuggestionsService* suggestions, 155 suggestions::SuggestionsService* suggestions,
156 PopularSites* popular_sites,
160 MostVisitedSitesSupervisor* supervisor); 157 MostVisitedSitesSupervisor* supervisor);
161 158
162 ~MostVisitedSites() override; 159 ~MostVisitedSites() override;
163 160
164 // Does not take ownership of |observer|, which must outlive this object and 161 // Does not take ownership of |observer|, which must outlive this object and
165 // must not be null. 162 // must not be null.
166 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); 163 void SetMostVisitedURLsObserver(Observer* observer, int num_sites);
167 164
168 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); 165 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url);
169 void RecordTileTypeMetrics(const std::vector<int>& tile_types, 166 void RecordTileTypeMetrics(const std::vector<int>& tile_types,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 222
226 // Records UMA histogram metrics related to the number of impressions. 223 // Records UMA histogram metrics related to the number of impressions.
227 void RecordImpressionUMAMetrics(); 224 void RecordImpressionUMAMetrics();
228 225
229 // history::TopSitesObserver implementation. 226 // history::TopSitesObserver implementation.
230 void TopSitesLoaded(history::TopSites* top_sites) override; 227 void TopSitesLoaded(history::TopSites* top_sites) override;
231 void TopSitesChanged(history::TopSites* top_sites, 228 void TopSitesChanged(history::TopSites* top_sites,
232 ChangeReason change_reason) override; 229 ChangeReason change_reason) override;
233 230
234 PrefService* prefs_; 231 PrefService* prefs_;
235 const TemplateURLService* template_url_service_;
236 variations::VariationsService* variations_service_;
237 net::URLRequestContextGetter* download_context_;
238 base::FilePath popular_sites_directory_;
239 scoped_refptr<history::TopSites> top_sites_; 232 scoped_refptr<history::TopSites> top_sites_;
240 suggestions::SuggestionsService* suggestions_service_; 233 suggestions::SuggestionsService* suggestions_service_;
234 PopularSites* const popular_sites_;
241 MostVisitedSitesSupervisor* supervisor_; 235 MostVisitedSitesSupervisor* supervisor_;
242 236
243 Observer* observer_; 237 Observer* observer_;
244 238
245 // The maximum number of most visited sites to return. 239 // The maximum number of most visited sites to return.
246 int num_sites_; 240 int num_sites_;
247 241
248 // Whether we have received an initial set of most visited sites (from either 242 // Whether we have received an initial set of most visited sites (from either
249 // TopSites or the SuggestionsService). 243 // TopSites or the SuggestionsService).
250 bool received_most_visited_sites_; 244 bool received_most_visited_sites_;
251 245
252 // Whether we have received the set of popular sites. Immediately set to true 246 // Whether we have received the set of popular sites. Immediately set to true
253 // if popular sites are disabled. 247 // if popular sites are disabled.
254 bool received_popular_sites_; 248 bool received_popular_sites_;
255 249
256 // Whether we have recorded one-shot UMA metrics such as impressions. They are 250 // Whether we have recorded one-shot UMA metrics such as impressions. They are
257 // recorded once both the previous flags are true. 251 // recorded once both the previous flags are true.
258 bool recorded_uma_; 252 bool recorded_uma_;
259 253
260 std::unique_ptr< 254 std::unique_ptr<
261 suggestions::SuggestionsService::ResponseCallbackList::Subscription> 255 suggestions::SuggestionsService::ResponseCallbackList::Subscription>
262 suggestions_subscription_; 256 suggestions_subscription_;
263 257
264 ScopedObserver<history::TopSites, history::TopSitesObserver> scoped_observer_; 258 ScopedObserver<history::TopSites, history::TopSitesObserver> scoped_observer_;
265 259
266 MostVisitedSource mv_source_; 260 MostVisitedSource mv_source_;
267 261
268 std::unique_ptr<PopularSites> popular_sites_;
269
270 SuggestionsVector current_suggestions_; 262 SuggestionsVector current_suggestions_;
271 263
272 base::ThreadChecker thread_checker_; 264 base::ThreadChecker thread_checker_;
273 scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
274 scoped_refptr<base::TaskRunner> blocking_runner_; 265 scoped_refptr<base::TaskRunner> blocking_runner_;
275 266
276 // For callbacks may be run after destruction. 267 // For callbacks may be run after destruction.
277 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; 268 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_;
278 269
279 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); 270 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites);
280 }; 271 };
281 272
282 } // namespace ntp_tiles 273 } // namespace ntp_tiles
283 274
284 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ 275 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698