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

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

Issue 465133004: Remove DenyCertForHost from SSLHostStateDelegate API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on ToT Created 6 years, 3 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
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 17 matching lines...) Expand all
28 28
29 SSLPolicy::SSLPolicy(SSLPolicyBackend* backend) 29 SSLPolicy::SSLPolicy(SSLPolicyBackend* backend)
30 : backend_(backend) { 30 : backend_(backend) {
31 DCHECK(backend_); 31 DCHECK(backend_);
32 } 32 }
33 33
34 void SSLPolicy::OnCertError(SSLCertErrorHandler* handler) { 34 void SSLPolicy::OnCertError(SSLCertErrorHandler* handler) {
35 bool expired_previous_decision; 35 bool expired_previous_decision;
36 // First we check if we know the policy for this error. 36 // First we check if we know the policy for this error.
37 DCHECK(handler->ssl_info().is_valid()); 37 DCHECK(handler->ssl_info().is_valid());
38 net::CertPolicy::Judgment judgment = 38 SSLHostStateDelegate::CertJudgment judgment =
39 backend_->QueryPolicy(*handler->ssl_info().cert.get(), 39 backend_->QueryPolicy(*handler->ssl_info().cert.get(),
40 handler->request_url().host(), 40 handler->request_url().host(),
41 handler->cert_error(), 41 handler->cert_error(),
42 &expired_previous_decision); 42 &expired_previous_decision);
43 43
44 if (judgment == net::CertPolicy::ALLOWED) { 44 if (judgment == SSLHostStateDelegate::ALLOWED) {
45 handler->ContinueRequest(); 45 handler->ContinueRequest();
46 return; 46 return;
47 } 47 }
48 48
49 // The judgment is either DENIED or UNKNOWN. 49 // For all other hosts, which must be DENIED, a blocking page is shown to the
50 // For now we handle the DENIED as the UNKNOWN, which means a blocking 50 // user every time they come back to the page.
51 // page is shown to the user every time he comes back to the page.
52
53 int options_mask = 0; 51 int options_mask = 0;
54 switch (handler->cert_error()) { 52 switch (handler->cert_error()) {
55 case net::ERR_CERT_COMMON_NAME_INVALID: 53 case net::ERR_CERT_COMMON_NAME_INVALID:
56 case net::ERR_CERT_DATE_INVALID: 54 case net::ERR_CERT_DATE_INVALID:
57 case net::ERR_CERT_AUTHORITY_INVALID: 55 case net::ERR_CERT_AUTHORITY_INVALID:
58 case net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM: 56 case net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM:
59 case net::ERR_CERT_WEAK_KEY: 57 case net::ERR_CERT_WEAK_KEY:
60 case net::ERR_CERT_NAME_CONSTRAINT_VIOLATION: 58 case net::ERR_CERT_NAME_CONSTRAINT_VIOLATION:
61 if (!handler->fatal()) 59 if (!handler->fatal())
62 options_mask |= OVERRIDABLE; 60 options_mask |= OVERRIDABLE;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // 173 //
176 // While AllowCertForHost() executes synchronously on this thread, 174 // While AllowCertForHost() executes synchronously on this thread,
177 // ContinueRequest() gets posted to a different thread. Calling 175 // ContinueRequest() gets posted to a different thread. Calling
178 // AllowCertForHost() first ensures deterministic ordering. 176 // AllowCertForHost() first ensures deterministic ordering.
179 backend_->AllowCertForHost(*handler->ssl_info().cert.get(), 177 backend_->AllowCertForHost(*handler->ssl_info().cert.get(),
180 handler->request_url().host(), 178 handler->request_url().host(),
181 handler->cert_error()); 179 handler->cert_error());
182 handler->ContinueRequest(); 180 handler->ContinueRequest();
183 } else { 181 } else {
184 // Default behavior for rejecting a certificate. 182 // Default behavior for rejecting a certificate.
185 //
186 // While DenyCertForHost() executes synchronously on this thread,
187 // CancelRequest() gets posted to a different thread. Calling
188 // DenyCertForHost() first ensures deterministic ordering.
189 backend_->DenyCertForHost(*handler->ssl_info().cert.get(),
190 handler->request_url().host(),
191 handler->cert_error());
192 handler->CancelRequest(); 183 handler->CancelRequest();
193 } 184 }
194 } 185 }
195 186
196 //////////////////////////////////////////////////////////////////////////////// 187 ////////////////////////////////////////////////////////////////////////////////
197 // Certificate Error Routines 188 // Certificate Error Routines
198 189
199 void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler, 190 void SSLPolicy::OnCertErrorInternal(SSLCertErrorHandler* handler,
200 int options_mask) { 191 int options_mask) {
201 bool overridable = (options_mask & OVERRIDABLE) != 0; 192 bool overridable = (options_mask & OVERRIDABLE) != 0;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 SECURITY_STYLE_AUTHENTICATED : SECURITY_STYLE_UNAUTHENTICATED; 231 SECURITY_STYLE_AUTHENTICATED : SECURITY_STYLE_UNAUTHENTICATED;
241 } 232 }
242 233
243 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { 234 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) {
244 GURL parsed_origin(origin); 235 GURL parsed_origin(origin);
245 if (parsed_origin.SchemeIsSecure()) 236 if (parsed_origin.SchemeIsSecure())
246 backend_->HostRanInsecureContent(parsed_origin.host(), pid); 237 backend_->HostRanInsecureContent(parsed_origin.host(), pid);
247 } 238 }
248 239
249 } // namespace content 240 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/website_settings/website_settings_ui.h ('k') | content/browser/ssl/ssl_policy_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698