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

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 #if defined(OS_ANDROID) 161 #if defined(OS_ANDROID)
165 static bool Register(JNIEnv* env); 162 static bool Register(JNIEnv* env);
166 #endif 163 #endif
167 164
168 // Does not take ownership of |observer|, which must outlive this object and 165 // Does not take ownership of |observer|, which must outlive this object and
169 // must not be null. 166 // must not be null.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 226
230 // Records UMA histogram metrics related to the number of impressions. 227 // Records UMA histogram metrics related to the number of impressions.
231 void RecordImpressionUMAMetrics(); 228 void RecordImpressionUMAMetrics();
232 229
233 // history::TopSitesObserver implementation. 230 // history::TopSitesObserver implementation.
234 void TopSitesLoaded(history::TopSites* top_sites) override; 231 void TopSitesLoaded(history::TopSites* top_sites) override;
235 void TopSitesChanged(history::TopSites* top_sites, 232 void TopSitesChanged(history::TopSites* top_sites,
236 ChangeReason change_reason) override; 233 ChangeReason change_reason) override;
237 234
238 PrefService* prefs_; 235 PrefService* prefs_;
239 const TemplateURLService* template_url_service_;
240 variations::VariationsService* variations_service_;
241 net::URLRequestContextGetter* download_context_;
242 base::FilePath popular_sites_directory_;
243 scoped_refptr<history::TopSites> top_sites_; 236 scoped_refptr<history::TopSites> top_sites_;
244 suggestions::SuggestionsService* suggestions_service_; 237 suggestions::SuggestionsService* suggestions_service_;
238 PopularSites* const popular_sites_;
245 MostVisitedSitesSupervisor* supervisor_; 239 MostVisitedSitesSupervisor* supervisor_;
246 240
247 Observer* observer_; 241 Observer* observer_;
248 242
249 // The maximum number of most visited sites to return. 243 // The maximum number of most visited sites to return.
250 int num_sites_; 244 int num_sites_;
251 245
252 // Whether we have received an initial set of most visited sites (from either 246 // Whether we have received an initial set of most visited sites (from either
253 // TopSites or the SuggestionsService). 247 // TopSites or the SuggestionsService).
254 bool received_most_visited_sites_; 248 bool received_most_visited_sites_;
255 249
256 // Whether we have received the set of popular sites. Immediately set to true 250 // Whether we have received the set of popular sites. Immediately set to true
257 // if popular sites are disabled. 251 // if popular sites are disabled.
258 bool received_popular_sites_; 252 bool received_popular_sites_;
259 253
260 // Whether we have recorded one-shot UMA metrics such as impressions. They are 254 // Whether we have recorded one-shot UMA metrics such as impressions. They are
261 // recorded once both the previous flags are true. 255 // recorded once both the previous flags are true.
262 bool recorded_uma_; 256 bool recorded_uma_;
263 257
264 std::unique_ptr< 258 std::unique_ptr<
265 suggestions::SuggestionsService::ResponseCallbackList::Subscription> 259 suggestions::SuggestionsService::ResponseCallbackList::Subscription>
266 suggestions_subscription_; 260 suggestions_subscription_;
267 261
268 ScopedObserver<history::TopSites, history::TopSitesObserver> scoped_observer_; 262 ScopedObserver<history::TopSites, history::TopSitesObserver> scoped_observer_;
269 263
270 MostVisitedSource mv_source_; 264 MostVisitedSource mv_source_;
271 265
272 std::unique_ptr<PopularSites> popular_sites_;
273
274 SuggestionsVector current_suggestions_; 266 SuggestionsVector current_suggestions_;
275 267
276 base::ThreadChecker thread_checker_; 268 base::ThreadChecker thread_checker_;
277 scoped_refptr<base::SequencedWorkerPool> blocking_pool_;
278 scoped_refptr<base::TaskRunner> blocking_runner_; 269 scoped_refptr<base::TaskRunner> blocking_runner_;
279 270
280 // For callbacks may be run after destruction. 271 // For callbacks may be run after destruction.
281 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; 272 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_;
282 273
283 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); 274 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites);
284 }; 275 };
285 276
286 } // namespace ntp_tiles 277 } // namespace ntp_tiles
287 278
288 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ 279 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/popular_sites_internals_message_handler.cc ('k') | components/ntp_tiles/most_visited_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698