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

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

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 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 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 23 matching lines...) Expand all
34 } 34 }
35 35
36 namespace history { 36 namespace history {
37 class HistoryService; 37 class HistoryService;
38 } 38 }
39 39
40 namespace net { 40 namespace net {
41 class HttpResponseInfo; 41 class HttpResponseInfo;
42 } 42 }
43 43
44 namespace syncer { 44 namespace sync_driver {
45 class SyncService; 45 class SyncService;
46 } 46 }
47 47
48 namespace precache { 48 namespace precache {
49 49
50 class PrecacheDatabase; 50 class PrecacheDatabase;
51 class PrecacheUnfinishedWork; 51 class PrecacheUnfinishedWork;
52 52
53 // Visible for test. 53 // Visible for test.
54 size_t NumTopHosts(); 54 size_t NumTopHosts();
55 55
56 // Class that manages all precaching-related activities. Owned by the 56 // Class that manages all precaching-related activities. Owned by the
57 // BrowserContext that it is constructed for. Use 57 // BrowserContext that it is constructed for. Use
58 // PrecacheManagerFactory::GetForBrowserContext to get an instance of this 58 // PrecacheManagerFactory::GetForBrowserContext to get an instance of this
59 // class. All methods must be called on the UI thread unless indicated 59 // class. All methods must be called on the UI thread unless indicated
60 // otherwise. 60 // otherwise.
61 // TODO(sclittle): Delete precache history when browsing history is deleted. 61 // TODO(sclittle): Delete precache history when browsing history is deleted.
62 // http://crbug.com/326549 62 // http://crbug.com/326549
63 class PrecacheManager : public KeyedService, 63 class PrecacheManager : public KeyedService,
64 public PrecacheFetcher::PrecacheDelegate, 64 public PrecacheFetcher::PrecacheDelegate,
65 public base::SupportsWeakPtr<PrecacheManager> { 65 public base::SupportsWeakPtr<PrecacheManager> {
66 public: 66 public:
67 typedef base::Callback<void(bool)> PrecacheCompletionCallback; 67 typedef base::Callback<void(bool)> PrecacheCompletionCallback;
68 68
69 PrecacheManager(content::BrowserContext* browser_context, 69 PrecacheManager(content::BrowserContext* browser_context,
70 const syncer::SyncService* const sync_service, 70 const sync_driver::SyncService* const sync_service,
71 const history::HistoryService* const history_service, 71 const history::HistoryService* const history_service,
72 const base::FilePath& db_path, 72 const base::FilePath& db_path,
73 std::unique_ptr<PrecacheDatabase> precache_database); 73 std::unique_ptr<PrecacheDatabase> precache_database);
74 ~PrecacheManager() override; 74 ~PrecacheManager() override;
75 75
76 // Returns true if the client is in the experiment group -- that is, 76 // 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 77 // precaching is allowed based on user settings, and enabled as part of a
78 // field trial or by commandline flag. Virtual for testing. 78 // field trial or by commandline flag. Virtual for testing.
79 virtual bool IsInExperimentGroup() const; 79 virtual bool IsInExperimentGroup() const;
80 80
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 const base::Time& fetch_time, 175 const base::Time& fetch_time,
176 const net::HttpResponseInfo& info, 176 const net::HttpResponseInfo& info,
177 int64_t size, 177 int64_t size,
178 int host_rank); 178 int host_rank);
179 179
180 // The browser context that owns this PrecacheManager. 180 // The browser context that owns this PrecacheManager.
181 content::BrowserContext* const browser_context_; 181 content::BrowserContext* const browser_context_;
182 182
183 // The sync service corresponding to the browser context. Used to determine 183 // The sync service corresponding to the browser context. Used to determine
184 // whether precache can run. May be null. 184 // whether precache can run. May be null.
185 const syncer::SyncService* const sync_service_; 185 const sync_driver::SyncService* const sync_service_;
186 186
187 // The history service corresponding to the browser context. Used to determine 187 // The history service corresponding to the browser context. Used to determine
188 // the list of top hosts. May be null. 188 // the list of top hosts. May be null.
189 const history::HistoryService* const history_service_; 189 const history::HistoryService* const history_service_;
190 190
191 // The PrecacheFetcher used to precache resources. Should only be used on the 191 // The PrecacheFetcher used to precache resources. Should only be used on the
192 // UI thread. 192 // UI thread.
193 std::unique_ptr<PrecacheFetcher> precache_fetcher_; 193 std::unique_ptr<PrecacheFetcher> precache_fetcher_;
194 194
195 // The callback that will be run if precaching finishes without being 195 // The callback that will be run if precaching finishes without being
196 // canceled. 196 // canceled.
197 PrecacheCompletionCallback precache_completion_callback_; 197 PrecacheCompletionCallback precache_completion_callback_;
198 198
199 // The PrecacheDatabase for tracking precache metrics. Should only be used on 199 // The PrecacheDatabase for tracking precache metrics. Should only be used on
200 // the DB thread. 200 // the DB thread.
201 std::unique_ptr<PrecacheDatabase> precache_database_; 201 std::unique_ptr<PrecacheDatabase> precache_database_;
202 202
203 // Flag indicating whether or not precaching is currently in progress. 203 // Flag indicating whether or not precaching is currently in progress.
204 bool is_precaching_; 204 bool is_precaching_;
205 205
206 // Work that hasn't yet finished. 206 // Work that hasn't yet finished.
207 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_; 207 std::unique_ptr<PrecacheUnfinishedWork> unfinished_work_;
208 208
209 DISALLOW_COPY_AND_ASSIGN(PrecacheManager); 209 DISALLOW_COPY_AND_ASSIGN(PrecacheManager);
210 }; 210 };
211 211
212 } // namespace precache 212 } // namespace precache
213 213
214 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ 214 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_
OLDNEW
« no previous file with comments | « components/password_manager/sync/browser/sync_username_test_base.h ('k') | components/precache/content/precache_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698