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

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

Issue 11741003: Remove PrefServiceSimple, replacing it with PrefService and PrefRegistrySimple. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 7 years, 10 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
OLDNEW
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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/prefs/public/pref_change_registrar.h" 12 #include "base/prefs/public/pref_change_registrar.h"
13 #include "base/prefs/public/pref_member.h" 13 #include "base/prefs/public/pref_member.h"
14 #include "chrome/browser/content_settings/content_settings_utils.h" 14 #include "chrome/browser/content_settings/content_settings_utils.h"
15 #include "chrome/browser/prefs/pref_registry_simple.h"
15 #include "chrome/browser/prefs/pref_service.h" 16 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/content_settings.h" 18 #include "chrome/common/content_settings.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
20 #include "net/base/ssl_cipher_suite_names.h" 21 #include "net/base/ssl_cipher_suite_names.h"
21 #include "net/base/ssl_config_service.h" 22 #include "net/base/ssl_config_service.h"
22 23
23 using content::BrowserThread; 24 using content::BrowserThread;
24 25
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 // The manager for holding and updating an SSLConfigServicePref instance. 144 // The manager for holding and updating an SSLConfigServicePref instance.
144 class SSLConfigServiceManagerPref 145 class SSLConfigServiceManagerPref
145 : public SSLConfigServiceManager { 146 : public SSLConfigServiceManager {
146 public: 147 public:
147 SSLConfigServiceManagerPref(PrefService* local_state, 148 SSLConfigServiceManagerPref(PrefService* local_state,
148 PrefService* user_prefs); 149 PrefService* user_prefs);
149 virtual ~SSLConfigServiceManagerPref() {} 150 virtual ~SSLConfigServiceManagerPref() {}
150 151
151 // Register local_state SSL preferences. 152 // Register local_state SSL preferences.
152 static void RegisterPrefs(PrefServiceSimple* local_state); 153 static void RegisterPrefs(PrefRegistrySimple* local_state);
153 154
154 virtual net::SSLConfigService* Get(); 155 virtual net::SSLConfigService* Get();
155 156
156 private: 157 private:
157 // Callback for preference changes. This will post the changes to the IO 158 // Callback for preference changes. This will post the changes to the IO
158 // thread with SetNewSSLConfig. 159 // thread with SetNewSSLConfig.
159 void OnPreferenceChanged(PrefServiceBase* prefs, 160 void OnPreferenceChanged(PrefServiceBase* prefs,
160 const std::string& pref_name); 161 const std::string& pref_name);
161 162
162 // Store SSL config settings in |config|, directly from the preferences. Must 163 // Store SSL config settings in |config|, directly from the preferences. Must
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 OnDefaultContentSettingsChange(user_prefs); 240 OnDefaultContentSettingsChange(user_prefs);
240 } 241 }
241 242
242 // Initialize from UI thread. This is okay as there shouldn't be anything on 243 // Initialize from UI thread. This is okay as there shouldn't be anything on
243 // the IO thread trying to access it yet. 244 // the IO thread trying to access it yet.
244 GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_); 245 GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_);
245 } 246 }
246 247
247 // static 248 // static
248 void SSLConfigServiceManagerPref::RegisterPrefs( 249 void SSLConfigServiceManagerPref::RegisterPrefs(
249 PrefServiceSimple* local_state) { 250 PrefRegistrySimple* local_state) {
250 net::SSLConfig default_config; 251 net::SSLConfig default_config;
251 local_state->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled, 252 local_state->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled,
252 default_config.rev_checking_enabled); 253 default_config.rev_checking_enabled);
253 std::string version_min_str = 254 std::string version_min_str =
254 SSLProtocolVersionToString(default_config.version_min); 255 SSLProtocolVersionToString(default_config.version_min);
255 std::string version_max_str = 256 std::string version_max_str =
256 SSLProtocolVersionToString(default_config.version_max); 257 SSLProtocolVersionToString(default_config.version_max);
257 local_state->RegisterStringPref(prefs::kSSLVersionMin, version_min_str); 258 local_state->RegisterStringPref(prefs::kSSLVersionMin, version_min_str);
258 local_state->RegisterStringPref(prefs::kSSLVersionMax, version_max_str); 259 local_state->RegisterStringPref(prefs::kSSLVersionMax, version_max_str);
259 local_state->RegisterBooleanPref(prefs::kEnableOriginBoundCerts, 260 local_state->RegisterBooleanPref(prefs::kEnableOriginBoundCerts,
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 //////////////////////////////////////////////////////////////////////////////// 347 ////////////////////////////////////////////////////////////////////////////////
347 // SSLConfigServiceManager 348 // SSLConfigServiceManager
348 349
349 // static 350 // static
350 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( 351 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager(
351 PrefService* local_state, PrefService* user_prefs) { 352 PrefService* local_state, PrefService* user_prefs) {
352 return new SSLConfigServiceManagerPref(local_state, user_prefs); 353 return new SSLConfigServiceManagerPref(local_state, user_prefs);
353 } 354 }
354 355
355 // static 356 // static
356 void SSLConfigServiceManager::RegisterPrefs(PrefServiceSimple* prefs) { 357 void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* prefs) {
357 SSLConfigServiceManagerPref::RegisterPrefs(prefs); 358 SSLConfigServiceManagerPref::RegisterPrefs(prefs);
358 } 359 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698