| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 std::string PreviewRequestBodyForTesting() { return BuildBody(); } | 226 std::string PreviewRequestBodyForTesting() { return BuildBody(); } |
| 227 std::string PreviewRequestHeadersForTesting() { return BuildHeaders(); } | 227 std::string PreviewRequestHeadersForTesting() { return BuildHeaders(); } |
| 228 RequestBuilder& SetUserClassForTesting(const std::string& user_class) { | 228 RequestBuilder& SetUserClassForTesting(const std::string& user_class) { |
| 229 user_class_ = user_class; | 229 user_class_ = user_class; |
| 230 return *this; | 230 return *this; |
| 231 } | 231 } |
| 232 | 232 |
| 233 protected: | |
| 234 // 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. | |
| 236 virtual bool IsSendingTopLanguagesEnabled() const; | |
| 237 virtual bool IsSendingUserClassEnabled() const; | |
| 238 | |
| 239 private: | 233 private: |
| 240 std::string BuildHeaders() const; | 234 std::string BuildHeaders() const; |
| 241 std::string BuildBody() const; | 235 std::string BuildBody() const; |
| 242 std::unique_ptr<net::URLFetcher> BuildURLFetcher( | 236 std::unique_ptr<net::URLFetcher> BuildURLFetcher( |
| 243 net::URLFetcherDelegate* request, | 237 net::URLFetcherDelegate* request, |
| 244 const std::string& headers, | 238 const std::string& headers, |
| 245 const std::string& body) const; | 239 const std::string& body) const; |
| 246 | 240 |
| 247 bool ReturnOnlyPersonalizedResults() const { | 241 bool ReturnOnlyPersonalizedResults() const { |
| 248 return !obfuscated_gaia_id_.empty() && | 242 return !obfuscated_gaia_id_.empty() && |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 std::string last_status_; | 351 std::string last_status_; |
| 358 std::string last_fetch_json_; | 352 std::string last_fetch_json_; |
| 359 | 353 |
| 360 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; | 354 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; |
| 361 | 355 |
| 362 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); | 356 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); |
| 363 }; | 357 }; |
| 364 } // namespace ntp_snippets | 358 } // namespace ntp_snippets |
| 365 | 359 |
| 366 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ | 360 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ |
| OLD | NEW |