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

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

Issue 2227973002: Add request throttler to thumbnail fetching for articles on mobile NTP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marc's comments Created 4 years, 4 months 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_NTP_SNIPPETS_FETCHER_H_ 5 #ifndef COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_
6 #define COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ 6 #define COMPONENTS_NTP_SNIPPETS_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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 void SetCallback(const SnippetsAvailableCallback& callback); 89 void SetCallback(const SnippetsAvailableCallback& callback);
90 90
91 // Fetches snippets from the server. |hosts| restricts the results to a set of 91 // Fetches snippets from the server. |hosts| restricts the results to a set of
92 // hosts, e.g. "www.google.com". An empty host set produces an error. 92 // hosts, e.g. "www.google.com". An empty host set produces an error.
93 // 93 //
94 // If an ongoing fetch exists, it will be cancelled and a new one started, 94 // If an ongoing fetch exists, it will be cancelled and a new one started,
95 // without triggering an additional callback (i.e. not noticeable by 95 // without triggering an additional callback (i.e. not noticeable by
96 // subscriber of SetCallback()). 96 // subscriber of SetCallback()).
97 // 97 //
98 // Fetches snippets only if the daily quota not exceeded, unless 98 // Fetches snippets only if the daily quota not exceeded, unless
99 // |force_request| is set to true. Use force only for user-initiated fetches. 99 // |interactive_request| is set to true (use only for user-initiated fetches).
100 void FetchSnippetsFromHosts(const std::set<std::string>& hosts, 100 void FetchSnippetsFromHosts(const std::set<std::string>& hosts,
101 const std::string& language_code, 101 const std::string& language_code,
102 int count, 102 int count,
103 bool force_request); 103 bool interactive_request);
104 104
105 // Debug string representing the status/result of the last fetch attempt. 105 // Debug string representing the status/result of the last fetch attempt.
106 const std::string& last_status() const { return last_status_; } 106 const std::string& last_status() const { return last_status_; }
107 107
108 // Returns the last JSON fetched from the server. 108 // Returns the last JSON fetched from the server.
109 const std::string& last_json() const { 109 const std::string& last_json() const {
110 return last_fetch_json_; 110 return last_fetch_json_;
111 } 111 }
112 112
113 // Returns the personalization setting of the fetcher. 113 // Returns the personalization setting of the fetcher.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Request throttler for limiting requests. 230 // Request throttler for limiting requests.
231 RequestThrottler request_throttler_; 231 RequestThrottler request_throttler_;
232 232
233 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_; 233 base::WeakPtrFactory<NTPSnippetsFetcher> weak_ptr_factory_;
234 234
235 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); 235 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher);
236 }; 236 };
237 } // namespace ntp_snippets 237 } // namespace ntp_snippets
238 238
239 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ 239 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_
OLDNEW
« no previous file with comments | « no previous file | components/ntp_snippets/ntp_snippets_fetcher.cc » ('j') | components/ntp_snippets/ntp_snippets_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698