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

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

Issue 2214793002: Remove unnecessary SSLRequestInfo class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "content/browser/frame_host/navigation_entry_impl.h" 14 #include "content/browser/frame_host/navigation_entry_impl.h"
15 #include "content/browser/renderer_host/render_process_host_impl.h" 15 #include "content/browser/renderer_host/render_process_host_impl.h"
16 #include "content/browser/renderer_host/render_view_host_impl.h" 16 #include "content/browser/renderer_host/render_view_host_impl.h"
17 #include "content/browser/site_instance_impl.h" 17 #include "content/browser/site_instance_impl.h"
18 #include "content/browser/ssl/ssl_cert_error_handler.h" 18 #include "content/browser/ssl/ssl_cert_error_handler.h"
19 #include "content/browser/ssl/ssl_request_info.h"
20 #include "content/browser/web_contents/web_contents_impl.h" 19 #include "content/browser/web_contents/web_contents_impl.h"
21 #include "content/public/browser/content_browser_client.h" 20 #include "content/public/browser/content_browser_client.h"
22 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/resource_type.h" 22 #include "content/public/common/resource_type.h"
24 #include "content/public/common/ssl_status.h" 23 #include "content/public/common/ssl_status.h"
25 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
26 #include "net/ssl/ssl_info.h" 25 #include "net/ssl/ssl_info.h"
27 #include "url/gurl.h" 26 #include "url/gurl.h"
28 27
29 namespace content { 28 namespace content {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 return; 110 return;
112 111
113 SiteInstance* site_instance = entry->site_instance(); 112 SiteInstance* site_instance = entry->site_instance();
114 if (!site_instance) 113 if (!site_instance)
115 return; 114 return;
116 115
117 backend_->HostRanInsecureContent(security_origin.host(), 116 backend_->HostRanInsecureContent(security_origin.host(),
118 site_instance->GetProcess()->GetID()); 117 site_instance->GetProcess()->GetID());
119 } 118 }
120 119
121 void SSLPolicy::OnRequestStarted(SSLRequestInfo* info) { 120 void SSLPolicy::OnRequestStarted(const GURL& url,
122 if (info->ssl_cert_id() && info->url().SchemeIsCryptographic() && 121 int cert_id,
123 !net::IsCertStatusError(info->ssl_cert_status())) { 122 net::CertStatus cert_status) {
123 if (cert_id && url.SchemeIsCryptographic() &&
124 !net::IsCertStatusError(cert_status)) {
124 // If the scheme is https: or wss: *and* the security info for the 125 // If the scheme is https: or wss: *and* the security info for the
125 // cert has been set (i.e. the cert id is not 0) and the cert did 126 // cert has been set (i.e. the cert id is not 0) and the cert did
126 // not have any errors, revoke any previous decisions that 127 // not have any errors, revoke any previous decisions that
127 // have occurred. If the cert info has not been set, do nothing since it 128 // have occurred. If the cert info has not been set, do nothing since it
128 // isn't known if the connection was actually a valid connection or if it 129 // isn't known if the connection was actually a valid connection or if it
129 // had a cert error. 130 // had a cert error.
130 SSLGoodCertSeenEvent event = NO_PREVIOUS_EXCEPTION; 131 SSLGoodCertSeenEvent event = NO_PREVIOUS_EXCEPTION;
131 if (backend_->HasAllowException(info->url().host())) { 132 if (backend_->HasAllowException(url.host())) {
132 // If there's no certificate error, a good certificate has been seen, so 133 // If there's no certificate error, a good certificate has been seen, so
133 // clear out any exceptions that were made by the user for bad 134 // clear out any exceptions that were made by the user for bad
134 // certificates. 135 // certificates.
135 backend_->RevokeUserAllowExceptions(info->url().host()); 136 backend_->RevokeUserAllowExceptions(url.host());
136 event = HAD_PREVIOUS_EXCEPTION; 137 event = HAD_PREVIOUS_EXCEPTION;
137 } 138 }
138 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.good_cert_seen", event, 139 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.good_cert_seen", event,
139 SSL_GOOD_CERT_SEEN_EVENT_MAX); 140 SSL_GOOD_CERT_SEEN_EVENT_MAX);
140 } 141 }
141 } 142 }
142 143
143 void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, 144 void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry,
144 WebContents* web_contents) { 145 WebContents* web_contents) {
145 DCHECK(entry); 146 DCHECK(entry);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 entry->GetURL(), entry->GetSSL().cert_id, entry->GetSSL().cert_status); 259 entry->GetURL(), entry->GetSSL().cert_id, entry->GetSSL().cert_status);
259 } 260 }
260 261
261 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { 262 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) {
262 GURL parsed_origin(origin); 263 GURL parsed_origin(origin);
263 if (parsed_origin.SchemeIsCryptographic()) 264 if (parsed_origin.SchemeIsCryptographic())
264 backend_->HostRanInsecureContent(parsed_origin.host(), pid); 265 backend_->HostRanInsecureContent(parsed_origin.host(), pid);
265 } 266 }
266 267
267 } // namespace content 268 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698