Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: components/ntp_tiles/most_visited_sites.h

Issue 2790463003: ntp_tiles: Cleanup enum names (Closed)
Patch Set: add back histogram enums Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/ntp_tiles/metrics_unittest.cc ('k') | components/ntp_tiles/most_visited_sites.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/optional.h" 17 #include "base/optional.h"
18 #include "base/scoped_observer.h" 18 #include "base/scoped_observer.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "components/history/core/browser/history_types.h" 20 #include "components/history/core/browser/history_types.h"
21 #include "components/history/core/browser/top_sites_observer.h" 21 #include "components/history/core/browser/top_sites_observer.h"
22 #include "components/ntp_tiles/ntp_tile.h" 22 #include "components/ntp_tiles/ntp_tile.h"
23 #include "components/ntp_tiles/popular_sites.h" 23 #include "components/ntp_tiles/popular_sites.h"
24 #include "components/ntp_tiles/tile_source.h"
24 #include "components/suggestions/proto/suggestions.pb.h" 25 #include "components/suggestions/proto/suggestions.pb.h"
25 #include "components/suggestions/suggestions_service.h" 26 #include "components/suggestions/suggestions_service.h"
26 #include "url/gurl.h" 27 #include "url/gurl.h"
27 28
28 namespace history { 29 namespace history {
29 class TopSites; 30 class TopSites;
30 } 31 }
31 32
32 namespace user_prefs { 33 namespace user_prefs {
33 class PrefRegistrySyncable; 34 class PrefRegistrySyncable;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 suggestions::SuggestionsService* suggestions, 99 suggestions::SuggestionsService* suggestions,
99 std::unique_ptr<PopularSites> popular_sites, 100 std::unique_ptr<PopularSites> popular_sites,
100 std::unique_ptr<IconCacher> icon_cacher, 101 std::unique_ptr<IconCacher> icon_cacher,
101 std::unique_ptr<MostVisitedSitesSupervisor> supervisor); 102 std::unique_ptr<MostVisitedSitesSupervisor> supervisor);
102 103
103 ~MostVisitedSites() override; 104 ~MostVisitedSites() override;
104 105
105 // Returns true if this object was created with a non-null provider for the 106 // Returns true if this object was created with a non-null provider for the
106 // given NTP tile source. That source may or may not actually provide tiles, 107 // given NTP tile source. That source may or may not actually provide tiles,
107 // depending on its configuration and the priority of different sources. 108 // depending on its configuration and the priority of different sources.
108 bool DoesSourceExist(NTPTileSource source) const; 109 bool DoesSourceExist(TileSource source) const;
109 110
110 // Returns the corresponding object passed at construction. 111 // Returns the corresponding object passed at construction.
111 history::TopSites* top_sites() { return top_sites_.get(); } 112 history::TopSites* top_sites() { return top_sites_.get(); }
112 suggestions::SuggestionsService* suggestions() { 113 suggestions::SuggestionsService* suggestions() {
113 return suggestions_service_; 114 return suggestions_service_;
114 } 115 }
115 PopularSites* popular_sites() { return popular_sites_.get(); } 116 PopularSites* popular_sites() { return popular_sites_.get(); }
116 MostVisitedSitesSupervisor* supervisor() { return supervisor_.get(); } 117 MostVisitedSitesSupervisor* supervisor() { return supervisor_.get(); }
117 118
118 // Sets the observer, and immediately fetches the current suggestions. 119 // Sets the observer, and immediately fetches the current suggestions.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 int num_sites_; 200 int num_sites_;
200 201
201 std::unique_ptr< 202 std::unique_ptr<
202 suggestions::SuggestionsService::ResponseCallbackList::Subscription> 203 suggestions::SuggestionsService::ResponseCallbackList::Subscription>
203 suggestions_subscription_; 204 suggestions_subscription_;
204 205
205 ScopedObserver<history::TopSites, history::TopSitesObserver> 206 ScopedObserver<history::TopSites, history::TopSitesObserver>
206 top_sites_observer_; 207 top_sites_observer_;
207 208
208 // The main source of personal tiles - either TOP_SITES or SUGGESTIONS_SEVICE. 209 // The main source of personal tiles - either TOP_SITES or SUGGESTIONS_SEVICE.
209 NTPTileSource mv_source_; 210 TileSource mv_source_;
210 211
211 // Current set of tiles. Optional so that the observer can be notified 212 // Current set of tiles. Optional so that the observer can be notified
212 // whenever it changes, including possibily an initial change from 213 // whenever it changes, including possibily an initial change from
213 // !current_tiles_.has_value() to current_tiles_->empty(). 214 // !current_tiles_.has_value() to current_tiles_->empty().
214 base::Optional<NTPTilesVector> current_tiles_; 215 base::Optional<NTPTilesVector> current_tiles_;
215 216
216 // For callbacks may be run after destruction, used exclusively for TopSites 217 // For callbacks may be run after destruction, used exclusively for TopSites
217 // (since it's used to detect whether there's a query in flight). 218 // (since it's used to detect whether there's a query in flight).
218 base::WeakPtrFactory<MostVisitedSites> top_sites_weak_ptr_factory_; 219 base::WeakPtrFactory<MostVisitedSites> top_sites_weak_ptr_factory_;
219 220
220 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites); 221 DISALLOW_COPY_AND_ASSIGN(MostVisitedSites);
221 }; 222 };
222 223
223 } // namespace ntp_tiles 224 } // namespace ntp_tiles
224 225
225 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_ 226 #endif // COMPONENTS_NTP_TILES_MOST_VISITED_SITES_H_
OLDNEW
« no previous file with comments | « components/ntp_tiles/metrics_unittest.cc ('k') | components/ntp_tiles/most_visited_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698