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 #ifndef CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ |
6 #define CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ | 6 #define CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/scoped_observer.h" | 18 #include "base/scoped_observer.h" |
19 #include "chrome/browser/android/ntp/popular_sites.h" | 19 #include "chrome/browser/android/ntp/popular_sites.h" |
20 #include "chrome/browser/supervised_user/supervised_user_service.h" | 20 #include "chrome/browser/supervised_user/supervised_user_service.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 "components/history/core/browser/history_types.h" | 22 #include "components/history/core/browser/history_types.h" |
23 #include "components/history/core/browser/top_sites_observer.h" | 23 #include "components/history/core/browser/top_sites_observer.h" |
24 #include "components/suggestions/proto/suggestions.pb.h" | 24 #include "components/suggestions/proto/suggestions.pb.h" |
25 #include "components/suggestions/suggestions_service.h" | 25 #include "components/suggestions/suggestions_service.h" |
26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
27 | 27 |
28 namespace history { | |
29 class TopSites; | |
30 } | |
31 | |
28 namespace suggestions { | 32 namespace suggestions { |
29 class SuggestionsService; | 33 class SuggestionsService; |
30 } | 34 } |
31 | 35 |
32 namespace user_prefs { | 36 namespace user_prefs { |
33 class PrefRegistrySyncable; | 37 class PrefRegistrySyncable; |
34 } | 38 } |
35 | 39 |
36 namespace variations { | 40 namespace variations { |
37 class VariationsService; | 41 class VariationsService; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 Suggestion(); | 83 Suggestion(); |
80 ~Suggestion(); | 84 ~Suggestion(); |
81 | 85 |
82 Suggestion(Suggestion&&); | 86 Suggestion(Suggestion&&); |
83 Suggestion& operator=(Suggestion&&); | 87 Suggestion& operator=(Suggestion&&); |
84 | 88 |
85 private: | 89 private: |
86 DISALLOW_COPY_AND_ASSIGN(Suggestion); | 90 DISALLOW_COPY_AND_ASSIGN(Suggestion); |
87 }; | 91 }; |
88 | 92 |
89 MostVisitedSites(Profile* profile, | 93 MostVisitedSites(PrefService* prefs, |
90 variations::VariationsService* variations_service); | 94 const TemplateURLService* template_url_service, |
95 variations::VariationsService* variations_service, | |
96 net::URLRequestContextGetter* download_context, | |
97 scoped_refptr<history::TopSites> top_sites, | |
98 suggestions::SuggestionsService* suggestions, | |
99 bool is_child, | |
Marc Treib
2016/05/02 11:30:40
profile_is_child, or is_child_account, or somethin
sfiera
2016/05/03 13:26:12
Done.
| |
100 Profile* profile); | |
91 | 101 |
92 ~MostVisitedSites() override; | 102 ~MostVisitedSites() override; |
93 | 103 |
94 // Does not take ownership of |observer|, which must outlive this object and | 104 // Does not take ownership of |observer|, which must outlive this object and |
95 // must not be null. | 105 // must not be null. |
96 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); | 106 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); |
97 | 107 |
98 using ThumbnailCallback = base::Callback< | 108 using ThumbnailCallback = base::Callback< |
99 void(bool /* is_local_thumbnail */, const SkBitmap* /* bitmap */)>; | 109 void(bool /* is_local_thumbnail */, const SkBitmap* /* bitmap */)>; |
100 void GetURLThumbnail(const GURL& url, const ThumbnailCallback& callback); | 110 void GetURLThumbnail(const GURL& url, const ThumbnailCallback& callback); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 void RecordImpressionUMAMetrics(); | 217 void RecordImpressionUMAMetrics(); |
208 | 218 |
209 // history::TopSitesObserver implementation. | 219 // history::TopSitesObserver implementation. |
210 void TopSitesLoaded(history::TopSites* top_sites) override; | 220 void TopSitesLoaded(history::TopSites* top_sites) override; |
211 void TopSitesChanged(history::TopSites* top_sites, | 221 void TopSitesChanged(history::TopSites* top_sites, |
212 ChangeReason change_reason) override; | 222 ChangeReason change_reason) override; |
213 | 223 |
214 // The profile whose most visited sites will be queried. | 224 // The profile whose most visited sites will be queried. |
215 Profile* profile_; | 225 Profile* profile_; |
216 | 226 |
227 PrefService* prefs_; | |
228 const TemplateURLService* template_url_service_; | |
217 variations::VariationsService* variations_service_; | 229 variations::VariationsService* variations_service_; |
230 net::URLRequestContextGetter* download_context_; | |
218 scoped_refptr<history::TopSites> top_sites_; | 231 scoped_refptr<history::TopSites> top_sites_; |
219 suggestions::SuggestionsService* suggestions_service_; | 232 suggestions::SuggestionsService* suggestions_service_; |
233 bool is_child_; | |
220 | 234 |
221 Observer* observer_; | 235 Observer* observer_; |
222 | 236 |
223 // The maximum number of most visited sites to return. | 237 // The maximum number of most visited sites to return. |
224 int num_sites_; | 238 int num_sites_; |
225 | 239 |
226 // Whether we have received an initial set of most visited sites (from either | 240 // Whether we have received an initial set of most visited sites (from either |
227 // TopSites or the SuggestionsService). | 241 // TopSites or the SuggestionsService). |
228 bool received_most_visited_sites_; | 242 bool received_most_visited_sites_; |
229 | 243 |
(...skipping 17 matching lines...) Expand all Loading... | |
247 | 261 |
248 SuggestionsVector current_suggestions_; | 262 SuggestionsVector current_suggestions_; |
249 | 263 |
250 // For callbacks may be run after destruction. | 264 // For callbacks may be run after destruction. |
251 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 265 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
252 | 266 |
253 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 267 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
254 }; | 268 }; |
255 | 269 |
256 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ | 270 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ |
OLD | NEW |