| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 4 |
| 5 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "base/thread.h" | 6 #include "base/thread.h" |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/io_thread.h" | 8 #include "chrome/browser/io_thread.h" |
| 9 #include "chrome/browser/net/ssl_config_service_manager.h" | 9 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 10 #include "chrome/browser/prefs/pref_member.h" | 10 #include "chrome/browser/prefs/pref_member.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 tls1_enabled_.Init(prefs::kTLS1Enabled, profile->GetPrefs(), this); | 101 tls1_enabled_.Init(prefs::kTLS1Enabled, profile->GetPrefs(), this); |
| 102 | 102 |
| 103 // Initialize from UI thread. This is okay as there shouldn't be anything on | 103 // Initialize from UI thread. This is okay as there shouldn't be anything on |
| 104 // the IO thread trying to access it yet. | 104 // the IO thread trying to access it yet. |
| 105 GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_); | 105 GetSSLConfigFromPrefs(&ssl_config_service_->cached_config_); |
| 106 } | 106 } |
| 107 | 107 |
| 108 // static | 108 // static |
| 109 void SSLConfigServiceManagerPref::RegisterUserPrefs(PrefService* user_prefs) { | 109 void SSLConfigServiceManagerPref::RegisterUserPrefs(PrefService* user_prefs) { |
| 110 net::SSLConfig default_config; | 110 net::SSLConfig default_config; |
| 111 user_prefs->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled, | 111 // We must check with FindPreference as an OffTheRecordProfileImpl |
| 112 default_config.rev_checking_enabled); | 112 // may already have these preferences registered by its parent |
| 113 user_prefs->RegisterBooleanPref(prefs::kSSL3Enabled, | 113 // profile. |
| 114 default_config.ssl3_enabled); | 114 if (!user_prefs->FindPreference(prefs::kCertRevocationCheckingEnabled)) |
| 115 user_prefs->RegisterBooleanPref(prefs::kTLS1Enabled, | 115 user_prefs->RegisterBooleanPref(prefs::kCertRevocationCheckingEnabled, |
| 116 default_config.tls1_enabled); | 116 default_config.rev_checking_enabled); |
| 117 if (!user_prefs->FindPreference(prefs::kSSL3Enabled)) |
| 118 user_prefs->RegisterBooleanPref(prefs::kSSL3Enabled, |
| 119 default_config.ssl3_enabled); |
| 120 if (!user_prefs->FindPreference(prefs::kTLS1Enabled)) |
| 121 user_prefs->RegisterBooleanPref(prefs::kTLS1Enabled, |
| 122 default_config.tls1_enabled); |
| 117 } | 123 } |
| 118 | 124 |
| 119 net::SSLConfigService* SSLConfigServiceManagerPref::Get() { | 125 net::SSLConfigService* SSLConfigServiceManagerPref::Get() { |
| 120 return ssl_config_service_; | 126 return ssl_config_service_; |
| 121 } | 127 } |
| 122 | 128 |
| 123 void SSLConfigServiceManagerPref::Observe(NotificationType type, | 129 void SSLConfigServiceManagerPref::Observe(NotificationType type, |
| 124 const NotificationSource& source, | 130 const NotificationSource& source, |
| 125 const NotificationDetails& details) { | 131 const NotificationDetails& details) { |
| 126 base::Thread* io_thread = g_browser_process->io_thread(); | 132 base::Thread* io_thread = g_browser_process->io_thread(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 137 &SSLConfigServicePref::SetNewSSLConfig, | 143 &SSLConfigServicePref::SetNewSSLConfig, |
| 138 new_config)); | 144 new_config)); |
| 139 } | 145 } |
| 140 } | 146 } |
| 141 | 147 |
| 142 void SSLConfigServiceManagerPref::GetSSLConfigFromPrefs( | 148 void SSLConfigServiceManagerPref::GetSSLConfigFromPrefs( |
| 143 net::SSLConfig* config) { | 149 net::SSLConfig* config) { |
| 144 config->rev_checking_enabled = rev_checking_enabled_.GetValue(); | 150 config->rev_checking_enabled = rev_checking_enabled_.GetValue(); |
| 145 config->ssl3_enabled = ssl3_enabled_.GetValue(); | 151 config->ssl3_enabled = ssl3_enabled_.GetValue(); |
| 146 config->tls1_enabled = tls1_enabled_.GetValue(); | 152 config->tls1_enabled = tls1_enabled_.GetValue(); |
| 147 SSLConfigServicePref::SetSSLConfigFlags(config); | 153 ssl_config_service_->SetSSLConfigFlags(config); |
| 148 } | 154 } |
| 149 | 155 |
| 150 //////////////////////////////////////////////////////////////////////////////// | 156 //////////////////////////////////////////////////////////////////////////////// |
| 151 // SSLConfigServiceManager | 157 // SSLConfigServiceManager |
| 152 | 158 |
| 153 // static | 159 // static |
| 154 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( | 160 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( |
| 155 Profile* profile) { | 161 Profile* profile) { |
| 156 return new SSLConfigServiceManagerPref(profile); | 162 return new SSLConfigServiceManagerPref(profile); |
| 157 } | 163 } |
| OLD | NEW |