OLD | NEW |
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
128 | 128 |
129 // KeyedService implementation. | 129 // KeyedService implementation. |
130 virtual void Shutdown() OVERRIDE; | 130 virtual 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 Loading... |
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_ |
OLD | NEW |