| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 struct Suggestion { | 138 struct Suggestion { |
| 139 base::string16 title; | 139 base::string16 title; |
| 140 GURL url; | 140 GURL url; |
| 141 MostVisitedSource source; | 141 MostVisitedSource source; |
| 142 | 142 |
| 143 // Only valid for source == WHITELIST (empty otherwise). | 143 // Only valid for source == WHITELIST (empty otherwise). |
| 144 base::FilePath whitelist_icon_path; | 144 base::FilePath whitelist_icon_path; |
| 145 | 145 |
| 146 // Only valid for source == SUGGESTIONS_SERVICE (-1 otherwise). | |
| 147 int provider_index; | |
| 148 | |
| 149 Suggestion(); | 146 Suggestion(); |
| 150 ~Suggestion(); | 147 ~Suggestion(); |
| 151 | 148 |
| 152 Suggestion(Suggestion&&); | 149 Suggestion(Suggestion&&); |
| 153 Suggestion& operator=(Suggestion&&); | 150 Suggestion& operator=(Suggestion&&); |
| 154 | 151 |
| 155 private: | 152 private: |
| 156 DISALLOW_COPY_AND_ASSIGN(Suggestion); | 153 DISALLOW_COPY_AND_ASSIGN(Suggestion); |
| 157 }; | 154 }; |
| 158 | 155 |
| 159 MostVisitedSites(scoped_refptr<base::SequencedWorkerPool> blocking_pool, | 156 MostVisitedSites(scoped_refptr<base::SequencedWorkerPool> blocking_pool, |
| 160 PrefService* prefs, | 157 PrefService* prefs, |
| 161 const TemplateURLService* template_url_service, | 158 const TemplateURLService* template_url_service, |
| 162 variations::VariationsService* variations_service, | 159 variations::VariationsService* variations_service, |
| 163 net::URLRequestContextGetter* download_context, | 160 net::URLRequestContextGetter* download_context, |
| 164 const base::FilePath& popular_sites_directory, | 161 const base::FilePath& popular_sites_directory, |
| 165 scoped_refptr<history::TopSites> top_sites, | 162 scoped_refptr<history::TopSites> top_sites, |
| 166 suggestions::SuggestionsService* suggestions, | 163 suggestions::SuggestionsService* suggestions, |
| 167 MostVisitedSitesSupervisor* supervisor); | 164 MostVisitedSitesSupervisor* supervisor); |
| 168 | 165 |
| 169 ~MostVisitedSites() override; | 166 ~MostVisitedSites() override; |
| 170 | 167 |
| 171 // Does not take ownership of |observer|, which must outlive this object and | 168 // Does not take ownership of |observer|, which must outlive this object and |
| 172 // must not be null. | 169 // must not be null. |
| 173 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); | 170 void SetMostVisitedURLsObserver(Observer* observer, int num_sites); |
| 174 | 171 |
| 175 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); | 172 void AddOrRemoveBlacklistedUrl(const GURL& url, bool add_url); |
| 176 void RecordTileTypeMetrics(const std::vector<int>& tile_types, | 173 void RecordTileTypeMetrics(const std::vector<int>& tile_types, |
| 177 const std::vector<int>& sources, | 174 const std::vector<int>& sources); |
| 178 const std::vector<int>& provider_indices); | |
| 179 void RecordOpenedMostVisitedItem(int index, int tile_type); | 175 void RecordOpenedMostVisitedItem(int index, int tile_type); |
| 180 | 176 |
| 181 // MostVisitedSitesSupervisor::Observer implementation. | 177 // MostVisitedSitesSupervisor::Observer implementation. |
| 182 void OnBlockedSitesChanged() override; | 178 void OnBlockedSitesChanged() override; |
| 183 | 179 |
| 184 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 180 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 185 | 181 |
| 186 private: | 182 private: |
| 187 friend class MostVisitedSitesTest; | 183 friend class MostVisitedSitesTest; |
| 188 | 184 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 284 |
| 289 // For callbacks may be run after destruction. | 285 // For callbacks may be run after destruction. |
| 290 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; | 286 base::WeakPtrFactory<MostVisitedSites> weak_ptr_factory_; |
| 291 | 287 |
| 292 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); | 288 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); |
| 293 }; | 289 }; |
| 294 | 290 |
| 295 } // namespace ntp_tiles | 291 } // namespace ntp_tiles |
| 296 | 292 |
| 297 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ | 293 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ |
| OLD | NEW |