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

Side by Side Diff: components/ntp_snippets/ntp_snippets_fetcher.h

Issue 2271283002: Add request type to FetchSuggestionsRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 4 years, 4 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
OLDNEW
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 CHROME_CONTENT_SUGGESTIONS_API, 140 CHROME_CONTENT_SUGGESTIONS_API,
141 }; 141 };
142 142
143 struct RequestParams { 143 struct RequestParams {
144 FetchAPI fetch_api; 144 FetchAPI fetch_api;
145 std::string obfuscated_gaia_id; 145 std::string obfuscated_gaia_id;
146 bool only_return_personalized_results; 146 bool only_return_personalized_results;
147 std::string user_locale; 147 std::string user_locale;
148 std::set<std::string> host_restricts; 148 std::set<std::string> host_restricts;
149 int count_to_fetch; 149 int count_to_fetch;
150 bool interactive_request;
150 151
151 RequestParams(); 152 RequestParams();
152 ~RequestParams(); 153 ~RequestParams();
153 154
154 std::string BuildRequest(); 155 std::string BuildRequest();
155 }; 156 };
156 157
157 void FetchSnippetsImpl(const GURL& url, 158 void FetchSnippetsImpl(const GURL& url,
158 const std::string& auth_header, 159 const std::string& auth_header,
159 const std::string& request); 160 const std::string& request);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 SnippetsAvailableCallback snippets_available_callback_; 220 SnippetsAvailableCallback snippets_available_callback_;
220 221
221 // Flag for picking the right (stable/non-stable) API key for Chrome Reader. 222 // Flag for picking the right (stable/non-stable) API key for Chrome Reader.
222 bool is_stable_channel_; 223 bool is_stable_channel_;
223 224
224 // The variant of the fetching to use, loaded from variation parameters. 225 // The variant of the fetching to use, loaded from variation parameters.
225 Personalization personalization_; 226 Personalization personalization_;
226 // Should we apply host restriction? It is loaded from variation parameters. 227 // Should we apply host restriction? It is loaded from variation parameters.
227 bool use_host_restriction_; 228 bool use_host_restriction_;
228 229
230 // Is the request user initiated?
231 bool interactive_request_;
232
229 // Allow for an injectable tick clock for testing. 233 // Allow for an injectable tick clock for testing.
230 std::unique_ptr<base::TickClock> tick_clock_; 234 std::unique_ptr<base::TickClock> tick_clock_;
231 235
232 // Request throttler for limiting requests. 236 // Request throttler for limiting requests.
233 RequestThrottler request_throttler_; 237 RequestThrottler request_throttler_;
234 238
235 // When a token request gets canceled, we want to retry once. 239 // When a token request gets canceled, we want to retry once.
236 bool oauth_token_retried_; 240 bool oauth_token_retried_;
237 241
238 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; 242 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_;
239 243
240 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); 244 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher);
241 }; 245 };
242 } // namespace ntp_snippets 246 } // namespace ntp_snippets
243 247
244 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ 248 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets/ntp_snippets_fetcher.cc » ('j') | components/ntp_snippets/ntp_snippets_fetcher.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698