| 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_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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 RequestBuilder& SetPersonalization(Personalization personalization); | 217 RequestBuilder& SetPersonalization(Personalization personalization); |
| 218 // The tick_clock borrowed from the fetcher will be injected into the | 218 // The tick_clock borrowed from the fetcher will be injected into the |
| 219 // request. It will be used at build time and after the fetch returned. | 219 // request. It will be used at build time and after the fetch returned. |
| 220 // It has to be alive until the request is destroyed. | 220 // It has to be alive until the request is destroyed. |
| 221 RequestBuilder& SetTickClock(base::TickClock* tick_clock); | 221 RequestBuilder& SetTickClock(base::TickClock* tick_clock); |
| 222 RequestBuilder& SetUrl(const GURL& url); | 222 RequestBuilder& SetUrl(const GURL& url); |
| 223 RequestBuilder& SetUrlRequestContextGetter( | 223 RequestBuilder& SetUrlRequestContextGetter( |
| 224 const scoped_refptr<net::URLRequestContextGetter>& context_getter); | 224 const scoped_refptr<net::URLRequestContextGetter>& context_getter); |
| 225 RequestBuilder& SetUserClassifier(const UserClassifier& user_classifier); | 225 RequestBuilder& SetUserClassifier(const UserClassifier& user_classifier); |
| 226 | 226 |
| 227 // These preview methods allow to inspect the Request without exposing it |
| 228 // publicly. |
| 229 // TODO(fhorschig): Remove these when moving the RequestBuilder to |
| 230 // snippets::internal and trigger the request to intercept the request. |
| 227 std::string PreviewRequestBodyForTesting() { return BuildBody(); } | 231 std::string PreviewRequestBodyForTesting() { return BuildBody(); } |
| 228 std::string PreviewRequestHeadersForTesting() { return BuildHeaders(); } | 232 std::string PreviewRequestHeadersForTesting() { return BuildHeaders(); } |
| 229 RequestBuilder& SetUserClassForTesting(const std::string& user_class) { | 233 RequestBuilder& SetUserClassForTesting(const std::string& user_class) { |
| 230 user_class_ = user_class; | 234 user_class_ = user_class; |
| 231 return *this; | 235 return *this; |
| 232 } | 236 } |
| 233 | 237 |
| 234 protected: | 238 protected: |
| 235 // TODO(fhorschig): As soon as crbug.com/crbug.com/645447 is resolved, | 239 // TODO(fhorschig): As soon as crbug.com/crbug.com/645447 is resolved, |
| 236 // make these an implementation detail in the body and remove the mock. | 240 // make these an implementation detail in the body and remove the mock. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 std::string last_status_; | 362 std::string last_status_; |
| 359 std::string last_fetch_json_; | 363 std::string last_fetch_json_; |
| 360 | 364 |
| 361 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; | 365 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; |
| 362 | 366 |
| 363 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); | 367 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); |
| 364 }; | 368 }; |
| 365 } // namespace ntp_snippets | 369 } // namespace ntp_snippets |
| 366 | 370 |
| 367 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ | 371 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ |
| OLD | NEW |