Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / components / precache / content / precache_manager.cc
index 2998eb1..71ce9ea 100644 (file)
@@ -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,12 @@ bool PrecacheManager::IsPrecachingEnabled() {
          CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePrecache);
 }
 
+bool PrecacheManager::IsPrecachingAllowed() {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+  return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean(
+      data_reduction_proxy::prefs::kDataReductionProxyEnabled);
+}
+
 void PrecacheManager::StartPrecaching(
     const PrecacheCompletionCallback& precache_completion_callback,
     URLListProvider* url_list_provider) {