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

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

Issue 1272443002: Only set precache.last_time when precache ran. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@filter_stats
Patch Set: Created 5 years, 4 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 <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // BrowserContext that it is constructed for. Use 47 // BrowserContext that it is constructed for. Use
48 // PrecacheManagerFactory::GetForBrowserContext to get an instance of this 48 // PrecacheManagerFactory::GetForBrowserContext to get an instance of this
49 // class. All methods must be called on the UI thread unless indicated 49 // class. All methods must be called on the UI thread unless indicated
50 // otherwise. 50 // otherwise.
51 // TODO(sclittle): Delete precache history when browsing history is deleted. 51 // TODO(sclittle): Delete precache history when browsing history is deleted.
52 // http://crbug.com/326549 52 // http://crbug.com/326549
53 class PrecacheManager : public KeyedService, 53 class PrecacheManager : public KeyedService,
54 public PrecacheFetcher::PrecacheDelegate, 54 public PrecacheFetcher::PrecacheDelegate,
55 public base::SupportsWeakPtr<PrecacheManager> { 55 public base::SupportsWeakPtr<PrecacheManager> {
56 public: 56 public:
57 typedef base::Closure PrecacheCompletionCallback; 57 typedef base::Callback<void(bool)> PrecacheCompletionCallback;
58 58
59 PrecacheManager(content::BrowserContext* browser_context, 59 PrecacheManager(content::BrowserContext* browser_context,
60 const sync_driver::SyncService* const sync_service); 60 const sync_driver::SyncService* const sync_service);
61 ~PrecacheManager() override; 61 ~PrecacheManager() override;
62 62
63 // Returns true if precaching is allowed for the browser context based on user 63 // Returns true if precaching is allowed for the browser context based on user
64 // settings, and enabled as part of a field trial or by commandline flag. 64 // settings, and enabled as part of a field trial or by commandline flag.
65 // Virtual for testing. 65 // Virtual for testing.
66 virtual bool ShouldRun() const; 66 virtual bool ShouldRun() const;
67 67
68 // Returns true if precaching is allowed for the browser context based on user 68 // Returns true if precaching is allowed for the browser context based on user
69 // settings. Virtual for testing. 69 // settings. Virtual for testing.
70 virtual bool WouldRun() const; 70 virtual bool WouldRun() const;
71 71
72 // Starts precaching resources that the user is predicted to fetch in the 72 // Starts precaching resources that the user is predicted to fetch in the
73 // future. If precaching is already currently in progress, then this method 73 // future. If precaching is already currently in progress, then this method
74 // does nothing. The |precache_completion_callback| will be run when 74 // does nothing. The |precache_completion_callback| will be passed true when
75 // precaching finishes, but will not be run if precaching is canceled. 75 // precaching finishes, and passed false when precaching abort due to failed
76 // preconditions, but will not be run if precaching is canceled.
76 void StartPrecaching( 77 void StartPrecaching(
77 const PrecacheCompletionCallback& precache_completion_callback, 78 const PrecacheCompletionCallback& precache_completion_callback,
78 const history::HistoryService& history_service); 79 const history::HistoryService& history_service);
79 80
80 // Cancels precaching if it is in progress. 81 // Cancels precaching if it is in progress.
81 void CancelPrecaching(); 82 void CancelPrecaching();
82 83
83 // Returns true if precaching is currently in progress, or false otherwise. 84 // Returns true if precaching is currently in progress, or false otherwise.
84 bool IsPrecaching() const; 85 bool IsPrecaching() const;
85 86
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 134
134 // Flag indicating whether or not precaching is currently in progress. 135 // Flag indicating whether or not precaching is currently in progress.
135 bool is_precaching_; 136 bool is_precaching_;
136 137
137 DISALLOW_COPY_AND_ASSIGN(PrecacheManager); 138 DISALLOW_COPY_AND_ASSIGN(PrecacheManager);
138 }; 139 };
139 140
140 } // namespace precache 141 } // namespace precache
141 142
142 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_ 143 #endif // COMPONENTS_PRECACHE_CONTENT_PRECACHE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698