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

Side by Side Diff: chrome/browser/android/ntp/most_visited_sites.h

Issue 1934583002: PopularSites: don't wait for a SuggestionsService network request (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 Suggestion& operator=(Suggestion&&); 82 Suggestion& operator=(Suggestion&&);
83 83
84 private: 84 private:
85 DISALLOW_COPY_AND_ASSIGN(Suggestion); 85 DISALLOW_COPY_AND_ASSIGN(Suggestion);
86 }; 86 };
87 87
88 explicit MostVisitedSites(Profile* profile); 88 explicit MostVisitedSites(Profile* profile);
89 89
90 ~MostVisitedSites() override; 90 ~MostVisitedSites() override;
91 91
92 // Does not take ownership of |observer|, which must outlive this object. 92 // Does not take ownership of |observer|, which must outlive this object and
93 void SetMostVisitedURLsObserver( 93 // must not be null.
Bernhard Bauer 2016/04/29 14:15:31 From a general API POV, this seems a bit problemat
Marc Treib 2016/04/29 14:18:57 True, but I'm really just documenting the pre-exis
94 Observer* observer, int num_sites); 94 void SetMostVisitedURLsObserver(Observer* observer, int num_sites);
95 95
96 using ThumbnailCallback = base::Callback< 96 using ThumbnailCallback = base::Callback<
97 void(bool /* is_local_thumbnail */, const SkBitmap* /* bitmap */)>; 97 void(bool /* is_local_thumbnail */, const SkBitmap* /* bitmap */)>;
98 void GetURLThumbnail(const GURL& url, const ThumbnailCallback& callback); 98 void GetURLThumbnail(const GURL& url, const ThumbnailCallback& callback);
99 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); 99 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url);
100 void RecordTileTypeMetrics(const std::vector<int>& tile_types); 100 void RecordTileTypeMetrics(const std::vector<int>& tile_types);
101 void RecordOpenedMostVisitedItem(int index, int tile_type); 101 void RecordOpenedMostVisitedItem(int index, int tile_type);
102 102
103 // SupervisedUserServiceObserver implementation. 103 // SupervisedUserServiceObserver implementation.
104 void OnURLFilterChanged() override; 104 void OnURLFilterChanged() override;
105 105
106 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 106 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
107 107
108 private: 108 private:
109 friend class MostVisitedSitesTest; 109 friend class MostVisitedSitesTest;
110 110
111 // TODO(treib): use SuggestionsVector in internal functions. crbug.com/601734 111 // TODO(treib): use SuggestionsVector in internal functions. crbug.com/601734
112 using SuggestionsPtrVector = std::vector<std::unique_ptr<Suggestion>>; 112 using SuggestionsPtrVector = std::vector<std::unique_ptr<Suggestion>>;
113 113
114 void QueryMostVisitedURLs(); 114 void BuildCurrentSuggestions();
115 115
116 // Initialize the query to Top Sites. Called if the SuggestionsService is not 116 // Initialize the query to Top Sites. Called if the SuggestionsService is not
117 // enabled, or if it returns no data. 117 // enabled, or if it returns no data.
118 void InitiateTopSitesQuery(); 118 void InitiateTopSitesQuery();
119 119
120 // If there's a whitelist entry point for the URL, return the large icon path. 120 // If there's a whitelist entry point for the URL, return the large icon path.
121 base::FilePath GetWhitelistLargeIconPath(const GURL& url); 121 base::FilePath GetWhitelistLargeIconPath(const GURL& url);
122 122
123 // Callback for when data is available from TopSites. 123 // Callback for when data is available from TopSites.
124 void OnMostVisitedURLsAvailable( 124 void OnMostVisitedURLsAvailable(
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 SuggestionsVector current_suggestions_; 245 SuggestionsVector current_suggestions_;
246 246
247 // For callbacks may be run after destruction. 247 // For callbacks may be run after destruction.
248 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; 248 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_;
249 249
250 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); 250 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites);
251 }; 251 };
252 252
253 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_ 253 #endif // CHROME_BROWSER_ANDROID_NTP_MOST_VISITED_SITES_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/ntp/most_visited_sites.cc » ('j') | chrome/browser/android/ntp/most_visited_sites.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698