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" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.h" |
13 #include "base/prefs/pref_member.h" | 13 #include "base/prefs/pref_member.h" |
14 #include "base/prefs/pref_registry_simple.h" | 14 #include "base/prefs/pref_registry_simple.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
17 #include "chrome/browser/content_settings/content_settings_utils.h" | 17 #include "chrome/browser/content_settings/content_settings_utils.h" |
18 #include "chrome/common/content_settings.h" | 18 #include "chrome/common/content_settings.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "net/ssl/ssl_cipher_suite_names.h" | 21 #include "net/ssl/ssl_cipher_suite_names.h" |
22 #include "net/ssl/ssl_config_service.h" | 22 #include "net/ssl/ssl_config_service.h" |
23 | 23 |
24 using content::BrowserThread; | 24 using content::BrowserThread; |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 // Converts a ListValue of StringValues into a vector of strings. Any Values | 28 // Converts a ListValue of StringValues into a vector of strings. Any Values |
29 // which cannot be converted will be skipped. | 29 // which cannot be converted will be skipped. |
30 std::vector<std::string> ListValueToStringVector(const ListValue* value) { | 30 std::vector<std::string> ListValueToStringVector(const base::ListValue* value) { |
31 std::vector<std::string> results; | 31 std::vector<std::string> results; |
32 results.reserve(value->GetSize()); | 32 results.reserve(value->GetSize()); |
33 std::string s; | 33 std::string s; |
34 for (ListValue::const_iterator it = value->begin(); it != value->end(); | 34 for (base::ListValue::const_iterator it = value->begin(); it != value->end(); |
35 ++it) { | 35 ++it) { |
36 if (!(*it)->GetAsString(&s)) | 36 if (!(*it)->GetAsString(&s)) |
37 continue; | 37 continue; |
38 results.push_back(s); | 38 results.push_back(s); |
39 } | 39 } |
40 return results; | 40 return results; |
41 } | 41 } |
42 | 42 |
43 // Parses a vector of cipher suite strings, returning a sorted vector | 43 // Parses a vector of cipher suite strings, returning a sorted vector |
44 // containing the underlying SSL/TLS cipher suites. Unrecognized/invalid | 44 // containing the underlying SSL/TLS cipher suites. Unrecognized/invalid |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 config->channel_id_enabled = channel_id_enabled_.GetValue(); | 304 config->channel_id_enabled = channel_id_enabled_.GetValue(); |
305 // disabling False Start also happens to disable record splitting. | 305 // disabling False Start also happens to disable record splitting. |
306 config->false_start_enabled = !ssl_record_splitting_disabled_.GetValue(); | 306 config->false_start_enabled = !ssl_record_splitting_disabled_.GetValue(); |
307 config->unrestricted_ssl3_fallback_enabled = | 307 config->unrestricted_ssl3_fallback_enabled = |
308 unrestricted_ssl3_fallback_enabled_.GetValue(); | 308 unrestricted_ssl3_fallback_enabled_.GetValue(); |
309 SSLConfigServicePref::SetSSLConfigFlags(config); | 309 SSLConfigServicePref::SetSSLConfigFlags(config); |
310 } | 310 } |
311 | 311 |
312 void SSLConfigServiceManagerPref::OnDisabledCipherSuitesChange( | 312 void SSLConfigServiceManagerPref::OnDisabledCipherSuitesChange( |
313 PrefService* local_state) { | 313 PrefService* local_state) { |
314 const ListValue* value = local_state->GetList(prefs::kCipherSuiteBlacklist); | 314 const base::ListValue* value = |
| 315 local_state->GetList(prefs::kCipherSuiteBlacklist); |
315 disabled_cipher_suites_ = ParseCipherSuites(ListValueToStringVector(value)); | 316 disabled_cipher_suites_ = ParseCipherSuites(ListValueToStringVector(value)); |
316 } | 317 } |
317 | 318 |
318 //////////////////////////////////////////////////////////////////////////////// | 319 //////////////////////////////////////////////////////////////////////////////// |
319 // SSLConfigServiceManager | 320 // SSLConfigServiceManager |
320 | 321 |
321 // static | 322 // static |
322 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( | 323 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( |
323 PrefService* local_state) { | 324 PrefService* local_state) { |
324 return new SSLConfigServiceManagerPref(local_state); | 325 return new SSLConfigServiceManagerPref(local_state); |
325 } | 326 } |
326 | 327 |
327 // static | 328 // static |
328 void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* registry) { | 329 void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* registry) { |
329 SSLConfigServiceManagerPref::RegisterPrefs(registry); | 330 SSLConfigServiceManagerPref::RegisterPrefs(registry); |
330 } | 331 } |
OLD | NEW |