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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 }; | 112 }; |
113 | 113 |
114 // Construct a MostVisitedSites instance. | 114 // Construct a MostVisitedSites instance. |
115 // | 115 // |
116 // |prefs|, |top_sites|, and |suggestions| are required and may not be null. | 116 // |prefs|, |top_sites|, and |suggestions| are required and may not be null. |
117 // |popular_sites| and |supervisor| are optional and if null the associated | 117 // |popular_sites| and |supervisor| are optional and if null the associated |
118 // features will be disabled. | 118 // features will be disabled. |
119 MostVisitedSites(PrefService* prefs, | 119 MostVisitedSites(PrefService* prefs, |
120 scoped_refptr<history::TopSites> top_sites, | 120 scoped_refptr<history::TopSites> top_sites, |
121 suggestions::SuggestionsService* suggestions, | 121 suggestions::SuggestionsService* suggestions, |
122 PopularSites* popular_sites, | 122 std::unique_ptr<PopularSites> popular_sites, |
123 MostVisitedSitesSupervisor* supervisor); | 123 MostVisitedSitesSupervisor* supervisor); |
124 | 124 |
125 ~MostVisitedSites() override; | 125 ~MostVisitedSites() override; |
126 | 126 |
127 // Does not take ownership of |observer|, which must outlive this object and | 127 // Does not take ownership of |observer|, which must outlive this object and |
128 // must not be null. | 128 // must not be null. |
129 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); | 129 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); |
130 | 130 |
131 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); | 131 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); |
132 void RecordTileTypeMetrics(const std::vector<int>& tile_types, | 132 void RecordTileTypeMetrics(const std::vector<int>& tile_types, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void RecordImpressionUMAMetrics(); | 188 void RecordImpressionUMAMetrics(); |
189 | 189 |
190 // history::TopSitesObserver implementation. | 190 // history::TopSitesObserver implementation. |
191 void TopSitesLoaded(history::TopSites* top_sites) override; | 191 void TopSitesLoaded(history::TopSites* top_sites) override; |
192 void TopSitesChanged(history::TopSites* top_sites, | 192 void TopSitesChanged(history::TopSites* top_sites, |
193 ChangeReason change_reason) override; | 193 ChangeReason change_reason) override; |
194 | 194 |
195 PrefService* prefs_; | 195 PrefService* prefs_; |
196 scoped_refptr<history::TopSites> top_sites_; | 196 scoped_refptr<history::TopSites> top_sites_; |
197 suggestions::SuggestionsService* suggestions_service_; | 197 suggestions::SuggestionsService* suggestions_service_; |
198 PopularSites* const popular_sites_; | 198 std::unique_ptr<PopularSites> const popular_sites_; |
199 MostVisitedSitesSupervisor* supervisor_; | 199 MostVisitedSitesSupervisor* supervisor_; |
200 | 200 |
201 Observer* observer_; | 201 Observer* observer_; |
202 | 202 |
203 // The maximum number of most visited sites to return. | 203 // The maximum number of most visited sites to return. |
204 int num_sites_; | 204 int num_sites_; |
205 | 205 |
206 // True if we are still waiting for an initial set of most visited sites (from | 206 // True if we are still waiting for an initial set of most visited sites (from |
207 // either TopSites or the SuggestionsService). | 207 // either TopSites or the SuggestionsService). |
208 bool waiting_for_most_visited_sites_; | 208 bool waiting_for_most_visited_sites_; |
(...skipping 20 matching lines...) Expand all Loading... |
229 | 229 |
230 // For callbacks may be run after destruction. | 230 // For callbacks may be run after destruction. |
231 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 231 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
232 | 232 |
233 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 233 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
234 }; | 234 }; |
235 | 235 |
236 } // namespace ntp_tiles | 236 } // namespace ntp_tiles |
237 | 237 |
238 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ | 238 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ |
OLD | NEW |