OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 // The manager for holding and updating an SSLConfigServicePref instance. | 143 // The manager for holding and updating an SSLConfigServicePref instance. |
144 class SSLConfigServiceManagerPref | 144 class SSLConfigServiceManagerPref |
145 : public SSLConfigServiceManager { | 145 : public SSLConfigServiceManager { |
146 public: | 146 public: |
147 SSLConfigServiceManagerPref(PrefService* local_state, | 147 SSLConfigServiceManagerPref(PrefService* local_state, |
148 PrefService* user_prefs); | 148 PrefService* user_prefs); |
149 virtual ~SSLConfigServiceManagerPref() {} | 149 virtual ~SSLConfigServiceManagerPref() {} |
150 | 150 |
151 // Register local_state SSL preferences. | 151 // Register local_state SSL preferences. |
152 static void RegisterPrefs(PrefService* local_state); | 152 static void RegisterPrefs(PrefServiceSimple* local_state); |
153 | 153 |
154 virtual net::SSLConfigService* Get(); | 154 virtual net::SSLConfigService* Get(); |
155 | 155 |
156 private: | 156 private: |
157 // Callback for preference changes. This will post the changes to the IO | 157 // Callback for preference changes. This will post the changes to the IO |
158 // thread with SetNewSSLConfig. | 158 // thread with SetNewSSLConfig. |
159 void OnPreferenceChanged(PrefServiceBase* prefs, | 159 void OnPreferenceChanged(PrefServiceBase* prefs, |
160 const std::string& pref_name); | 160 const std::string& pref_name); |
161 | 161 |
162 // Store SSL config settings in |config|, directly from the preferences. Must | 162 // Store SSL config settings in |config|, directly from the preferences. Must |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 238 |
239 OnDefaultContentSettingsChange(user_prefs); | 239 OnDefaultContentSettingsChange(user_prefs); |
240 } | 240 } |
241 | 241 |
242 // Initialize from UI thread. This is okay as there shouldn't be anything on | 242 // Initialize from UI thread. This is okay as there shouldn't be anything on |
243 // the IO thread trying to access it yet. | 243 // the IO thread trying to access it yet. |
244 GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_); | 244 GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_); |
245 } | 245 } |
246 | 246 |
247 // static | 247 // static |
248 void SSLConfigServiceManagerPref::RegisterPrefs(PrefService* local_state) { | 248 void SSLConfigServiceManagerPref::RegisterPrefs( |
| 249 PrefServiceSimple* local_state) { |
249 net::SSLConfig default_config; | 250 net::SSLConfig default_config; |
250 local_state->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled, | 251 local_state->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled, |
251 default_config.rev_checking_enabled); | 252 default_config.rev_checking_enabled); |
252 std::string version_min_str = | 253 std::string version_min_str = |
253 SSLProtocolVersionToString(default_config.version_min); | 254 SSLProtocolVersionToString(default_config.version_min); |
254 std::string version_max_str = | 255 std::string version_max_str = |
255 SSLProtocolVersionToString(default_config.version_max); | 256 SSLProtocolVersionToString(default_config.version_max); |
256 local_state->RegisterStringPref(prefs::kSSLVersionMin, version_min_str); | 257 local_state->RegisterStringPref(prefs::kSSLVersionMin, version_min_str); |
257 local_state->RegisterStringPref(prefs::kSSLVersionMax, version_max_str); | 258 local_state->RegisterStringPref(prefs::kSSLVersionMax, version_max_str); |
258 local_state->RegisterBooleanPref(prefs::kEnableOriginBoundCerts, | 259 local_state->RegisterBooleanPref(prefs::kEnableOriginBoundCerts, |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 //////////////////////////////////////////////////////////////////////////////// | 346 //////////////////////////////////////////////////////////////////////////////// |
346 // SSLConfigServiceManager | 347 // SSLConfigServiceManager |
347 | 348 |
348 // static | 349 // static |
349 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( | 350 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( |
350 PrefService* local_state, PrefService* user_prefs) { | 351 PrefService* local_state, PrefService* user_prefs) { |
351 return new SSLConfigServiceManagerPref(local_state, user_prefs); | 352 return new SSLConfigServiceManagerPref(local_state, user_prefs); |
352 } | 353 } |
353 | 354 |
354 // static | 355 // static |
355 void SSLConfigServiceManager::RegisterPrefs(PrefService* prefs) { | 356 void SSLConfigServiceManager::RegisterPrefs(PrefServiceSimple* prefs) { |
356 SSLConfigServiceManagerPref::RegisterPrefs(prefs); | 357 SSLConfigServiceManagerPref::RegisterPrefs(prefs); |
357 } | 358 } |
OLD | NEW |