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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // SSLConfigServicePref | 102 // SSLConfigServicePref |
103 | 103 |
104 // An SSLConfigService which stores a cached version of the current SSLConfig | 104 // An SSLConfigService which stores a cached version of the current SSLConfig |
105 // prefs, which are updated by SSLConfigServiceManagerPref when the prefs | 105 // prefs, which are updated by SSLConfigServiceManagerPref when the prefs |
106 // change. | 106 // change. |
107 class SSLConfigServicePref : public net::SSLConfigService { | 107 class SSLConfigServicePref : public net::SSLConfigService { |
108 public: | 108 public: |
109 SSLConfigServicePref() {} | 109 SSLConfigServicePref() {} |
110 | 110 |
111 // Store SSL config settings in |config|. Must only be called from IO thread. | 111 // Store SSL config settings in |config|. Must only be called from IO thread. |
112 virtual void GetSSLConfig(net::SSLConfig* config); | 112 virtual void GetSSLConfig(net::SSLConfig* config) OVERRIDE; |
113 | 113 |
114 private: | 114 private: |
115 // Allow the pref watcher to update our internal state. | 115 // Allow the pref watcher to update our internal state. |
116 friend class SSLConfigServiceManagerPref; | 116 friend class SSLConfigServiceManagerPref; |
117 | 117 |
118 virtual ~SSLConfigServicePref() {} | 118 virtual ~SSLConfigServicePref() {} |
119 | 119 |
120 // This method is posted to the IO thread from the browser thread to carry the | 120 // This method is posted to the IO thread from the browser thread to carry the |
121 // new config information. | 121 // new config information. |
122 void SetNewSSLConfig(const net::SSLConfig& new_config); | 122 void SetNewSSLConfig(const net::SSLConfig& new_config); |
(...skipping 22 matching lines...) Expand all Loading... |
145 class SSLConfigServiceManagerPref | 145 class SSLConfigServiceManagerPref |
146 : public SSLConfigServiceManager { | 146 : public SSLConfigServiceManager { |
147 public: | 147 public: |
148 SSLConfigServiceManagerPref(PrefService* local_state, | 148 SSLConfigServiceManagerPref(PrefService* local_state, |
149 PrefService* user_prefs); | 149 PrefService* user_prefs); |
150 virtual ~SSLConfigServiceManagerPref() {} | 150 virtual ~SSLConfigServiceManagerPref() {} |
151 | 151 |
152 // Register local_state SSL preferences. | 152 // Register local_state SSL preferences. |
153 static void RegisterPrefs(PrefRegistrySimple* registry); | 153 static void RegisterPrefs(PrefRegistrySimple* registry); |
154 | 154 |
155 virtual net::SSLConfigService* Get(); | 155 virtual net::SSLConfigService* Get() OVERRIDE; |
156 | 156 |
157 private: | 157 private: |
158 // 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 |
159 // thread with SetNewSSLConfig. | 159 // thread with SetNewSSLConfig. |
160 void OnPreferenceChanged(PrefServiceBase* prefs, | 160 void OnPreferenceChanged(PrefServiceBase* prefs, |
161 const std::string& pref_name); | 161 const std::string& pref_name); |
162 | 162 |
163 // Store SSL config settings in |config|, directly from the preferences. Must | 163 // Store SSL config settings in |config|, directly from the preferences. Must |
164 // only be called from UI thread. | 164 // only be called from UI thread. |
165 void GetSSLConfigFromPrefs(net::SSLConfig* config); | 165 void GetSSLConfigFromPrefs(net::SSLConfig* config); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // static | 349 // static |
350 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( | 350 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( |
351 PrefService* local_state, PrefService* user_prefs) { | 351 PrefService* local_state, PrefService* user_prefs) { |
352 return new SSLConfigServiceManagerPref(local_state, user_prefs); | 352 return new SSLConfigServiceManagerPref(local_state, user_prefs); |
353 } | 353 } |
354 | 354 |
355 // static | 355 // static |
356 void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* registry) { | 356 void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* registry) { |
357 SSLConfigServiceManagerPref::RegisterPrefs(registry); | 357 SSLConfigServiceManagerPref::RegisterPrefs(registry); |
358 } | 358 } |
OLD | NEW |