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

Side by Side Diff: chrome/browser/net/ssl_config_service_manager_pref.cc

Issue 7776002: Add back prefs::kSSL3Enabled and prefs::kTLS1Enabled, but control (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Also delete the pref_change_registrar_.Add() calls. Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/prefs/command_line_pref_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "chrome/browser/net/ssl_config_service_manager.h" 4 #include "chrome/browser/net/ssl_config_service_manager.h"
5 5
6 #include <algorithm> 6 #include <algorithm>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/command_line.h"
12 #include "chrome/browser/prefs/pref_change_registrar.h" 11 #include "chrome/browser/prefs/pref_change_registrar.h"
13 #include "chrome/browser/prefs/pref_member.h" 12 #include "chrome/browser/prefs/pref_member.h"
14 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
18 #include "content/browser/browser_thread.h" 16 #include "content/browser/browser_thread.h"
19 #include "content/common/notification_details.h" 17 #include "content/common/notification_details.h"
20 #include "content/common/notification_source.h" 18 #include "content/common/notification_source.h"
21 #include "net/base/ssl_cipher_suite_names.h" 19 #include "net/base/ssl_cipher_suite_names.h"
22 #include "net/base/ssl_config_service.h" 20 #include "net/base/ssl_config_service.h"
23 21
24 namespace { 22 namespace {
25 23
26 // Converts a ListValue of StringValues into a vector of strings. Any Values 24 // Converts a ListValue of StringValues into a vector of strings. Any Values
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 void GetSSLConfigFromPrefs(net::SSLConfig* config); 127 void GetSSLConfigFromPrefs(net::SSLConfig* config);
130 128
131 // Processes changes to the disabled cipher suites preference, updating the 129 // Processes changes to the disabled cipher suites preference, updating the
132 // cached list of parsed SSL/TLS cipher suites that are disabled. 130 // cached list of parsed SSL/TLS cipher suites that are disabled.
133 void OnDisabledCipherSuitesChange(PrefService* prefs); 131 void OnDisabledCipherSuitesChange(PrefService* prefs);
134 132
135 PrefChangeRegistrar pref_change_registrar_; 133 PrefChangeRegistrar pref_change_registrar_;
136 134
137 // The prefs (should only be accessed from UI thread) 135 // The prefs (should only be accessed from UI thread)
138 BooleanPrefMember rev_checking_enabled_; 136 BooleanPrefMember rev_checking_enabled_;
137 BooleanPrefMember ssl3_enabled_;
138 BooleanPrefMember tls1_enabled_;
139 139
140 // The cached list of disabled SSL cipher suites. 140 // The cached list of disabled SSL cipher suites.
141 std::vector<uint16> disabled_cipher_suites_; 141 std::vector<uint16> disabled_cipher_suites_;
142 142
143 scoped_refptr<SSLConfigServicePref> ssl_config_service_; 143 scoped_refptr<SSLConfigServicePref> ssl_config_service_;
144 144
145 DISALLOW_COPY_AND_ASSIGN(SSLConfigServiceManagerPref); 145 DISALLOW_COPY_AND_ASSIGN(SSLConfigServiceManagerPref);
146 }; 146 };
147 147
148 SSLConfigServiceManagerPref::SSLConfigServiceManagerPref( 148 SSLConfigServiceManagerPref::SSLConfigServiceManagerPref(
149 PrefService* local_state) 149 PrefService* local_state)
150 : ssl_config_service_(new SSLConfigServicePref()) { 150 : ssl_config_service_(new SSLConfigServicePref()) {
151 DCHECK(local_state); 151 DCHECK(local_state);
152 152
153 rev_checking_enabled_.Init(prefs::kCertRevocationCheckingEnabled, 153 rev_checking_enabled_.Init(prefs::kCertRevocationCheckingEnabled,
154 local_state, this); 154 local_state, this);
155 ssl3_enabled_.Init(prefs::kSSL3Enabled, local_state, this);
156 tls1_enabled_.Init(prefs::kTLS1Enabled, local_state, this);
wtc 2011/08/27 22:14:33 rsleevi: I just realized that I forgot to ask you
Ryan Sleevi 2011/08/27 22:21:45 That is a good question. I don't know what the met
wtc 2011/10/09 15:18:51 rsleevi,palmer: thank you for testing the patch, a
155 pref_change_registrar_.Init(local_state); 157 pref_change_registrar_.Init(local_state);
156 pref_change_registrar_.Add(prefs::kCipherSuiteBlacklist, this); 158 pref_change_registrar_.Add(prefs::kCipherSuiteBlacklist, this);
157 159
158 OnDisabledCipherSuitesChange(local_state); 160 OnDisabledCipherSuitesChange(local_state);
159 // Initialize from UI thread. This is okay as there shouldn't be anything on 161 // Initialize from UI thread. This is okay as there shouldn't be anything on
160 // the IO thread trying to access it yet. 162 // the IO thread trying to access it yet.
161 GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_); 163 GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_);
162 } 164 }
163 165
164 // static 166 // static
165 void SSLConfigServiceManagerPref::RegisterPrefs(PrefService* prefs) { 167 void SSLConfigServiceManagerPref::RegisterPrefs(PrefService* prefs) {
166 net::SSLConfig default_config; 168 net::SSLConfig default_config;
167 prefs->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled, 169 prefs->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled,
168 default_config.rev_checking_enabled); 170 default_config.rev_checking_enabled);
171 prefs->RegisterBooleanPref(prefs::kSSL3Enabled,
172 default_config.ssl3_enabled);
173 prefs->RegisterBooleanPref(prefs::kTLS1Enabled,
174 default_config.tls1_enabled);
169 prefs->RegisterListPref(prefs::kCipherSuiteBlacklist); 175 prefs->RegisterListPref(prefs::kCipherSuiteBlacklist);
170 } 176 }
Ryan Sleevi 2011/10/10 01:37:22 wtc: The pattern I've seen is to call prefs->Clear
171 177
172 net::SSLConfigService* SSLConfigServiceManagerPref::Get() { 178 net::SSLConfigService* SSLConfigServiceManagerPref::Get() {
173 return ssl_config_service_; 179 return ssl_config_service_;
174 } 180 }
175 181
176 void SSLConfigServiceManagerPref::Observe(int type, 182 void SSLConfigServiceManagerPref::Observe(int type,
177 const NotificationSource& source, 183 const NotificationSource& source,
178 const NotificationDetails& details) { 184 const NotificationDetails& details) {
179 if (type == chrome::NOTIFICATION_PREF_CHANGED) { 185 if (type == chrome::NOTIFICATION_PREF_CHANGED) {
180 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 186 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 14 matching lines...) Expand all
195 NewRunnableMethod( 201 NewRunnableMethod(
196 ssl_config_service_.get(), 202 ssl_config_service_.get(),
197 &SSLConfigServicePref::SetNewSSLConfig, 203 &SSLConfigServicePref::SetNewSSLConfig,
198 new_config)); 204 new_config));
199 } 205 }
200 } 206 }
201 207
202 void SSLConfigServiceManagerPref::GetSSLConfigFromPrefs( 208 void SSLConfigServiceManagerPref::GetSSLConfigFromPrefs(
203 net::SSLConfig* config) { 209 net::SSLConfig* config) {
204 config->rev_checking_enabled = rev_checking_enabled_.GetValue(); 210 config->rev_checking_enabled = rev_checking_enabled_.GetValue();
205 211 config->ssl3_enabled = ssl3_enabled_.GetValue();
206 config->ssl3_enabled = 212 config->tls1_enabled = tls1_enabled_.GetValue();
207 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableSSL3);
208 config->tls1_enabled =
209 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableTLS1);
210
211 config->disabled_cipher_suites = disabled_cipher_suites_; 213 config->disabled_cipher_suites = disabled_cipher_suites_;
212 SSLConfigServicePref::SetSSLConfigFlags(config); 214 SSLConfigServicePref::SetSSLConfigFlags(config);
213 } 215 }
214 216
215 void SSLConfigServiceManagerPref::OnDisabledCipherSuitesChange( 217 void SSLConfigServiceManagerPref::OnDisabledCipherSuitesChange(
216 PrefService* prefs) { 218 PrefService* prefs) {
217 const ListValue* value = prefs->GetList(prefs::kCipherSuiteBlacklist); 219 const ListValue* value = prefs->GetList(prefs::kCipherSuiteBlacklist);
218 disabled_cipher_suites_ = ParseCipherSuites(ListValueToStringVector(value)); 220 disabled_cipher_suites_ = ParseCipherSuites(ListValueToStringVector(value));
219 } 221 }
220 222
221 //////////////////////////////////////////////////////////////////////////////// 223 ////////////////////////////////////////////////////////////////////////////////
222 // SSLConfigServiceManager 224 // SSLConfigServiceManager
223 225
224 // static 226 // static
225 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( 227 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager(
226 PrefService* local_state) { 228 PrefService* local_state) {
227 return new SSLConfigServiceManagerPref(local_state); 229 return new SSLConfigServiceManagerPref(local_state);
228 } 230 }
229 231
230 // static 232 // static
231 void SSLConfigServiceManager::RegisterPrefs(PrefService* prefs) { 233 void SSLConfigServiceManager::RegisterPrefs(PrefService* prefs) {
232 SSLConfigServiceManagerPref::RegisterPrefs(prefs); 234 SSLConfigServiceManagerPref::RegisterPrefs(prefs);
233 } 235 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/prefs/command_line_pref_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698