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