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

Side by Side Diff: net/base/ssl_config_service.cc

Issue 10753022: TLS channel id field trial. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« no previous file with comments | « net/base/ssl_config_service.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 #include "net/base/ssl_config_service.h" 5 #include "net/base/ssl_config_service.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/synchronization/lock.h" 9 #include "base/synchronization/lock.h"
10 #include "net/base/crl_set.h" 10 #include "net/base/crl_set.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 } 67 }
68 } 68 }
69 return false; 69 return false;
70 } 70 }
71 71
72 SSLConfigService::SSLConfigService() 72 SSLConfigService::SSLConfigService()
73 : observer_list_(ObserverList<Observer>::NOTIFY_EXISTING_ONLY) { 73 : observer_list_(ObserverList<Observer>::NOTIFY_EXISTING_ONLY) {
74 } 74 }
75 75
76 static bool g_cached_info_enabled = false; 76 static bool g_cached_info_enabled = false;
77 static bool g_channel_id_trial = false;
77 78
78 // GlobalCRLSet holds a reference to the global CRLSet. It simply wraps a lock 79 // GlobalCRLSet holds a reference to the global CRLSet. It simply wraps a lock
79 // around a scoped_refptr so that getting a reference doesn't race with 80 // around a scoped_refptr so that getting a reference doesn't race with
80 // updating the CRLSet. 81 // updating the CRLSet.
81 class GlobalCRLSet { 82 class GlobalCRLSet {
82 public: 83 public:
83 void Set(const scoped_refptr<CRLSet>& new_crl_set) { 84 void Set(const scoped_refptr<CRLSet>& new_crl_set) {
84 base::AutoLock locked(lock_); 85 base::AutoLock locked(lock_);
85 crl_set_ = new_crl_set; 86 crl_set_ = new_crl_set;
86 } 87 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // static 126 // static
126 void SSLConfigService::SetDefaultVersionMax(uint16 version_max) { 127 void SSLConfigService::SetDefaultVersionMax(uint16 version_max) {
127 g_default_version_max = version_max; 128 g_default_version_max = version_max;
128 } 129 }
129 130
130 // static 131 // static
131 uint16 SSLConfigService::default_version_max() { 132 uint16 SSLConfigService::default_version_max() {
132 return g_default_version_max; 133 return g_default_version_max;
133 } 134 }
134 135
136 // static
137 void SSLConfigService::EnableChannelIDTrial() {
138 g_channel_id_trial = true;
139 }
140
135 void SSLConfigService::AddObserver(Observer* observer) { 141 void SSLConfigService::AddObserver(Observer* observer) {
136 observer_list_.AddObserver(observer); 142 observer_list_.AddObserver(observer);
137 } 143 }
138 144
139 void SSLConfigService::RemoveObserver(Observer* observer) { 145 void SSLConfigService::RemoveObserver(Observer* observer) {
140 observer_list_.RemoveObserver(observer); 146 observer_list_.RemoveObserver(observer);
141 } 147 }
142 148
143 SSLConfigService::~SSLConfigService() { 149 SSLConfigService::~SSLConfigService() {
144 } 150 }
145 151
146 // static 152 // static
147 void SSLConfigService::SetSSLConfigFlags(SSLConfig* ssl_config) { 153 void SSLConfigService::SetSSLConfigFlags(SSLConfig* ssl_config) {
148 ssl_config->cached_info_enabled = g_cached_info_enabled; 154 ssl_config->cached_info_enabled = g_cached_info_enabled;
155 if (g_channel_id_trial)
156 ssl_config->channel_id_enabled = true;
149 } 157 }
150 158
151 void SSLConfigService::ProcessConfigUpdate(const SSLConfig& orig_config, 159 void SSLConfigService::ProcessConfigUpdate(const SSLConfig& orig_config,
152 const SSLConfig& new_config) { 160 const SSLConfig& new_config) {
153 bool config_changed = 161 bool config_changed =
154 (orig_config.rev_checking_enabled != new_config.rev_checking_enabled) || 162 (orig_config.rev_checking_enabled != new_config.rev_checking_enabled) ||
155 (orig_config.version_min != new_config.version_min) || 163 (orig_config.version_min != new_config.version_min) ||
156 (orig_config.version_max != new_config.version_max) || 164 (orig_config.version_max != new_config.version_max) ||
157 (orig_config.disabled_cipher_suites != 165 (orig_config.disabled_cipher_suites !=
158 new_config.disabled_cipher_suites) || 166 new_config.disabled_cipher_suites) ||
159 (orig_config.channel_id_enabled != new_config.channel_id_enabled) || 167 (orig_config.channel_id_enabled != new_config.channel_id_enabled) ||
160 (orig_config.false_start_enabled != new_config.false_start_enabled); 168 (orig_config.false_start_enabled != new_config.false_start_enabled);
161 169
162 if (config_changed) 170 if (config_changed)
163 FOR_EACH_OBSERVER(Observer, observer_list_, OnSSLConfigChanged()); 171 FOR_EACH_OBSERVER(Observer, observer_list_, OnSSLConfigChanged());
164 } 172 }
165 173
166 // static 174 // static
167 bool SSLConfigService::IsSNIAvailable(SSLConfigService* service) { 175 bool SSLConfigService::IsSNIAvailable(SSLConfigService* service) {
168 if (!service) 176 if (!service)
169 return false; 177 return false;
170 178
171 SSLConfig ssl_config; 179 SSLConfig ssl_config;
172 service->GetSSLConfig(&ssl_config); 180 service->GetSSLConfig(&ssl_config);
173 return ssl_config.version_max >= SSL_PROTOCOL_VERSION_TLS1; 181 return ssl_config.version_max >= SSL_PROTOCOL_VERSION_TLS1;
174 } 182 }
175 183
176 } // namespace net 184 } // namespace net
OLDNEW
« no previous file with comments | « net/base/ssl_config_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698