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

Side by Side Diff: content/browser/ssl/ssl_policy.cc

Issue 2220603003: Remove unnecessary |result| argument from AllowCertificateError() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unnecessary include Created 4 years, 4 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
« no previous file with comments | « content/browser/ssl/ssl_policy.h ('k') | content/public/browser/content_browser_client.h » ('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) 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 "content/browser/ssl/ssl_policy.h" 5 #include "content/browser/ssl/ssl_policy.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 // SECURITY_STYLE_AUTHENTICATION_BROKEN. 188 // SECURITY_STYLE_AUTHENTICATION_BROKEN.
189 if (net::IsCertStatusError(cert_status) && 189 if (net::IsCertStatusError(cert_status) &&
190 !net::IsCertStatusMinorError(cert_status)) { 190 !net::IsCertStatusMinorError(cert_status)) {
191 return SECURITY_STYLE_AUTHENTICATION_BROKEN; 191 return SECURITY_STYLE_AUTHENTICATION_BROKEN;
192 } 192 }
193 193
194 return SECURITY_STYLE_AUTHENTICATED; 194 return SECURITY_STYLE_AUTHENTICATED;
195 } 195 }
196 196
197 void SSLPolicy::OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, 197 void SSLPolicy::OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler,
198 bool allow) { 198 CertificateRequestResultType decision) {
199 DCHECK(handler->ssl_info().is_valid()); 199 DCHECK(handler->ssl_info().is_valid());
200 if (allow) { 200 switch (decision) {
201 // Default behavior for accepting a certificate. 201 case CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE:
202 // Note that we should not call SetMaxSecurityStyle here, because the active 202 // Note that we should not call SetMaxSecurityStyle here, because the
203 // NavigationEntry has just been deleted (in HideInterstitialPage) and the 203 // active
204 // new NavigationEntry will not be set until DidNavigate. This is ok, 204 // NavigationEntry has just been deleted (in HideInterstitialPage) and the
205 // because the new NavigationEntry will have its max security style set 205 // new NavigationEntry will not be set until DidNavigate. This is ok,
206 // within DidNavigate. 206 // because the new NavigationEntry will have its max security style set
207 // 207 // within DidNavigate.
208 // While AllowCertForHost() executes synchronously on this thread, 208 //
209 // ContinueRequest() gets posted to a different thread. Calling 209 // While AllowCertForHost() executes synchronously on this thread,
210 // AllowCertForHost() first ensures deterministic ordering. 210 // ContinueRequest() gets posted to a different thread. Calling
211 backend_->AllowCertForHost(*handler->ssl_info().cert.get(), 211 // AllowCertForHost() first ensures deterministic ordering.
212 handler->request_url().host(), 212 backend_->AllowCertForHost(*handler->ssl_info().cert.get(),
213 handler->cert_error()); 213 handler->request_url().host(),
214 handler->ContinueRequest(); 214 handler->cert_error());
215 } else { 215 handler->ContinueRequest();
216 // Default behavior for rejecting a certificate. 216 return;
217 handler->CancelRequest(); 217 case CERTIFICATE_REQUEST_RESULT_TYPE_DENY:
218 handler->DenyRequest();
219 return;
220 case CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL:
221 handler->CancelRequest();
222 return;
218 } 223 }
219 } 224 }
220 225
221 //////////////////////////////////////////////////////////////////////////////// 226 ////////////////////////////////////////////////////////////////////////////////
222 // Certificate Error Routines 227 // Certificate Error Routines
223 228
224 void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler, 229 void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler,
225 int options_mask) { 230 int options_mask) {
226 bool overridable = (options_mask & OVERRIDABLE) != 0; 231 bool overridable = (options_mask & OVERRIDABLE) != 0;
227 bool strict_enforcement = (options_mask & STRICT_ENFORCEMENT) != 0; 232 bool strict_enforcement = (options_mask & STRICT_ENFORCEMENT) != 0;
228 bool expired_previous_decision = 233 bool expired_previous_decision =
229 (options_mask & EXPIRED_PREVIOUS_DECISION) != 0; 234 (options_mask & EXPIRED_PREVIOUS_DECISION) != 0;
230 CertificateRequestResultType result =
231 CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE;
232 GetContentClient()->browser()->AllowCertificateError( 235 GetContentClient()->browser()->AllowCertificateError(
233 handler->GetManager()->controller()->GetWebContents(), 236 handler->GetManager()->controller()->GetWebContents(),
234 handler->cert_error(), handler->ssl_info(), handler->request_url(), 237 handler->cert_error(), handler->ssl_info(), handler->request_url(),
235 handler->resource_type(), overridable, strict_enforcement, 238 handler->resource_type(), overridable, strict_enforcement,
236 expired_previous_decision, 239 expired_previous_decision,
237 base::Bind(&SSLPolicy::OnAllowCertificate, base::Unretained(this), 240 base::Bind(&SSLPolicy::OnAllowCertificate, base::Unretained(this),
238 make_scoped_refptr(handler)), 241 make_scoped_refptr(handler)));
239 &result);
240 switch (result) {
241 case CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE:
242 break;
243 case CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL:
244 handler->CancelRequest();
245 break;
246 case CERTIFICATE_REQUEST_RESULT_TYPE_DENY:
247 handler->DenyRequest();
248 break;
249 default:
250 NOTREACHED();
251 }
252 } 242 }
253 243
254 void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) { 244 void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) {
255 if (entry->GetSSL().security_style != SECURITY_STYLE_UNKNOWN) 245 if (entry->GetSSL().security_style != SECURITY_STYLE_UNKNOWN)
256 return; 246 return;
257 247
258 entry->GetSSL().security_style = GetSecurityStyleForResource( 248 entry->GetSSL().security_style = GetSecurityStyleForResource(
259 entry->GetURL(), entry->GetSSL().cert_id, entry->GetSSL().cert_status); 249 entry->GetURL(), entry->GetSSL().cert_id, entry->GetSSL().cert_status);
260 } 250 }
261 251
262 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { 252 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) {
263 GURL parsed_origin(origin); 253 GURL parsed_origin(origin);
264 if (parsed_origin.SchemeIsCryptographic()) 254 if (parsed_origin.SchemeIsCryptographic())
265 backend_->HostRanInsecureContent(parsed_origin.host(), pid); 255 backend_->HostRanInsecureContent(parsed_origin.host(), pid);
266 } 256 }
267 257
268 } // namespace content 258 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ssl/ssl_policy.h ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698