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

Side by Side Diff: chrome/browser/ssl/connection_security_helper.cc

Issue 1143503003: Use |IsOriginSecure| for mark-HTTP-nonsecure field trial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/ssl/connection_security_helper.h" 5 #include "chrome/browser/ssl/connection_security_helper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ssl/ssl_error_info.h" 11 #include "chrome/browser/ssl/ssl_error_info.h"
12 #include "chrome/common/chrome_constants.h" 12 #include "chrome/common/chrome_constants.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "content/public/browser/cert_store.h" 15 #include "content/public/browser/cert_store.h"
16 #include "content/public/browser/navigation_controller.h" 16 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/navigation_entry.h" 17 #include "content/public/browser/navigation_entry.h"
18 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
19 #include "content/public/common/origin_util.h"
19 #include "content/public/common/ssl_status.h" 20 #include "content/public/common/ssl_status.h"
20 #include "net/base/net_util.h" 21 #include "net/base/net_util.h"
21 #include "net/cert/cert_status_flags.h" 22 #include "net/cert/cert_status_flags.h"
22 #include "net/cert/x509_certificate.h" 23 #include "net/cert/x509_certificate.h"
23 #include "net/ssl/ssl_connection_status_flags.h" 24 #include "net/ssl/ssl_connection_status_flags.h"
24 #include "url/url_constants.h"
25 25
26 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS)
27 #include "chrome/browser/chromeos/policy/policy_cert_service.h" 27 #include "chrome/browser/chromeos/policy/policy_cert_service.h"
28 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" 28 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
29 #endif 29 #endif
30 30
31 namespace { 31 namespace {
32 32
33 ConnectionSecurityHelper::SecurityLevel 33 ConnectionSecurityHelper::SecurityLevel
34 GetSecurityLevelForNonSecureFieldTrial() { 34 GetSecurityLevelForNonSecureFieldTrial() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if (!entry) 66 if (!entry)
67 return NONE; 67 return NONE;
68 68
69 const content::SSLStatus& ssl = entry->GetSSL(); 69 const content::SSLStatus& ssl = entry->GetSSL();
70 switch (ssl.security_style) { 70 switch (ssl.security_style) {
71 case content::SECURITY_STYLE_UNKNOWN: 71 case content::SECURITY_STYLE_UNKNOWN:
72 return NONE; 72 return NONE;
73 73
74 case content::SECURITY_STYLE_UNAUTHENTICATED: { 74 case content::SECURITY_STYLE_UNAUTHENTICATED: {
75 const GURL& url = entry->GetURL(); 75 const GURL& url = entry->GetURL();
76 if (url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kFtpScheme)) 76 if (!content::IsOriginSecure(url))
77 return GetSecurityLevelForNonSecureFieldTrial(); 77 return GetSecurityLevelForNonSecureFieldTrial();
78 return NONE; 78 return NONE;
79 } 79 }
80 80
81 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN: 81 case content::SECURITY_STYLE_AUTHENTICATION_BROKEN:
82 return SECURITY_ERROR; 82 return SECURITY_ERROR;
83 83
84 case content::SECURITY_STYLE_AUTHENTICATED: { 84 case content::SECURITY_STYLE_AUTHENTICATED: {
85 #if defined(OS_CHROMEOS) 85 #if defined(OS_CHROMEOS)
86 policy::PolicyCertService* service = 86 policy::PolicyCertService* service =
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) && cert) 121 if ((ssl.cert_status & net::CERT_STATUS_IS_EV) && cert)
122 return EV_SECURE; 122 return EV_SECURE;
123 return SECURE; 123 return SECURE;
124 } 124 }
125 125
126 default: 126 default:
127 NOTREACHED(); 127 NOTREACHED();
128 return NONE; 128 return NONE;
129 } 129 }
130 } 130 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698