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

Side by Side Diff: chrome/browser/android/policy/policy_auditor.cc

Issue 2400673003: Remove SSLStatus::security_style member and content::SecurityStyle (Closed)
Patch Set: more curly braces Created 4 years, 2 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 | « chrome/browser/DEPS ('k') | chrome/browser/ssl/bad_clock_blocking_page.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/android/policy/policy_auditor.h" 5 #include "chrome/browser/android/policy/policy_auditor.h"
6 6
7 #include "content/public/browser/navigation_entry.h" 7 #include "content/public/browser/navigation_entry.h"
8 #include "content/public/browser/render_process_host.h" 8 #include "content/public/browser/render_process_host.h"
9 #include "content/public/browser/ssl_status.h" 9 #include "content/public/browser/ssl_status.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 21 matching lines...) Expand all
32 }; 32 };
33 33
34 content::WebContents* web_contents = 34 content::WebContents* web_contents =
35 content::WebContents::FromJavaWebContents(java_web_contents); 35 content::WebContents::FromJavaWebContents(java_web_contents);
36 content::NavigationEntry* entry = 36 content::NavigationEntry* entry =
37 web_contents->GetController().GetVisibleEntry(); 37 web_contents->GetController().GetVisibleEntry();
38 if (!entry) 38 if (!entry)
39 return NONE; 39 return NONE;
40 40
41 const content::SSLStatus& ssl = entry->GetSSL(); 41 const content::SSLStatus& ssl = entry->GetSSL();
42 switch (ssl.security_style) { 42 if (ssl.certificate && entry->GetURL().SchemeIsCryptographic()) {
43 case content::SECURITY_STYLE_WARNING: 43 if (net::IsCertStatusError(ssl.cert_status)) {
44 case content::SECURITY_STYLE_UNKNOWN: 44 if (ssl.cert_status & net::CERT_STATUS_AUTHORITY_INVALID) {
45 case content::SECURITY_STYLE_UNAUTHENTICATED: 45 return CERTIFICATE_FAIL_UNTRUSTED;
46 return NONE;
47
48 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN:
49 case content::SECURITY_STYLE_AUTHENTICATED: {
50 if (net::IsCertStatusError(ssl.cert_status)) {
51 if (ssl.cert_status & net::CERT_STATUS_AUTHORITY_INVALID)
52 return CERTIFICATE_FAIL_UNTRUSTED;
53 if (ssl.cert_status & net::CERT_STATUS_REVOKED)
54 return CERTIFICATE_FAIL_REVOKED;
55 // No mapping for CERTIFICATE_FAIL_NOT_YET_VALID.
56 if (ssl.cert_status & net::CERT_STATUS_DATE_INVALID)
57 return CERTIFICATE_FAIL_EXPIRED;
58 if (ssl.cert_status & net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION)
59 return CERTIFICATE_FAIL_UNABLE_TO_CHECK_REVOCATION_STATUS;
60 return CERTIFICATE_FAIL_UNSPECIFIED;
61 } 46 }
62 if (ssl.content_status & 47 if (ssl.cert_status & net::CERT_STATUS_REVOKED) {
63 content::SSLStatus::DISPLAYED_INSECURE_CONTENT) { 48 return CERTIFICATE_FAIL_REVOKED;
64 return CERTIFICATE_FAIL_UNSPECIFIED;
65 } 49 }
50 // No mapping for CERTIFICATE_FAIL_NOT_YET_VALID.
51 if (ssl.cert_status & net::CERT_STATUS_DATE_INVALID) {
52 return CERTIFICATE_FAIL_EXPIRED;
53 }
54 if (ssl.cert_status & net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) {
55 return CERTIFICATE_FAIL_UNABLE_TO_CHECK_REVOCATION_STATUS;
56 }
57 return CERTIFICATE_FAIL_UNSPECIFIED;
58 }
59 if (ssl.content_status & content::SSLStatus::DISPLAYED_INSECURE_CONTENT ||
60 ssl.content_status &
61 content::SSLStatus::DISPLAYED_CONTENT_WITH_CERT_ERRORS) {
62 return CERTIFICATE_FAIL_UNSPECIFIED;
66 } 63 }
67 } 64 }
68 return NONE; 65 return NONE;
69 } 66 }
70 67
71 bool RegisterPolicyAuditor(JNIEnv* env) { 68 bool RegisterPolicyAuditor(JNIEnv* env) {
72 return RegisterNativesImpl(env); 69 return RegisterNativesImpl(env);
73 } 70 }
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/ssl/bad_clock_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698