| 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() { return top_sites_.get(); } |
| 111 suggestions::SuggestionsService* suggestions() { |
| 112 return suggestions_service_; |
| 113 } |
| 114 PopularSites* popular_sites() { return popular_sites_.get(); } |
| 115 MostVisitedSitesSupervisor* supervisor() { return supervisor_.get(); } |
| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // For callbacks may be run after destruction, used exclusively for TopSites | 215 // For callbacks may be run after destruction, used exclusively for TopSites |
| 203 // (since it's used to detect whether there's a query in flight). | 216 // (since it's used to detect whether there's a query in flight). |
| 204 base::WeakPtrFactory<MostVisitedSites> top_sites_weak_ptr_factory_; | 217 base::WeakPtrFactory<MostVisitedSites> top_sites_weak_ptr_factory_; |
| 205 | 218 |
| 206 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 219 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
| 207 }; | 220 }; |
| 208 | 221 |
| 209 } // namespace ntp_tiles | 222 } // namespace ntp_tiles |
| 210 | 223 |
| 211 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ | 224 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ |
| OLD | NEW |