Chromium Code Reviews| 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> |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 | 27 |
| 28 namespace suggestions { | 28 namespace suggestions { |
| 29 class SuggestionsService; | 29 class SuggestionsService; |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace user_prefs { | 32 namespace user_prefs { |
| 33 class PrefRegistrySyncable; | 33 class PrefRegistrySyncable; |
| 34 } | 34 } |
| 35 | 35 |
| 36 class PopularSites; | 36 namespace variations { |
| 37 class Profile; | 37 class VariationsService; |
|
Marc Treib
2016/04/29 14:46:34
Profile one is actually still required for now.
sfiera
2016/04/29 14:50:54
Oh yeah, I guess we must be picking it up from SUS
| |
| 38 } | |
| 38 | 39 |
| 39 // Tracks the list of most visited sites and their thumbnails. | 40 // Tracks the list of most visited sites and their thumbnails. |
| 40 // | 41 // |
| 41 // Do not use, except from MostVisitedSitesBridge. The interface is in flux | 42 // Do not use, except from MostVisitedSitesBridge. The interface is in flux |
| 42 // while we are extracting the functionality of the Java class to make available | 43 // while we are extracting the functionality of the Java class to make available |
| 43 // in C++. | 44 // in C++. |
| 44 // | 45 // |
| 45 // TODO(sfiera): finalize interface. | 46 // TODO(sfiera): finalize interface. |
| 46 class MostVisitedSites : public history::TopSitesObserver, | 47 class MostVisitedSites : public history::TopSitesObserver, |
| 47 public SupervisedUserServiceObserver { | 48 public SupervisedUserServiceObserver { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 78 Suggestion(); | 79 Suggestion(); |
| 79 ~Suggestion(); | 80 ~Suggestion(); |
| 80 | 81 |
| 81 Suggestion(Suggestion&&); | 82 Suggestion(Suggestion&&); |
| 82 Suggestion& operator=(Suggestion&&); | 83 Suggestion& operator=(Suggestion&&); |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 DISALLOW_COPY_AND_ASSIGN(Suggestion); | 86 DISALLOW_COPY_AND_ASSIGN(Suggestion); |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 explicit MostVisitedSites(Profile* profile); | 89 explicit MostVisitedSites(Profile* profile, |
| 90 variations::VariationsService* variations_service); | |
|
Bernhard Bauer
2016/04/29 14:35:45
Oops, forgot: This doesn't need to be explicit any
sfiera
2016/04/29 14:50:54
Done.
| |
| 89 | 91 |
| 90 ~MostVisitedSites() override; | 92 ~MostVisitedSites() override; |
| 91 | 93 |
| 92 // Does not take ownership of |observer|, which must outlive this object. | 94 // Does not take ownership of |observer|, which must outlive this object. |
| 93 void SetMostVisitedURLsObserver( | 95 void SetMostVisitedURLsObserver( |
| 94 Observer* observer, int num_sites); | 96 Observer* observer, int num_sites); |
| 95 | 97 |
| 96 using ThumbnailCallback = base::Callback< | 98 using ThumbnailCallback = base::Callback< |
| 97 void(bool /* is_local_thumbnail */, const SkBitmap* /* bitmap */)>; | 99 void(bool /* is_local_thumbnail */, const SkBitmap* /* bitmap */)>; |
| 98 void GetURLThumbnail(const GURL& url, const ThumbnailCallback& callback); | 100 void GetURLThumbnail(const GURL& url, const ThumbnailCallback& callback); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 void RecordImpressionUMAMetrics(); | 207 void RecordImpressionUMAMetrics(); |
| 206 | 208 |
| 207 // history::TopSitesObserver implementation. | 209 // history::TopSitesObserver implementation. |
| 208 void TopSitesLoaded(history::TopSites* top_sites) override; | 210 void TopSitesLoaded(history::TopSites* top_sites) override; |
| 209 void TopSitesChanged(history::TopSites* top_sites, | 211 void TopSitesChanged(history::TopSites* top_sites, |
| 210 ChangeReason change_reason) override; | 212 ChangeReason change_reason) override; |
| 211 | 213 |
| 212 // The profile whose most visited sites will be queried. | 214 // The profile whose most visited sites will be queried. |
| 213 Profile* profile_; | 215 Profile* profile_; |
| 214 | 216 |
| 217 variations::VariationsService* variations_service_; | |
| 215 scoped_refptr<history::TopSites> top_sites_; | 218 scoped_refptr<history::TopSites> top_sites_; |
| 216 suggestions::SuggestionsService* suggestions_service_; | 219 suggestions::SuggestionsService* suggestions_service_; |
| 217 | 220 |
| 218 Observer* observer_; | 221 Observer* observer_; |
| 219 | 222 |
| 220 // The maximum number of most visited sites to return. | 223 // The maximum number of most visited sites to return. |
| 221 int num_sites_; | 224 int num_sites_; |
| 222 | 225 |
| 223 // Whether we have received an initial set of most visited sites (from either | 226 // Whether we have received an initial set of most visited sites (from either |
| 224 // TopSites or the SuggestionsService). | 227 // TopSites or the SuggestionsService). |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 244 | 247 |
| 245 SuggestionsVector current_suggestions_; | 248 SuggestionsVector current_suggestions_; |
| 246 | 249 |
| 247 // For callbacks may be run after destruction. | 250 // For callbacks may be run after destruction. |
| 248 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 251 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
| 249 | 252 |
| 250 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 253 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
| 251 }; | 254 }; |
| 252 | 255 |
| 253 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ | 256 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ |
| OLD | NEW |