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

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

Issue 2568033005: [NTP::SectionOrder] Replace CategoryFactory with a category ranker. (Closed)
Patch Set: download provider tests. 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 // If set, only return results for this category. 132 // If set, only return results for this category.
133 base::Optional<Category> exclusive_category; 133 base::Optional<Category> exclusive_category;
134 }; 134 };
135 135
136 NTPSnippetsFetcher( 136 NTPSnippetsFetcher(
137 SigninManagerBase* signin_manager, 137 SigninManagerBase* signin_manager,
138 OAuth2TokenService* token_service, 138 OAuth2TokenService* token_service,
139 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, 139 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
140 PrefService* pref_service, 140 PrefService* pref_service,
141 CategoryFactory* category_factory,
142 translate::LanguageModel* language_model, 141 translate::LanguageModel* language_model,
143 const ParseJSONCallback& parse_json_callback, 142 const ParseJSONCallback& parse_json_callback,
144 const std::string& api_key, 143 const std::string& api_key,
145 const UserClassifier* user_classifier); 144 const UserClassifier* user_classifier);
146 ~NTPSnippetsFetcher() override; 145 ~NTPSnippetsFetcher() override;
147 146
148 // Initiates a fetch from the server. When done (successfully or not), calls 147 // Initiates a fetch from the server. When done (successfully or not), calls
149 // the subscriber of SetCallback(). 148 // the subscriber of SetCallback().
150 // 149 //
151 // If an ongoing fetch exists, it will be silently abandoned and a new one 150 // If an ongoing fetch exists, it will be silently abandoned and a new one
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 // When a token request gets canceled, we want to retry once. 320 // When a token request gets canceled, we want to retry once.
322 bool oauth_token_retried_ = false; 321 bool oauth_token_retried_ = false;
323 322
324 // Holds the URL request context. 323 // Holds the URL request context.
325 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 324 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
326 325
327 // Stores requests that wait for an access token. 326 // Stores requests that wait for an access token.
328 std::queue<std::pair<RequestBuilder, SnippetsAvailableCallback>> 327 std::queue<std::pair<RequestBuilder, SnippetsAvailableCallback>>
329 pending_requests_; 328 pending_requests_;
330 329
331 // Weak references, not owned. 330 // Weak reference, not owned.
332 CategoryFactory* const category_factory_;
333 translate::LanguageModel* const language_model_; 331 translate::LanguageModel* const language_model_;
334 332
335 const ParseJSONCallback parse_json_callback_; 333 const ParseJSONCallback parse_json_callback_;
336 334
337 // API endpoint for fetching snippets. 335 // API endpoint for fetching snippets.
338 const GURL fetch_url_; 336 const GURL fetch_url_;
339 // Which API to use 337 // Which API to use
340 const FetchAPI fetch_api_; 338 const FetchAPI fetch_api_;
341 339
342 // API key to use for non-authenticated requests. 340 // API key to use for non-authenticated requests.
(...skipping 17 matching lines...) Expand all
360 std::string last_status_; 358 std::string last_status_;
361 std::string last_fetch_json_; 359 std::string last_fetch_json_;
362 360
363 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; 361 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_;
364 362
365 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); 363 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher);
366 }; 364 };
367 } // namespace ntp_snippets 365 } // namespace ntp_snippets
368 366
369 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_ 367 #endif // COMPONENTS_NTP_SNIPPETS_REMOTE_NTP_SNIPPETS_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698