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

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

Issue 514353002: Check if precaching is allowed before reporting related metrics (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « components/precache/content/precache_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/precache/content/precache_manager.cc
diff --git a/components/precache/content/precache_manager.cc b/components/precache/content/precache_manager.cc
index 2998eb142621a41b4f434a49360edad6c7798201..f222163d7c94ec2fc488bfc2c4b1c0c88d2465f2 100644
--- a/components/precache/content/precache_manager.cc
+++ b/components/precache/content/precache_manager.cc
@@ -9,10 +9,13 @@
#include "base/files/file_path.h"
#include "base/logging.h"
#include "base/metrics/field_trial.h"
+#include "base/prefs/pref_service.h"
#include "base/time/time.h"
+#include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names.h"
#include "components/precache/core/precache_database.h"
#include "components/precache/core/precache_switches.h"
#include "components/precache/core/url_list_provider.h"
+#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/network_change_notifier.h"
@@ -50,6 +53,16 @@ bool PrecacheManager::IsPrecachingEnabled() {
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePrecache);
}
+bool PrecacheManager::IsPrecachingAllowed() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+#if defined(SPDY_PROXY_AUTH_ORIGIN)
+ return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean(
+ data_reduction_proxy::prefs::kDataReductionProxyEnabled);
+#else
+ return false;
+#endif
+}
+
void PrecacheManager::StartPrecaching(
const PrecacheCompletionCallback& precache_completion_callback,
URLListProvider* url_list_provider) {
« no previous file with comments | « components/precache/content/precache_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698