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 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 // features will be disabled. | 94 // features will be disabled. |
| 95 MostVisitedSites(PrefService* prefs, | 95 MostVisitedSites(PrefService* prefs, |
| 96 scoped_refptr<history::TopSites> top_sites, | 96 scoped_refptr<history::TopSites> top_sites, |
| 97 suggestions::SuggestionsService* suggestions, | 97 suggestions::SuggestionsService* suggestions, |
| 98 std::unique_ptr<PopularSites> popular_sites, | 98 std::unique_ptr<PopularSites> popular_sites, |
| 99 std::unique_ptr<IconCacher> icon_cacher, | 99 std::unique_ptr<IconCacher> icon_cacher, |
| 100 std::unique_ptr<MostVisitedSitesSupervisor> supervisor); | 100 std::unique_ptr<MostVisitedSitesSupervisor> supervisor); |
| 101 | 101 |
| 102 ~MostVisitedSites() override; | 102 ~MostVisitedSites() override; |
| 103 | 103 |
| 104 // Returns true if this object was created with a non-null provider for the | |
| 105 // given NTP tile source. That source may or may not actually provide tiles, | |
| 106 // depending on its configuration and the priority of different sources. | |
| 107 bool DoesSourceExist(NTPTileSource source) const; | |
| 108 | |
| 109 // Returns the corresponding object passed at construction. | |
| 110 history::TopSites* top_sites() const { return top_sites_.get(); } | |
| 111 suggestions::SuggestionsService* suggestions() const { | |
| 112 return suggestions_service_; | |
| 113 } | |
| 114 PopularSites* popular_sites() const { return popular_sites_.get(); } | |
| 115 MostVisitedSitesSupervisor* supervisor() const { return supervisor_.get(); } | |
|
Marc Treib
2016/12/14 15:06:26
If these return non-const pointers, then they shou
sfiera
2016/12/15 09:59:13
Made non-const (const would be nice, but Suggestio
| |
| 116 | |
| 104 // Sets the observer, and immediately fetches the current suggestions. | 117 // Sets the observer, and immediately fetches the current suggestions. |
| 105 // Does not take ownership of |observer|, which must outlive this object and | 118 // Does not take ownership of |observer|, which must outlive this object and |
| 106 // must not be null. | 119 // must not be null. |
| 107 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); | 120 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); |
| 108 | 121 |
| 109 // Requests an asynchronous refresh of the suggestions. Notifies the observer | 122 // Requests an asynchronous refresh of the suggestions. Notifies the observer |
| 110 // once the request completes. | 123 // once the request completes. |
| 111 void Refresh(); | 124 void Refresh(); |
| 112 | 125 |
| 113 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); | 126 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 | 210 |
| 198 // For callbacks may be run after destruction. | 211 // For callbacks may be run after destruction. |
| 199 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 212 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
| 200 | 213 |
| 201 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 214 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
| 202 }; | 215 }; |
| 203 | 216 |
| 204 } // namespace ntp_tiles | 217 } // namespace ntp_tiles |
| 205 | 218 |
| 206 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ | 219 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ |
| OLD | NEW |