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

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: 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
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Must only be instantiated on the UI thread. When the suggestions have been 67 // Must only be instantiated on the UI thread. When the suggestions have been
68 // fetched (from cache or URL) and parsed, invokes |callback|, also on the UI 68 // fetched (from cache or URL) and parsed, invokes |callback|, also on the UI
69 // thread. 69 // thread.
70 // 70 //
71 // Set |force_download| to enforce re-downloading the suggestions file, even 71 // Set |force_download| to enforce re-downloading the suggestions file, even
72 // if it already exists on disk. 72 // if it already exists on disk.
73 // 73 //
74 // TODO(treib): PopularSites should query the variation params itself instead 74 // TODO(treib): PopularSites should query the variation params itself instead
75 // of having them passed in. 75 // of having them passed in.
76 PopularSites(PrefService* prefs, 76 PopularSites(const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
77 const scoped_refptr<base::TaskRunner>& blocking_runner,
78 PrefService* prefs,
77 const TemplateURLService* template_url_service, 79 const TemplateURLService* template_url_service,
78 variations::VariationsService* variations_service, 80 variations::VariationsService* variations_service,
79 net::URLRequestContextGetter* download_context, 81 net::URLRequestContextGetter* download_context,
80 const base::FilePath& directory, 82 const base::FilePath& directory,
81 const std::string& variation_param_country, 83 const std::string& variation_param_country,
82 const std::string& variation_param_version, 84 const std::string& variation_param_version,
83 bool force_download, 85 bool force_download,
84 const FinishedCallback& callback); 86 const FinishedCallback& callback);
85 87
86 // This fetches the popular sites from a given url and is only used for 88 // This fetches the popular sites from a given url and is only used for
87 // debugging through the popular-sites-internals page. 89 // debugging through the popular-sites-internals page.
88 PopularSites(PrefService* prefs, 90 PopularSites(const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
91 const scoped_refptr<base::TaskRunner>& blocking_runner,
92 PrefService* prefs,
89 net::URLRequestContextGetter* download_context, 93 net::URLRequestContextGetter* download_context,
90 const base::FilePath& directory, 94 const base::FilePath& directory,
91 const GURL& url, 95 const GURL& url,
92 const FinishedCallback& callback); 96 const FinishedCallback& callback);
93 97
94 ~PopularSites() override; 98 ~PopularSites() override;
95 99
96 const std::vector<Site>& sites() const { return sites_; } 100 const std::vector<Site>& sites() const { return sites_; }
97 101
98 // The country/version of the file that was last downloaded. 102 // The country/version of the file that was last downloaded.
99 std::string GetCountry() const; 103 std::string GetCountry() const;
100 std::string GetVersion() const; 104 std::string GetVersion() const;
101 105
102 const base::FilePath& local_path() const { return local_path_; } 106 const base::FilePath& local_path() const { return local_path_; }
103 107
104 // Register preferences used by this class. 108 // Register preferences used by this class.
105 static void RegisterProfilePrefs( 109 static void RegisterProfilePrefs(
106 user_prefs::PrefRegistrySyncable* user_prefs); 110 user_prefs::PrefRegistrySyncable* user_prefs);
107 111
108 private: 112 private:
109 PopularSites(PrefService* prefs, 113 PopularSites(const scoped_refptr<base::SingleThreadTaskRunner>& ui_thread,
114 const scoped_refptr<base::TaskRunner>& blocking_runner,
115 PrefService* prefs,
110 net::URLRequestContextGetter* download_context, 116 net::URLRequestContextGetter* download_context,
111 const base::FilePath& directory, 117 const base::FilePath& directory,
112 const std::string& country, 118 const std::string& country,
113 const std::string& version, 119 const std::string& version,
114 const GURL& override_url, 120 const GURL& override_url,
115 bool force_download, 121 bool force_download,
116 const FinishedCallback& callback); 122 const FinishedCallback& callback);
117 123
118 GURL GetPopularSitesURL() const; 124 GURL GetPopularSitesURL() const;
119 125
(...skipping 20 matching lines...) Expand all
140 bool is_fallback_; 146 bool is_fallback_;
141 std::vector<Site> sites_; 147 std::vector<Site> sites_;
142 std::string pending_country_; 148 std::string pending_country_;
143 std::string pending_version_; 149 std::string pending_version_;
144 150
145 base::FilePath local_path_; 151 base::FilePath local_path_;
146 152
147 PrefService* prefs_; 153 PrefService* prefs_;
148 net::URLRequestContextGetter* download_context_; 154 net::URLRequestContextGetter* download_context_;
149 155
150 scoped_refptr<base::TaskRunner> runner_; 156 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_;
157 scoped_refptr<base::TaskRunner> blocking_runner_;
151 158
152 base::WeakPtrFactory<PopularSites> weak_ptr_factory_; 159 base::WeakPtrFactory<PopularSites> weak_ptr_factory_;
153 160
154 DISALLOW_COPY_AND_ASSIGN(PopularSites); 161 DISALLOW_COPY_AND_ASSIGN(PopularSites);
155 }; 162 };
156 163
157 #endif // CHROME_BROWSER_ANDROID_NTP_POPULAR_SITES_H_ 164 #endif // CHROME_BROWSER_ANDROID_NTP_POPULAR_SITES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698