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

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

Issue 1940843002: [NTP Snippets] Add unit tests for NTPSnippetsFetcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed build for linux_chromium_chromeos_compile_dbg_ng Created 4 years, 7 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
« no previous file with comments | « components/ntp_snippets/BUILD.gn ('k') | components/ntp_snippets/ntp_snippets_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 24 matching lines...) Expand all
35 bool is_stable_channel); 35 bool is_stable_channel);
36 ~NTPSnippetsFetcher() override; 36 ~NTPSnippetsFetcher() override;
37 37
38 // Adds a callback that is called when a new set of snippets are downloaded. 38 // Adds a callback that is called when a new set of snippets are downloaded.
39 std::unique_ptr<SnippetsAvailableCallbackList::Subscription> AddCallback( 39 std::unique_ptr<SnippetsAvailableCallbackList::Subscription> AddCallback(
40 const SnippetsAvailableCallback& callback) WARN_UNUSED_RESULT; 40 const SnippetsAvailableCallback& callback) WARN_UNUSED_RESULT;
41 41
42 // Fetches snippets from the server. |hosts| can be used to restrict the 42 // Fetches snippets from the server. |hosts| can be used to restrict the
43 // results to a set of hosts, e.g. "www.google.com". If it is empty, no 43 // results to a set of hosts, e.g. "www.google.com". If it is empty, no
44 // restrictions are applied. 44 // restrictions are applied.
45 //
46 // If an ongoing fetch exists, it will be cancelled and a new one started,
47 // without triggering additional callbacks (i.e. not noticeable by
48 // subscribers).
45 void FetchSnippets(const std::set<std::string>& hosts, int count); 49 void FetchSnippets(const std::set<std::string>& hosts, int count);
46 50
47 private: 51 private:
48 // URLFetcherDelegate implementation. 52 // URLFetcherDelegate implementation.
49 void OnURLFetchComplete(const net::URLFetcher* source) override; 53 void OnURLFetchComplete(const net::URLFetcher* source) override;
50 54
51 // The SequencedTaskRunner on which file system operations will be run. 55 // The SequencedTaskRunner on which file system operations will be run.
52 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 56 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
53 57
54 // Holds the URL request context. 58 // Holds the URL request context.
55 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 59 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
56 60
57 // The fetcher for downloading the snippets. 61 // The fetcher for downloading the snippets.
58 std::unique_ptr<net::URLFetcher> url_fetcher_; 62 std::unique_ptr<net::URLFetcher> url_fetcher_;
59 63
60 // The callbacks to notify when new snippets get fetched. 64 // The callbacks to notify when new snippets get fetched.
61 SnippetsAvailableCallbackList callback_list_; 65 SnippetsAvailableCallbackList callback_list_;
62 66
63 // Flag for picking the right (stable/non-stable) API key for Chrome Reader 67 // Flag for picking the right (stable/non-stable) API key for Chrome Reader
64 bool is_stable_channel_; 68 bool is_stable_channel_;
65 69
66 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); 70 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher);
67 }; 71 };
68 } // namespace ntp_snippets 72 } // namespace ntp_snippets
69 73
70 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ 74 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_
OLDNEW
« no previous file with comments | « components/ntp_snippets/BUILD.gn ('k') | components/ntp_snippets/ntp_snippets_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698