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

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

Issue 4431001: Revert 64960 - Turn on file access checks on Win.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 | « chrome/common/chrome_version_info.cc ('k') | net/proxy/proxy_config_service_win.cc » ('j') | 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) 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 "net/base/ssl_config_service_win.h" 5 #include "net/base/ssl_config_service_win.h"
6 6
7 #include "base/thread_restrictions.h"
8 #include "base/win/registry.h" 7 #include "base/win/registry.h"
9 8
10 using base::TimeDelta; 9 using base::TimeDelta;
11 using base::TimeTicks; 10 using base::TimeTicks;
12 using base::win::RegKey; 11 using base::win::RegKey;
13 12
14 namespace net { 13 namespace net {
15 14
16 static const int kConfigUpdateInterval = 10; // seconds 15 static const int kConfigUpdateInterval = 10; // seconds
17 16
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 52
54 void SSLConfigServiceWin::GetSSLConfigAt(SSLConfig* config, TimeTicks now) { 53 void SSLConfigServiceWin::GetSSLConfigAt(SSLConfig* config, TimeTicks now) {
55 if (!ever_updated_ || 54 if (!ever_updated_ ||
56 now - config_time_ > TimeDelta::FromSeconds(kConfigUpdateInterval)) 55 now - config_time_ > TimeDelta::FromSeconds(kConfigUpdateInterval))
57 UpdateConfig(now); 56 UpdateConfig(now);
58 *config = config_info_; 57 *config = config_info_;
59 } 58 }
60 59
61 // static 60 // static
62 bool SSLConfigServiceWin::GetSSLConfigNow(SSLConfig* config) { 61 bool SSLConfigServiceWin::GetSSLConfigNow(SSLConfig* config) {
63 // This registry access goes to disk and will slow down the IO thread.
64 // http://crbug.com/61455
65 base::ThreadRestrictions::ScopedAllowIO allow_io;
66 RegKey internet_settings; 62 RegKey internet_settings;
67 if (!internet_settings.Open(HKEY_CURRENT_USER, kInternetSettingsSubKeyName, 63 if (!internet_settings.Open(HKEY_CURRENT_USER, kInternetSettingsSubKeyName,
68 KEY_READ)) 64 KEY_READ))
69 return false; 65 return false;
70 66
71 DWORD revocation; 67 DWORD revocation;
72 if (!internet_settings.ReadValueDW(kRevocationValueName, &revocation)) 68 if (!internet_settings.ReadValueDW(kRevocationValueName, &revocation))
73 revocation = REVOCATION_DEFAULT; 69 revocation = REVOCATION_DEFAULT;
74 70
75 DWORD protocols; 71 DWORD protocols;
76 if (!internet_settings.ReadValueDW(kProtocolsValueName, &protocols)) 72 if (!internet_settings.ReadValueDW(kProtocolsValueName, &protocols))
77 protocols = PROTOCOLS_DEFAULT; 73 protocols = PROTOCOLS_DEFAULT;
78 74
79 config->rev_checking_enabled = (revocation != 0); 75 config->rev_checking_enabled = (revocation != 0);
80 config->ssl2_enabled = ((protocols & SSL2) != 0); 76 config->ssl2_enabled = ((protocols & SSL2) != 0);
81 config->ssl3_enabled = ((protocols & SSL3) != 0); 77 config->ssl3_enabled = ((protocols & SSL3) != 0);
82 config->tls1_enabled = ((protocols & TLS1) != 0); 78 config->tls1_enabled = ((protocols & TLS1) != 0);
83 SSLConfigService::SetSSLConfigFlags(config); 79 SSLConfigService::SetSSLConfigFlags(config);
84 80
85 return true; 81 return true;
86 } 82 }
87 83
88 // static 84 // static
89 void SSLConfigServiceWin::SetRevCheckingEnabled(bool enabled) { 85 void SSLConfigServiceWin::SetRevCheckingEnabled(bool enabled) {
90 // This registry access goes to disk and will slow down the IO thread.
91 // http://crbug.com/61455
92 DWORD value = enabled; 86 DWORD value = enabled;
93 RegKey internet_settings(HKEY_CURRENT_USER, kInternetSettingsSubKeyName, 87 RegKey internet_settings(HKEY_CURRENT_USER, kInternetSettingsSubKeyName,
94 KEY_WRITE); 88 KEY_WRITE);
95 internet_settings.WriteValue(kRevocationValueName, value); 89 internet_settings.WriteValue(kRevocationValueName, value);
96 // TODO(mattm): We should call UpdateConfig after updating settings, but these 90 // TODO(mattm): We should call UpdateConfig after updating settings, but these
97 // methods are static. 91 // methods are static.
98 } 92 }
99 93
100 // static 94 // static
101 void SSLConfigServiceWin::SetSSL2Enabled(bool enabled) { 95 void SSLConfigServiceWin::SetSSL2Enabled(bool enabled) {
102 SetSSLVersionEnabled(SSL2, enabled); 96 SetSSLVersionEnabled(SSL2, enabled);
103 } 97 }
104 98
105 // static 99 // static
106 void SSLConfigServiceWin::SetSSL3Enabled(bool enabled) { 100 void SSLConfigServiceWin::SetSSL3Enabled(bool enabled) {
107 SetSSLVersionEnabled(SSL3, enabled); 101 SetSSLVersionEnabled(SSL3, enabled);
108 } 102 }
109 103
110 // static 104 // static
111 void SSLConfigServiceWin::SetTLS1Enabled(bool enabled) { 105 void SSLConfigServiceWin::SetTLS1Enabled(bool enabled) {
112 SetSSLVersionEnabled(TLS1, enabled); 106 SetSSLVersionEnabled(TLS1, enabled);
113 } 107 }
114 108
115 // static 109 // static
116 void SSLConfigServiceWin::SetSSLVersionEnabled(int version, bool enabled) { 110 void SSLConfigServiceWin::SetSSLVersionEnabled(int version, bool enabled) {
117 // This registry access goes to disk and will slow down the IO thread.
118 // http://crbug.com/61455
119 RegKey internet_settings(HKEY_CURRENT_USER, kInternetSettingsSubKeyName, 111 RegKey internet_settings(HKEY_CURRENT_USER, kInternetSettingsSubKeyName,
120 KEY_READ | KEY_WRITE); 112 KEY_READ | KEY_WRITE);
121 DWORD value; 113 DWORD value;
122 if (!internet_settings.ReadValueDW(kProtocolsValueName, &value)) 114 if (!internet_settings.ReadValueDW(kProtocolsValueName, &value))
123 value = PROTOCOLS_DEFAULT; 115 value = PROTOCOLS_DEFAULT;
124 if (enabled) 116 if (enabled)
125 value |= version; 117 value |= version;
126 else 118 else
127 value &= ~version; 119 value &= ~version;
128 internet_settings.WriteValue(kProtocolsValueName, value); 120 internet_settings.WriteValue(kProtocolsValueName, value);
129 // TODO(mattm): We should call UpdateConfig after updating settings, but these 121 // TODO(mattm): We should call UpdateConfig after updating settings, but these
130 // methods are static. 122 // methods are static.
131 } 123 }
132 124
133 void SSLConfigServiceWin::UpdateConfig(TimeTicks now) { 125 void SSLConfigServiceWin::UpdateConfig(TimeTicks now) {
134 SSLConfig orig_config = config_info_; 126 SSLConfig orig_config = config_info_;
135 GetSSLConfigNow(&config_info_); 127 GetSSLConfigNow(&config_info_);
136 if (ever_updated_) 128 if (ever_updated_)
137 ProcessConfigUpdate(orig_config, config_info_); 129 ProcessConfigUpdate(orig_config, config_info_);
138 config_time_ = now; 130 config_time_ = now;
139 ever_updated_ = true; 131 ever_updated_ = true;
140 } 132 }
141 133
142 } // namespace net 134 } // namespace net
OLDNEW
« no previous file with comments | « chrome/common/chrome_version_info.cc ('k') | net/proxy/proxy_config_service_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698