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

Side by Side Diff: components/precache/content/precache_manager.h

Issue 2544613003: Disable precache if data_reduction_proxy enabled. (Closed)
Patch Set: Rebase. Created 4 years 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/precache/content/DEPS ('k') | components/precache/content/precache_manager.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ 5 #ifndef COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_
6 #define COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ 6 #define COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 15 matching lines...) Expand all
26 namespace base { 26 namespace base {
27 class FilePath; 27 class FilePath;
28 class Time; 28 class Time;
29 class TimeDelta; 29 class TimeDelta;
30 } 30 }
31 31
32 namespace content { 32 namespace content {
33 class BrowserContext; 33 class BrowserContext;
34 } 34 }
35 35
36 namespace data_reduction_proxy {
37 class DataReductionProxySettings;
38 }
39
36 namespace history { 40 namespace history {
37 class HistoryService; 41 class HistoryService;
38 } 42 }
39 43
40 namespace net { 44 namespace net {
41 class HttpResponseInfo; 45 class HttpResponseInfo;
42 } 46 }
43 47
44 namespace syncer { 48 namespace syncer {
45 class SyncService; 49 class SyncService;
(...skipping 14 matching lines...) Expand all
60 // otherwise. 64 // otherwise.
61 // TODO(sclittle): Delete precache history when browsing history is deleted. 65 // TODO(sclittle): Delete precache history when browsing history is deleted.
62 // http://crbug.com/326549 66 // http://crbug.com/326549
63 class PrecacheManager : public KeyedService, 67 class PrecacheManager : public KeyedService,
64 public PrecacheFetcher::PrecacheDelegate, 68 public PrecacheFetcher::PrecacheDelegate,
65 public base::SupportsWeakPtr<PrecacheManager> { 69 public base::SupportsWeakPtr<PrecacheManager> {
66 public: 70 public:
67 typedef base::Callback<void(bool)> PrecacheCompletionCallback; 71 typedef base::Callback<void(bool)> PrecacheCompletionCallback;
68 72
69 PrecacheManager(content::BrowserContext* browser_context, 73 PrecacheManager(content::BrowserContext* browser_context,
70 const syncer::SyncService* const sync_service, 74 const syncer::SyncService* sync_service,
71 const history::HistoryService* const history_service, 75 const history::HistoryService* history_service,
76 const data_reduction_proxy::DataReductionProxySettings*
77 data_reduction_proxy_settings,
72 const base::FilePath& db_path, 78 const base::FilePath& db_path,
73 std::unique_ptr<PrecacheDatabase> precache_database); 79 std::unique_ptr<PrecacheDatabase> precache_database);
74 ~PrecacheManager() override; 80 ~PrecacheManager() override;
75 81
76 // Returns true if the client is in the experiment group -- that is, 82 // Returns true if the client is in the experiment group -- that is,
77 // precaching is allowed based on user settings, and enabled as part of a 83 // precaching is allowed based on user settings, and enabled as part of a
78 // field trial or by commandline flag. Virtual for testing. 84 // field trial or by commandline flag. Virtual for testing.
79 virtual bool IsInExperimentGroup() const; 85 virtual bool IsInExperimentGroup() const;
80 86
81 // Returns true if the client is in the control group -- that is, precaching 87 // Returns true if the client is in the control group -- that is, precaching
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 content::BrowserContext* const browser_context_; 187 content::BrowserContext* const browser_context_;
182 188
183 // The sync service corresponding to the browser context. Used to determine 189 // The sync service corresponding to the browser context. Used to determine
184 // whether precache can run. May be null. 190 // whether precache can run. May be null.
185 const syncer::SyncService* const sync_service_; 191 const syncer::SyncService* const sync_service_;
186 192
187 // The history service corresponding to the browser context. Used to determine 193 // The history service corresponding to the browser context. Used to determine
188 // the list of top hosts. May be null. 194 // the list of top hosts. May be null.
189 const history::HistoryService* const history_service_; 195 const history::HistoryService* const history_service_;
190 196
197 // The data reduction proxy settings object corresponding to the browser
198 // context. Used to determine if the proxy is enabled.
199 const data_reduction_proxy::DataReductionProxySettings* const
200 data_reduction_proxy_settings_;
201
191 // The PrecacheFetcher used to precache resources. Should only be used on the 202 // The PrecacheFetcher used to precache resources. Should only be used on the
192 // UI thread. 203 // UI thread.
193 std::unique_ptr<PrecacheFetcher> precache_fetcher_; 204 std::unique_ptr<PrecacheFetcher> precache_fetcher_;
194 205
195 // The callback that will be run if precaching finishes without being 206 // The callback that will be run if precaching finishes without being
196 // canceled. 207 // canceled.
197 PrecacheCompletionCallback precache_completion_callback_; 208 PrecacheCompletionCallback precache_completion_callback_;
198 209
199 // The PrecacheDatabase for tracking precache metrics. Should only be used on 210 // The PrecacheDatabase for tracking precache metrics. Should only be used on
200 // the DB thread. 211 // the DB thread.
201 std::unique_ptr<PrecacheDatabase> precache_database_; 212 std::unique_ptr<PrecacheDatabase> precache_database_;
202 213
203 // Flag indicating whether or not precaching is currently in progress. 214 // Flag indicating whether or not precaching is currently in progress.
204 bool is_precaching_; 215 bool is_precaching_;
205 216
206 // Work that hasn't yet finished. 217 // Work that hasn't yet finished.
207 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_; 218 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_;
208 219
209 DISALLOW_COPY_AND_ASSIGN(PrecacheManager); 220 DISALLOW_COPY_AND_ASSIGN(PrecacheManager);
210 }; 221 };
211 222
212 } // namespace precache 223 } // namespace precache
213 224
214 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ 225 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_
OLDNEW
« no previous file with comments | « components/precache/content/DEPS ('k') | components/precache/content/precache_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698