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

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

Issue 2548343002: NTPSnippets: Set MaxRetriesOn5xx only for interactive requests. (Closed)
Patch Set: Use TestURLFetcher instead of helper function. Rebased. Created 4 years 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_REMOTE_NTP_SNIPPETS_FETCHER_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_
6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ 6 #define COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <set> 10 #include <set>
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 RequestBuilder& SetPersonalization(Personalization personalization); 216 RequestBuilder& SetPersonalization(Personalization personalization);
217 // The tick_clock borrowed from the fetcher will be injected into the 217 // The tick_clock borrowed from the fetcher will be injected into the
218 // request. It will be used at build time and after the fetch returned. 218 // request. It will be used at build time and after the fetch returned.
219 // It has to be alive until the request is destroyed. 219 // It has to be alive until the request is destroyed.
220 RequestBuilder& SetTickClock(base::TickClock* tick_clock); 220 RequestBuilder& SetTickClock(base::TickClock* tick_clock);
221 RequestBuilder& SetUrl(const GURL& url); 221 RequestBuilder& SetUrl(const GURL& url);
222 RequestBuilder& SetUrlRequestContextGetter( 222 RequestBuilder& SetUrlRequestContextGetter(
223 const scoped_refptr<net::URLRequestContextGetter>& context_getter); 223 const scoped_refptr<net::URLRequestContextGetter>& context_getter);
224 RequestBuilder& SetUserClassifier(const UserClassifier& user_classifier); 224 RequestBuilder& SetUserClassifier(const UserClassifier& user_classifier);
225 225
226 // These preview methods allow to inspect the Request without exposing it
227 // publicly.
228 // TODO(fhorschig): Remove these when moving the RequestBuilder to
229 // snippets::internal and trigger the request to intercept the request.
226 std::string PreviewRequestBodyForTesting() { return BuildBody(); } 230 std::string PreviewRequestBodyForTesting() { return BuildBody(); }
227 std::string PreviewRequestHeadersForTesting() { return BuildHeaders(); } 231 std::string PreviewRequestHeadersForTesting() { return BuildHeaders(); }
228 RequestBuilder& SetUserClassForTesting(const std::string& user_class) { 232 RequestBuilder& SetUserClassForTesting(const std::string& user_class) {
229 user_class_ = user_class; 233 user_class_ = user_class;
230 return *this; 234 return *this;
231 } 235 }
232 236
233 protected: 237 protected:
234 // TODO(fhorschig): As soon as crbug.com/crbug.com/645447 is resolved, 238 // TODO(fhorschig): As soon as crbug.com/crbug.com/645447 is resolved,
235 // make these an implementation detail in the body and remove the mock. 239 // make these an implementation detail in the body and remove the mock.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 std::string last_status_; 361 std::string last_status_;
358 std::string last_fetch_json_; 362 std::string last_fetch_json_;
359 363
360 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; 364 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_;
361 365
362 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); 366 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher);
363 }; 367 };
364 } // namespace ntp_snippets 368 } // namespace ntp_snippets
365 369
366 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ 370 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698