Index: chrome/browser/android/ntp/most_visited_sites.h |
diff --git a/chrome/browser/android/ntp/most_visited_sites.h b/chrome/browser/android/ntp/most_visited_sites.h |
index 9e1d49cdba6d660c87ea78523678165b13c0bb8a..f76f99d720bb8f0c98c8225dcbac5ce192a6d44a 100644 |
--- a/chrome/browser/android/ntp/most_visited_sites.h |
+++ b/chrome/browser/android/ntp/most_visited_sites.h |
@@ -33,23 +33,9 @@ class PrefRegistrySyncable; |
} |
class PopularSites; |
+struct PopularSites_Site; |
class Profile; |
-// The observer to be notified when the list of most visited sites changes. |
-class MostVisitedSitesObserver { |
- public: |
- virtual ~MostVisitedSitesObserver() {} |
- |
- virtual void OnMostVisitedURLsAvailable( |
- const std::vector<base::string16>& titles, |
- const std::vector<std::string>& urls, |
- const std::vector<std::string>& whitelist_icon_paths) = 0; |
- virtual void OnPopularURLsAvailable( |
- const std::vector<std::string>& urls, |
- const std::vector<std::string>& favicon_urls, |
- const std::vector<std::string>& large_icon_urls) = 0; |
-}; |
- |
// Tracks the list of most visited sites and their thumbnails. |
// |
// Do not use, except from MostVisitedSitesBridge. The interface is in flux |
@@ -60,13 +46,19 @@ class MostVisitedSitesObserver { |
class MostVisitedSites : public history::TopSitesObserver, |
public SupervisedUserServiceObserver { |
public: |
+ class Observer; |
+ class Suggestion; |
Marc Treib
2016/04/25 13:58:38
Any reason for not defining these inline here? Sin
sfiera
2016/04/25 16:26:08
I find out-of-line easier, though some csearching
Marc Treib
2016/04/25 16:42:36
That's my impression as well, but I don't have num
sfiera
2016/04/26 09:18:17
My numbers say it's about 100:1 in favor of in-lin
Marc Treib
2016/04/26 09:57:55
Thanks for checking!
|
+ |
+ using SuggestionsVector = std::vector<std::unique_ptr<Suggestion>>; |
+ using PopularSiteVector = std::vector<PopularSites_Site>; |
Marc Treib
2016/04/25 13:58:38
Why is one of these a vector of pointers, the othe
sfiera
2016/04/25 16:26:08
These were the types that MostVisitedSites and Pop
Marc Treib
2016/04/25 16:42:36
Ah, I see.
Much of that merging/order-persisting c
sfiera
2016/04/26 09:18:17
Well, in that case, how about I go ahead and updat
Marc Treib
2016/04/26 09:37:28
Sure, SGTM.
I just wanted to avoid unnecessary wor
|
+ |
explicit MostVisitedSites(Profile* profile); |
~MostVisitedSites() override; |
// Does not take ownership of |observer|, which must outlive this object. |
void SetMostVisitedURLsObserver( |
- MostVisitedSitesObserver* observer, int num_sites); |
+ Observer* observer, int num_sites); |
using ThumbnailCallback = base::Callback< |
void(bool /* is_local_thumbnail */, const SkBitmap* /* bitmap */)>; |
@@ -86,29 +78,6 @@ class MostVisitedSites : public history::TopSitesObserver, |
// The source of the Most Visited sites. |
enum MostVisitedSource { TOP_SITES, SUGGESTIONS_SERVICE, POPULAR, WHITELIST }; |
- struct Suggestion { |
- base::string16 title; |
- GURL url; |
- MostVisitedSource source; |
- |
- // Only valid for source == WHITELIST (empty otherwise). |
- base::FilePath whitelist_icon_path; |
- |
- // Only valid for source == SUGGESTIONS_SERVICE (-1 otherwise). |
- int provider_index; |
- |
- Suggestion(); |
- ~Suggestion(); |
- |
- // Get the Histogram name associated with the source. |
- std::string GetSourceHistogramName() const; |
- |
- private: |
- DISALLOW_COPY_AND_ASSIGN(Suggestion); |
- }; |
- |
- using SuggestionsVector = std::vector<std::unique_ptr<Suggestion>>; |
- |
void QueryMostVisitedURLs(); |
// Initialize the query to Top Sites. Called if the SuggestionsService is not |
@@ -210,7 +179,7 @@ class MostVisitedSites : public history::TopSitesObserver, |
// The profile whose most visited sites will be queried. |
Profile* profile_; |
- MostVisitedSitesObserver* observer_; |
+ Observer* observer_; |
// The maximum number of most visited sites to return. |
int num_sites_; |
@@ -245,4 +214,36 @@ class MostVisitedSites : public history::TopSitesObserver, |
DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
}; |
+// The observer to be notified when the list of most visited sites changes. |
+class MostVisitedSites::Observer { |
+ public: |
+ virtual ~Observer() {} |
+ |
+ virtual void OnMostVisitedURLsAvailable( |
+ const SuggestionsVector& suggestions) = 0; |
+ virtual void OnPopularURLsAvailable(const PopularSiteVector& sites) = 0; |
+}; |
+ |
+class MostVisitedSites::Suggestion { |
+ public: |
Marc Treib
2016/04/25 13:58:38
If you want to keep the public member variables, t
sfiera
2016/04/25 16:26:08
Done.
|
+ base::string16 title; |
+ GURL url; |
+ MostVisitedSource source; |
+ |
+ // Only valid for source == WHITELIST (empty otherwise). |
+ base::FilePath whitelist_icon_path; |
+ |
+ // Only valid for source == SUGGESTIONS_SERVICE (-1 otherwise). |
+ int provider_index; |
+ |
+ Suggestion(); |
+ ~Suggestion(); |
+ |
+ // Get the Histogram name associated with the source. |
+ std::string GetSourceHistogramName() const; |
Marc Treib
2016/04/25 13:58:38
Since Suggestion is now part of the public interfa
sfiera
2016/04/26 09:18:17
I removed it from the header, since it no longer n
|
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(Suggestion); |
+}; |
+ |
#endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ |