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

Side by Side Diff: chrome/browser/android/ntp/popular_sites.h

Issue 2012473002: Remove NTP dependency on //content/... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync Created 4 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 CHROME_BROWSER_ANDROID_NTP_POPULAR_SITES_H_ 5 #ifndef CHROME_BROWSER_ANDROID_NTP_POPULAR_SITES_H_
6 #define CHROME_BROWSER_ANDROID_NTP_POPULAR_SITES_H_ 6 #define CHROME_BROWSER_ANDROID_NTP_POPULAR_SITES_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 base::string16 title; 58 base::string16 title;
59 GURL url; 59 GURL url;
60 GURL favicon_url; 60 GURL favicon_url;
61 GURL large_icon_url; 61 GURL large_icon_url;
62 GURL thumbnail_url; 62 GURL thumbnail_url;
63 }; 63 };
64 64
65 using FinishedCallback = base::Callback<void(bool /* success */)>; 65 using FinishedCallback = base::Callback<void(bool /* success */)>;
66 66
67 // Must only be instantiated on the UI thread. When the suggestions have been 67 // When the suggestions have been fetched (from cache or URL) and parsed,
68 // fetched (from cache or URL) and parsed, invokes |callback|, also on the UI 68 // invokes |callback|, on the same thread as the caller.
69 // thread.
70 // 69 //
71 // Set |force_download| to enforce re-downloading the suggestions file, even 70 // Set |force_download| to enforce re-downloading the suggestions file, even
72 // if it already exists on disk. 71 // if it already exists on disk.
73 // 72 //
74 // TODO(treib): PopularSites should query the variation params itself instead 73 // TODO(treib): PopularSites should query the variation params itself instead
75 // of having them passed in. 74 // of having them passed in.
76 PopularSites(PrefService* prefs, 75 PopularSites(const scoped_refptr<base::SequencedWorkerPool>& blocking_pool,
76 PrefService* prefs,
77 const TemplateURLService* template_url_service, 77 const TemplateURLService* template_url_service,
78 variations::VariationsService* variations_service, 78 variations::VariationsService* variations_service,
79 net::URLRequestContextGetter* download_context, 79 net::URLRequestContextGetter* download_context,
80 const base::FilePath& directory, 80 const base::FilePath& directory,
81 const std::string& variation_param_country, 81 const std::string& variation_param_country,
82 const std::string& variation_param_version, 82 const std::string& variation_param_version,
83 bool force_download, 83 bool force_download,
84 const FinishedCallback& callback); 84 const FinishedCallback& callback);
85 85
86 // This fetches the popular sites from a given url and is only used for 86 // This fetches the popular sites from a given url and is only used for
87 // debugging through the popular-sites-internals page. 87 // debugging through the popular-sites-internals page.
88 PopularSites(PrefService* prefs, 88 PopularSites(const scoped_refptr<base::SequencedWorkerPool>& blocking_pool,
89 PrefService* prefs,
89 net::URLRequestContextGetter* download_context, 90 net::URLRequestContextGetter* download_context,
90 const base::FilePath& directory, 91 const base::FilePath& directory,
91 const GURL& url, 92 const GURL& url,
92 const FinishedCallback& callback); 93 const FinishedCallback& callback);
93 94
94 ~PopularSites() override; 95 ~PopularSites() override;
95 96
96 const std::vector<Site>& sites() const { return sites_; } 97 const std::vector<Site>& sites() const { return sites_; }
97 98
98 // The country/version of the file that was last downloaded. 99 // The country/version of the file that was last downloaded.
99 std::string GetCountry() const; 100 std::string GetCountry() const;
100 std::string GetVersion() const; 101 std::string GetVersion() const;
101 102
102 const base::FilePath& local_path() const { return local_path_; } 103 const base::FilePath& local_path() const { return local_path_; }
103 104
104 // Register preferences used by this class. 105 // Register preferences used by this class.
105 static void RegisterProfilePrefs( 106 static void RegisterProfilePrefs(
106 user_prefs::PrefRegistrySyncable* user_prefs); 107 user_prefs::PrefRegistrySyncable* user_prefs);
107 108
108 private: 109 private:
109 PopularSites(PrefService* prefs, 110 PopularSites(const scoped_refptr<base::SequencedWorkerPool>& blocking_pool,
111 PrefService* prefs,
110 net::URLRequestContextGetter* download_context, 112 net::URLRequestContextGetter* download_context,
111 const base::FilePath& directory, 113 const base::FilePath& directory,
112 const std::string& country, 114 const std::string& country,
113 const std::string& version, 115 const std::string& version,
114 const GURL& override_url, 116 const GURL& override_url,
115 bool force_download, 117 bool force_download,
116 const FinishedCallback& callback); 118 const FinishedCallback& callback);
117 119
118 GURL GetPopularSitesURL() const; 120 GURL GetPopularSitesURL() const;
119 121
(...skipping 20 matching lines...) Expand all
140 bool is_fallback_; 142 bool is_fallback_;
141 std::vector<Site> sites_; 143 std::vector<Site> sites_;
142 std::string pending_country_; 144 std::string pending_country_;
143 std::string pending_version_; 145 std::string pending_version_;
144 146
145 base::FilePath local_path_; 147 base::FilePath local_path_;
146 148
147 PrefService* prefs_; 149 PrefService* prefs_;
148 net::URLRequestContextGetter* download_context_; 150 net::URLRequestContextGetter* download_context_;
149 151
150 scoped_refptr<base::TaskRunner> runner_; 152 scoped_refptr<base::TaskRunner> blocking_runner_;
151 153
152 base::WeakPtrFactory<PopularSites> weak_ptr_factory_; 154 base::WeakPtrFactory<PopularSites> weak_ptr_factory_;
153 155
154 DISALLOW_COPY_AND_ASSIGN(PopularSites); 156 DISALLOW_COPY_AND_ASSIGN(PopularSites);
155 }; 157 };
156 158
157 #endif // CHROME_BROWSER_ANDROID_NTP_POPULAR_SITES_H_ 159 #endif // CHROME_BROWSER_ANDROID_NTP_POPULAR_SITES_H_
OLDNEW
« no previous file with comments | « chrome/browser/android/ntp/most_visited_sites_bridge.cc ('k') | chrome/browser/android/ntp/popular_sites.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698