Chromium Code Reviews| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 BuildRequestWithUILanguageOnly); | 162 BuildRequestWithUILanguageOnly); |
| 163 FRIEND_TEST_ALL_PREFIXES(NTPSnippetsFetcherTest, | 163 FRIEND_TEST_ALL_PREFIXES(NTPSnippetsFetcherTest, |
| 164 BuildRequestWithOtherLanguageOnly); | 164 BuildRequestWithOtherLanguageOnly); |
| 165 | 165 |
| 166 enum FetchAPI { | 166 enum FetchAPI { |
| 167 CHROME_READER_API, | 167 CHROME_READER_API, |
| 168 CHROME_CONTENT_SUGGESTIONS_API, | 168 CHROME_CONTENT_SUGGESTIONS_API, |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 struct RequestParams { | 171 struct RequestParams { |
| 172 FetchAPI fetch_api; | 172 FetchAPI fetch_api = CHROME_READER_API; |
| 173 std::string obfuscated_gaia_id; | 173 std::string obfuscated_gaia_id; |
| 174 bool only_return_personalized_results; | 174 bool only_return_personalized_results = false; |
| 175 std::string user_locale; | 175 std::string user_locale; |
| 176 std::set<std::string> host_restricts; | 176 std::set<std::string> host_restricts; |
| 177 std::set<std::string> excluded_ids; | 177 std::set<std::string> excluded_ids; |
| 178 int count_to_fetch; | 178 int count_to_fetch = 0; |
| 179 bool interactive_request; | 179 bool interactive_request = false; |
| 180 std::string user_class; | 180 std::string user_class; |
| 181 translate::LanguageModel::LanguageInfo ui_language; | 181 translate::LanguageModel::LanguageInfo ui_language = {std::string(), 0.0f}; |
|
Bernhard Bauer
2016/10/26 08:52:04
Hm. I'd be tempted to instead give LanguageInfo an
Marc Treib
2016/10/26 09:19:18
You're right of course - I was being lazy and not
| |
| 182 translate::LanguageModel::LanguageInfo other_top_language; | 182 translate::LanguageModel::LanguageInfo other_top_language = {std::string(), |
| 183 0.0f}; | |
|
Marc Treib
2016/10/26 08:23:54
All this isn't completely clang-tidy-mandated - it
| |
| 183 | 184 |
| 184 RequestParams(); | 185 RequestParams(); |
| 185 ~RequestParams(); | 186 ~RequestParams(); |
| 186 | 187 |
| 187 std::string BuildRequest(); | 188 std::string BuildRequest(); |
| 188 }; | 189 }; |
| 189 | 190 |
| 190 void FetchSnippetsImpl(const GURL& url, | 191 void FetchSnippetsImpl(const GURL& url, |
| 191 const std::string& auth_header, | 192 const std::string& auth_header, |
| 192 const std::string& request); | 193 const std::string& request); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 // When a token request gets canceled, we want to retry once. | 284 // When a token request gets canceled, we want to retry once. |
| 284 bool oauth_token_retried_; | 285 bool oauth_token_retried_; |
| 285 | 286 |
| 286 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; | 287 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; |
| 287 | 288 |
| 288 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); | 289 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); |
| 289 }; | 290 }; |
| 290 } // namespace ntp_snippets | 291 } // namespace ntp_snippets |
| 291 | 292 |
| 292 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ | 293 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ |
| OLD | NEW |