| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ |
| 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 struct RequestParams { | 151 struct RequestParams { |
| 152 FetchAPI fetch_api; | 152 FetchAPI fetch_api; |
| 153 std::string obfuscated_gaia_id; | 153 std::string obfuscated_gaia_id; |
| 154 bool only_return_personalized_results; | 154 bool only_return_personalized_results; |
| 155 std::string user_locale; | 155 std::string user_locale; |
| 156 std::set<std::string> host_restricts; | 156 std::set<std::string> host_restricts; |
| 157 std::set<std::string> excluded_ids; | 157 std::set<std::string> excluded_ids; |
| 158 int count_to_fetch; | 158 int count_to_fetch; |
| 159 bool interactive_request; |
| 159 | 160 |
| 160 RequestParams(); | 161 RequestParams(); |
| 161 ~RequestParams(); | 162 ~RequestParams(); |
| 162 | 163 |
| 163 std::string BuildRequest(); | 164 std::string BuildRequest(); |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 void FetchSnippetsImpl(const GURL& url, | 167 void FetchSnippetsImpl(const GURL& url, |
| 167 const std::string& auth_header, | 168 const std::string& auth_header, |
| 168 const std::string& request); | 169 const std::string& request); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 SnippetsAvailableCallback snippets_available_callback_; | 232 SnippetsAvailableCallback snippets_available_callback_; |
| 232 | 233 |
| 233 // Flag for picking the right (stable/non-stable) API key for Chrome Reader. | 234 // Flag for picking the right (stable/non-stable) API key for Chrome Reader. |
| 234 bool is_stable_channel_; | 235 bool is_stable_channel_; |
| 235 | 236 |
| 236 // The variant of the fetching to use, loaded from variation parameters. | 237 // The variant of the fetching to use, loaded from variation parameters. |
| 237 Personalization personalization_; | 238 Personalization personalization_; |
| 238 // Should we apply host restriction? It is loaded from variation parameters. | 239 // Should we apply host restriction? It is loaded from variation parameters. |
| 239 bool use_host_restriction_; | 240 bool use_host_restriction_; |
| 240 | 241 |
| 242 // Is the request user initiated? |
| 243 bool interactive_request_; |
| 244 |
| 241 // Allow for an injectable tick clock for testing. | 245 // Allow for an injectable tick clock for testing. |
| 242 std::unique_ptr<base::TickClock> tick_clock_; | 246 std::unique_ptr<base::TickClock> tick_clock_; |
| 243 | 247 |
| 244 // Request throttler for limiting requests. | 248 // Request throttler for limiting requests. |
| 245 RequestThrottler request_throttler_; | 249 RequestThrottler request_throttler_; |
| 246 | 250 |
| 247 // When a token request gets canceled, we want to retry once. | 251 // When a token request gets canceled, we want to retry once. |
| 248 bool oauth_token_retried_; | 252 bool oauth_token_retried_; |
| 249 | 253 |
| 250 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; | 254 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; |
| 251 | 255 |
| 252 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); | 256 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); |
| 253 }; | 257 }; |
| 254 } // namespace ntp_snippets | 258 } // namespace ntp_snippets |
| 255 | 259 |
| 256 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ | 260 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ |
| OLD | NEW |