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

Unified Diff: components/precache/content/precache_manager.h

Issue 1266243003: Tweaks to the precache triggering code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. 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 side-by-side diff with in-line comments
Download patch
Index: components/precache/content/precache_manager.h
diff --git a/components/precache/content/precache_manager.h b/components/precache/content/precache_manager.h
index 2f8313df342ed14beef2a81d226a53d904b53d17..912a41fc055467bd7689ea344427c34f2ff79150 100644
--- a/components/precache/content/precache_manager.h
+++ b/components/precache/content/precache_manager.h
@@ -60,12 +60,14 @@ class PrecacheManager : public KeyedService,
const sync_driver::SyncService* const sync_service);
~PrecacheManager() override;
- // Returns true if precaching is enabled as part of a field trial or by the
- // command line flag. This method can be called on any thread.
- static bool IsPrecachingEnabled();
+ // Returns true if precaching is allowed for the browser context based on user
+ // settings, and enabled as part of a field trial or by commandline flag.
+ // Virtual for testing.
+ virtual bool ShouldRun() const;
bengr 2015/08/07 17:21:45 I'm not a huge fan of these names, but am ok with
twifkak 2015/08/07 17:57:08 I'm not a huge fan of them either. When I introduc
- // Returns true if precaching is allowed for the browser context.
- bool IsPrecachingAllowed();
+ // Returns true if precaching is allowed for the browser context based on user
+ // settings. Virtual for testing.
+ virtual bool WouldRun() const;
// Starts precaching resources that the user is predicted to fetch in the
// future. If precaching is already currently in progress, then this method
@@ -101,6 +103,15 @@ class PrecacheManager : public KeyedService,
// From history::HistoryService::TopHosts.
void OnHostsReceived(const history::TopHostsList& host_counts);
+ // Returns true if precaching is enabled as part of a field trial or by the
+ // command line flag. This has a different meaning from the
+ // "is_precaching_enabled" pref set in PrecacheServiceLauncher. This method
+ // can be called on any thread.
+ static bool IsPrecachingEnabled();
+
+ // Returns true if precaching is allowed for the browser context.
+ bool IsPrecachingAllowed() const;
+
// The browser context that owns this PrecacheManager.
content::BrowserContext* const browser_context_;

Powered by Google App Engine
This is Rietveld 408576698