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

Side by Side Diff: components/suggestions/suggestions_service.h

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/suggestions/image_manager.h ('k') | components/sync_driver/data_type_controller.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ 5 #ifndef COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_
6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ 6 #define COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // An interface to fetch server suggestions asynchronously. 50 // An interface to fetch server suggestions asynchronously.
51 class SuggestionsService : public KeyedService, public net::URLFetcherDelegate { 51 class SuggestionsService : public KeyedService, public net::URLFetcherDelegate {
52 public: 52 public:
53 typedef base::Callback<void(const SuggestionsProfile&)> ResponseCallback; 53 typedef base::Callback<void(const SuggestionsProfile&)> ResponseCallback;
54 54
55 SuggestionsService( 55 SuggestionsService(
56 net::URLRequestContextGetter* url_request_context, 56 net::URLRequestContextGetter* url_request_context,
57 scoped_ptr<SuggestionsStore> suggestions_store, 57 scoped_ptr<SuggestionsStore> suggestions_store,
58 scoped_ptr<ImageManager> thumbnail_manager, 58 scoped_ptr<ImageManager> thumbnail_manager,
59 scoped_ptr<BlacklistStore> blacklist_store); 59 scoped_ptr<BlacklistStore> blacklist_store);
60 virtual ~SuggestionsService(); 60 ~SuggestionsService() override;
61 61
62 // Whether this service is enabled. 62 // Whether this service is enabled.
63 static bool IsEnabled(); 63 static bool IsEnabled();
64 64
65 // Whether the user is part of a control group. 65 // Whether the user is part of a control group.
66 static bool IsControlGroup(); 66 static bool IsControlGroup();
67 67
68 // Request suggestions data, which will be passed to |callback|. |sync_state| 68 // Request suggestions data, which will be passed to |callback|. |sync_state|
69 // will influence the behavior of this function (see SyncState definition). 69 // will influence the behavior of this function (see SyncState definition).
70 // 70 //
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Creates a request to the suggestions service, properly setting headers. 117 // Creates a request to the suggestions service, properly setting headers.
118 net::URLFetcher* CreateSuggestionsRequest(const GURL& url); 118 net::URLFetcher* CreateSuggestionsRequest(const GURL& url);
119 119
120 // Called to service the requestors if the issued suggestions request has 120 // Called to service the requestors if the issued suggestions request has
121 // not completed in a given amount of time. 121 // not completed in a given amount of time.
122 virtual void OnRequestTimeout(); 122 virtual void OnRequestTimeout();
123 123
124 // net::URLFetcherDelegate implementation. 124 // net::URLFetcherDelegate implementation.
125 // Called when fetch request completes. Parses the received suggestions data, 125 // Called when fetch request completes. Parses the received suggestions data,
126 // and dispatches them to callbacks stored in queue. 126 // and dispatches them to callbacks stored in queue.
127 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; 127 void OnURLFetchComplete(const net::URLFetcher* source) override;
128 128
129 // KeyedService implementation. 129 // KeyedService implementation.
130 virtual void Shutdown() override; 130 void Shutdown() override;
131 131
132 // Load the cached suggestions and service the requestors with them. 132 // Load the cached suggestions and service the requestors with them.
133 void ServeFromCache(); 133 void ServeFromCache();
134 134
135 // Apply the local blacklist to |suggestions|, then serve the requestors. 135 // Apply the local blacklist to |suggestions|, then serve the requestors.
136 void FilterAndServe(SuggestionsProfile* suggestions); 136 void FilterAndServe(SuggestionsProfile* suggestions);
137 137
138 // Schedule a blacklisting request if the local blacklist isn't empty. 138 // Schedule a blacklisting request if the local blacklist isn't empty.
139 // |last_request_successful| is used for exponentially backing off when 139 // |last_request_successful| is used for exponentially backing off when
140 // requests fail. 140 // requests fail.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 // For callbacks may be run after destruction. 195 // For callbacks may be run after destruction.
196 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_; 196 base::WeakPtrFactory<SuggestionsService> weak_ptr_factory_;
197 197
198 DISALLOW_COPY_AND_ASSIGN(SuggestionsService); 198 DISALLOW_COPY_AND_ASSIGN(SuggestionsService);
199 }; 199 };
200 200
201 } // namespace suggestions 201 } // namespace suggestions
202 202
203 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_ 203 #endif // COMPONENTS_SUGGESTIONS_SUGGESTIONS_SERVICE_H_
OLDNEW
« no previous file with comments | « components/suggestions/image_manager.h ('k') | components/sync_driver/data_type_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698