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 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // features will be disabled. | 95 // features will be disabled. |
96 MostVisitedSites(PrefService* prefs, | 96 MostVisitedSites(PrefService* prefs, |
97 scoped_refptr<history::TopSites> top_sites, | 97 scoped_refptr<history::TopSites> top_sites, |
98 suggestions::SuggestionsService* suggestions, | 98 suggestions::SuggestionsService* suggestions, |
99 std::unique_ptr<PopularSites> popular_sites, | 99 std::unique_ptr<PopularSites> popular_sites, |
100 std::unique_ptr<IconCacher> icon_cacher, | 100 std::unique_ptr<IconCacher> icon_cacher, |
101 MostVisitedSitesSupervisor* supervisor); | 101 MostVisitedSitesSupervisor* supervisor); |
102 | 102 |
103 ~MostVisitedSites() override; | 103 ~MostVisitedSites() override; |
104 | 104 |
| 105 // Sets the observer, and immediately fetches the current suggestions. |
105 // Does not take ownership of |observer|, which must outlive this object and | 106 // Does not take ownership of |observer|, which must outlive this object and |
106 // must not be null. | 107 // must not be null. |
107 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); | 108 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); |
108 | 109 |
| 110 // Requests an asynchronous refresh of the suggestions. Notifies the observer |
| 111 // once the request completes. |
| 112 void Refresh(); |
| 113 |
109 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); | 114 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); |
| 115 void ClearBlacklistedUrls(); |
110 | 116 |
111 // MostVisitedSitesSupervisor::Observer implementation. | 117 // MostVisitedSitesSupervisor::Observer implementation. |
112 void OnBlockedSitesChanged() override; | 118 void OnBlockedSitesChanged() override; |
113 | 119 |
114 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 120 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
115 | 121 |
116 private: | 122 private: |
117 friend class MostVisitedSitesTest; | 123 friend class MostVisitedSitesTest; |
118 | 124 |
119 void BuildCurrentTiles(); | 125 void BuildCurrentTiles(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 198 |
193 // For callbacks may be run after destruction. | 199 // For callbacks may be run after destruction. |
194 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 200 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
195 | 201 |
196 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 202 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
197 }; | 203 }; |
198 | 204 |
199 } // namespace ntp_tiles | 205 } // namespace ntp_tiles |
200 | 206 |
201 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ | 207 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ |
OLD | NEW |