summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/net/net_pref_observer.cc15
-rw-r--r--chrome/browser/net/net_pref_observer.h5
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store.cc4
-rw-r--r--chrome/browser/policy/configuration_policy_pref_store_unittest.cc2
-rw-r--r--chrome/browser/policy/configuration_policy_store.h1
-rw-r--r--chrome/browser/policy/managed_prefs_banner_base.cc1
-rw-r--r--chrome/browser/prefs/browser_prefs.cc2
7 files changed, 30 insertions, 0 deletions
diff --git a/chrome/browser/net/net_pref_observer.cc b/chrome/browser/net/net_pref_observer.cc
index 1cb2ddc..5ab75ff 100644
--- a/chrome/browser/net/net_pref_observer.cc
+++ b/chrome/browser/net/net_pref_observer.cc
@@ -8,10 +8,15 @@
#include "chrome/browser/net/predictor_api.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
+#include "net/http/http_stream_factory.h"
NetPrefObserver::NetPrefObserver(PrefService* prefs) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
dns_prefetching_enabled_.Init(prefs::kDnsPrefetchingEnabled, prefs, this);
+ spdy_disabled_.Init(prefs::kDisableSpdy, prefs, this);
+
+ ApplySettings();
}
NetPrefObserver::~NetPrefObserver() {
@@ -21,6 +26,16 @@ NetPrefObserver::~NetPrefObserver() {
void NetPrefObserver::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
+ ApplySettings();
+}
+
+void NetPrefObserver::ApplySettings() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
chrome_browser_net::EnablePredictor(*dns_prefetching_enabled_);
+ net::HttpStreamFactory::set_spdy_enabled(!*spdy_disabled_);
+}
+
+// static
+void NetPrefObserver::RegisterPrefs(PrefService* prefs) {
+ prefs->RegisterBooleanPref(prefs::kDisableSpdy, false);
}
diff --git a/chrome/browser/net/net_pref_observer.h b/chrome/browser/net/net_pref_observer.h
index d41e8b7..33b0a97 100644
--- a/chrome/browser/net/net_pref_observer.h
+++ b/chrome/browser/net/net_pref_observer.h
@@ -23,8 +23,13 @@ class NetPrefObserver : public NotificationObserver {
const NotificationSource& source,
const NotificationDetails& details);
+ static void RegisterPrefs(PrefService* prefs);
+
private:
+ void ApplySettings();
+
BooleanPrefMember dns_prefetching_enabled_;
+ BooleanPrefMember spdy_disabled_;
DISALLOW_COPY_AND_ASSIGN(NetPrefObserver);
};
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc
index 0e73975..c496348 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc
@@ -105,6 +105,8 @@ const ConfigurationPolicyPrefStore::PolicyToPreferenceMapEntry
prefs::kSearchSuggestEnabled },
{ Value::TYPE_BOOLEAN, kPolicyDnsPrefetchingEnabled,
prefs::kDnsPrefetchingEnabled },
+ { Value::TYPE_BOOLEAN, kPolicyDisableSpdy,
+ prefs::kDisableSpdy },
{ Value::TYPE_BOOLEAN, kPolicySafeBrowsingEnabled,
prefs::kSafeBrowsingEnabled },
{ Value::TYPE_BOOLEAN, kPolicyPasswordManagerEnabled,
@@ -201,6 +203,8 @@ ConfigurationPolicyPrefStore::GetChromePolicyValueMap() {
Value::TYPE_BOOLEAN, key::kSearchSuggestEnabled },
{ ConfigurationPolicyStore::kPolicyDnsPrefetchingEnabled,
Value::TYPE_BOOLEAN, key::kDnsPrefetchingEnabled },
+ { ConfigurationPolicyStore::kPolicyDisableSpdy,
+ Value::TYPE_BOOLEAN, key::kDisableSpdy },
{ ConfigurationPolicyStore::kPolicySafeBrowsingEnabled,
Value::TYPE_BOOLEAN, key::kSafeBrowsingEnabled },
{ ConfigurationPolicyStore::kPolicyMetricsReportingEnabled,
diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
index 2d13c2f..ca4d51e 100644
--- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
@@ -144,6 +144,8 @@ INSTANTIATE_TEST_CASE_P(
prefs::kSearchSuggestEnabled),
TypeAndName(ConfigurationPolicyStore::kPolicyDnsPrefetchingEnabled,
prefs::kDnsPrefetchingEnabled),
+ TypeAndName(ConfigurationPolicyStore::kPolicyDisableSpdy,
+ prefs::kDisableSpdy),
TypeAndName(ConfigurationPolicyStore::kPolicySafeBrowsingEnabled,
prefs::kSafeBrowsingEnabled),
TypeAndName(ConfigurationPolicyStore::kPolicyMetricsReportingEnabled,
diff --git a/chrome/browser/policy/configuration_policy_store.h b/chrome/browser/policy/configuration_policy_store.h
index 6df652a..fb21d0e 100644
--- a/chrome/browser/policy/configuration_policy_store.h
+++ b/chrome/browser/policy/configuration_policy_store.h
@@ -31,6 +31,7 @@ class ConfigurationPolicyStore {
kPolicyDefaultSearchProviderSuggestURL,
kPolicyDefaultSearchProviderIconURL,
kPolicyDefaultSearchProviderEncodings,
+ kPolicyDisableSpdy,
kPolicyProxyServerMode,
kPolicyProxyServer,
kPolicyProxyPacUrl,
diff --git a/chrome/browser/policy/managed_prefs_banner_base.cc b/chrome/browser/policy/managed_prefs_banner_base.cc
index 916f44f..e02ec25 100644
--- a/chrome/browser/policy/managed_prefs_banner_base.cc
+++ b/chrome/browser/policy/managed_prefs_banner_base.cc
@@ -76,6 +76,7 @@ void ManagedPrefsBannerBase::Init(PrefService* local_state,
AddUserPref(prefs::kAlternateErrorPagesEnabled);
AddUserPref(prefs::kSearchSuggestEnabled);
AddUserPref(prefs::kDnsPrefetchingEnabled);
+ AddUserPref(prefs::kDisableSpdy);
AddUserPref(prefs::kSafeBrowsingEnabled);
#if defined(GOOGLE_CHROME_BUILD)
AddLocalStatePref(prefs::kMetricsReportingEnabled);
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 3a40535..a5957c3 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -31,6 +31,7 @@
#include "chrome/browser/metrics/metrics_service.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/net/predictor_api.h"
+#include "chrome/browser/net/net_pref_observer.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/page_info_model.h"
#include "chrome/browser/password_manager/password_manager.h"
@@ -145,6 +146,7 @@ void RegisterUserPrefs(PrefService* user_prefs) {
SigninManager::RegisterUserPrefs(user_prefs);
TemplateURLModel::RegisterUserPrefs(user_prefs);
InstantController::RegisterUserPrefs(user_prefs);
+ NetPrefObserver::RegisterPrefs(user_prefs);
}
} // namespace browser