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

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

Issue 1942913002: Revert of [NTP Snippets] Add unit tests for NTPSnippetsFetcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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).
49 void FetchSnippets(const std::set<std::string>& hosts, int count); 45 void FetchSnippets(const std::set<std::string>& hosts, int count);
50 46
51 private: 47 private:
52 // URLFetcherDelegate implementation. 48 // URLFetcherDelegate implementation.
53 void OnURLFetchComplete(const net::URLFetcher* source) override; 49 void OnURLFetchComplete(const net::URLFetcher* source) override;
54 50
55 // The SequencedTaskRunner on which file system operations will be run. 51 // The SequencedTaskRunner on which file system operations will be run.
56 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 52 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
57 53
58 // Holds the URL request context. 54 // Holds the URL request context.
59 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 55 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
60 56
61 // The fetcher for downloading the snippets. 57 // The fetcher for downloading the snippets.
62 std::unique_ptr<net::URLFetcher> url_fetcher_; 58 std::unique_ptr<net::URLFetcher> url_fetcher_;
63 59
64 // The callbacks to notify when new snippets get fetched. 60 // The callbacks to notify when new snippets get fetched.
65 SnippetsAvailableCallbackList callback_list_; 61 SnippetsAvailableCallbackList callback_list_;
66 62
67 // Flag for picking the right (stable/non-stable) API key for Chrome Reader 63 // Flag for picking the right (stable/non-stable) API key for Chrome Reader
68 bool is_stable_channel_; 64 bool is_stable_channel_;
69 65
70 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher); 66 DISALLOW_COPY_AND_ASSIGN(NTPSnippetsFetcher);
71 }; 67 };
72 } // namespace ntp_snippets 68 } // namespace ntp_snippets
73 69
74 #endif // COMPONENTS_NTP_SNIPPETS_NTP_SNIPPETS_FETCHER_H_ 70 #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