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) OVERRIDE; | 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 21 matching lines...) Expand all Loading... |
144 // The manager for holding and updating an SSLConfigServicePref instance. | 144 // The manager for holding and updating an SSLConfigServicePref instance. |
145 class SSLConfigServiceManagerPref | 145 class SSLConfigServiceManagerPref |
146 : public SSLConfigServiceManager { | 146 : public SSLConfigServiceManager { |
147 public: | 147 public: |
148 explicit SSLConfigServiceManagerPref(PrefService* local_state); | 148 explicit SSLConfigServiceManagerPref(PrefService* local_state); |
149 virtual ~SSLConfigServiceManagerPref() {} | 149 virtual ~SSLConfigServiceManagerPref() {} |
150 | 150 |
151 // Register local_state SSL preferences. | 151 // Register local_state SSL preferences. |
152 static void RegisterPrefs(PrefRegistrySimple* registry); | 152 static void RegisterPrefs(PrefRegistrySimple* registry); |
153 | 153 |
154 virtual net::SSLConfigService* Get() OVERRIDE; | 154 virtual net::SSLConfigService* Get() override; |
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(PrefService* prefs, | 159 void OnPreferenceChanged(PrefService* 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 |
163 // only be called from UI thread. | 163 // only be called from UI thread. |
164 void GetSSLConfigFromPrefs(net::SSLConfig* config); | 164 void GetSSLConfigFromPrefs(net::SSLConfig* config); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // static | 311 // static |
312 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( | 312 SSLConfigServiceManager* SSLConfigServiceManager::CreateDefaultManager( |
313 PrefService* local_state) { | 313 PrefService* local_state) { |
314 return new SSLConfigServiceManagerPref(local_state); | 314 return new SSLConfigServiceManagerPref(local_state); |
315 } | 315 } |
316 | 316 |
317 // static | 317 // static |
318 void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* registry) { | 318 void SSLConfigServiceManager::RegisterPrefs(PrefRegistrySimple* registry) { |
319 SSLConfigServiceManagerPref::RegisterPrefs(registry); | 319 SSLConfigServiceManagerPref::RegisterPrefs(registry); |
320 } | 320 } |
OLD | NEW |