summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-16 21:30:53 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-16 21:30:53 +0000
commit93bd86a6b4678b9dfc5b263107a90131974ef529 (patch)
tree0485992481c879628ed09f53c9d9eb4dc0826de2
parentaf3490e9e22d301ff9dc521f4cee04ef1a20abd5 (diff)
downloadchromium_src-93bd86a6b4678b9dfc5b263107a90131974ef529.zip
chromium_src-93bd86a6b4678b9dfc5b263107a90131974ef529.tar.gz
chromium_src-93bd86a6b4678b9dfc5b263107a90131974ef529.tar.bz2
Add Group-Policy to disable the SPDY protocol.
BUG=59105 TEST=Configuration* Review URL: http://codereview.chromium.org/3782007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62875 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/policy/policy_templates.grd7
-rw-r--r--chrome/app/policy/policy_templates.json10
-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
-rw-r--r--chrome/common/policy_constants.cc1
-rw-r--r--chrome/common/policy_constants.h1
-rw-r--r--chrome/common/pref_names.cc3
-rw-r--r--chrome/common/pref_names.h1
13 files changed, 53 insertions, 0 deletions
diff --git a/chrome/app/policy/policy_templates.grd b/chrome/app/policy/policy_templates.grd
index 04b2e5d..ba673a0 100644
--- a/chrome/app/policy/policy_templates.grd
+++ b/chrome/app/policy/policy_templates.grd
@@ -172,6 +172,13 @@ templates and will be translated for each locale. -->
If you enable or disable this setting, users cannot change or override this setting in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>.
</message>
+ <message name="IDS_POLICY_DISABLESPDY_CAPTION" desc="Caption of the 'Disable SPDY' policy.">
+ Disable SPDY protocol
+ </message>
+ <message name="IDS_POLICY_DISABLESPDY_DESC" desc="Description of the 'Disable SPDY' policy.">
+ Disables use of the SPDY protocol in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>.
+ </message>
+
<message name="IDS_POLICY_JAVASCRIPTENABLED_CAPTION" desc="Caption of the 'JavaScript enabled' policy settings page.">
Enable JavaScript
</message>
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json
index 200ccbb..90ce7bb 100644
--- a/chrome/app/policy/policy_templates.json
+++ b/chrome/app/policy/policy_templates.json
@@ -134,6 +134,16 @@
}
},
{
+ 'name': 'DisableSpdy',
+ 'type': 'main',
+ 'annotations': {
+ 'platforms': ['linux', 'mac', 'win'],
+ 'products': ['chrome'],
+ 'features': {'dynamic_refresh': 1},
+ 'example_value': True,
+ }
+ },
+ {
'name': 'JavascriptEnabled',
'type': 'main',
'annotations': {
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
diff --git a/chrome/common/policy_constants.cc b/chrome/common/policy_constants.cc
index f149a90..ffe93b4 100644
--- a/chrome/common/policy_constants.cc
+++ b/chrome/common/policy_constants.cc
@@ -31,6 +31,7 @@ const char kDefaultSearchProviderIconURL[] =
"DefaultSearchProviderIconURL";
const char kDefaultSearchProviderEncodings[] =
"DefaultSearchProviderEncodings";
+const char kDisableSpdy[] = "DisableSpdy";
const char kProxyServerMode[] = "ProxyServerMode";
const char kProxyServer[] = "ProxyServer";
const char kProxyPacUrl[] = "ProxyPacUrl";
diff --git a/chrome/common/policy_constants.h b/chrome/common/policy_constants.h
index 919bb7f..cebf36b 100644
--- a/chrome/common/policy_constants.h
+++ b/chrome/common/policy_constants.h
@@ -29,6 +29,7 @@ extern const char kDefaultSearchProviderSearchURL[];
extern const char kDefaultSearchProviderSuggestURL[];
extern const char kDefaultSearchProviderIconURL[];
extern const char kDefaultSearchProviderEncodings[];
+extern const char kDisableSpdy[];
extern const char kProxyServerMode[];
extern const char kProxyServer[];
extern const char kProxyPacUrl[];
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 02d5712..fcd461b 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -194,6 +194,9 @@ const char kDnsPrefetchingEnabled[] = "dns_prefetching.enabled";
// next startup, based on what was actually needed during this startup.
const char kDnsStartupPrefetchList[] = "StartupDNSPrefetchList";
+// Disables the SPDY protocol.
+const char kDisableSpdy[] = "spdy.disabled";
+
// A list of host names used to fetch web pages, and their commonly used
// sub-resource hostnames (and expected latency benefits from pre-resolving, or
// preconnecting to, such sub-resource hostnames).
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index bc6bc9a..7f7acdc 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -71,6 +71,7 @@ extern const char kAlternateErrorPagesEnabled[];
extern const char kDnsPrefetchingEnabled[];
extern const char kDnsStartupPrefetchList[];
extern const char kDnsHostReferralList[];
+extern const char kDisableSpdy[];
extern const char kCookiePromptExpanded[];
extern const char kInstantConfirmDialogShown[];
extern const char kInstantEnabled[];