OLD | NEW |
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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void SSLPolicy::OnRequestStarted(SSLRequestInfo* info) { | 104 void SSLPolicy::OnRequestStarted(SSLRequestInfo* info) { |
105 // TODO(abarth): This mechanism is wrong. What we should be doing is sending | 105 // TODO(abarth): This mechanism is wrong. What we should be doing is sending |
106 // this information back through WebKit and out some FrameLoaderClient | 106 // this information back through WebKit and out some FrameLoaderClient |
107 // methods. | 107 // methods. |
108 | 108 |
109 if (net::IsCertStatusError(info->ssl_cert_status())) | 109 if (net::IsCertStatusError(info->ssl_cert_status())) |
110 backend_->HostRanInsecureContent(info->url().host(), info->child_id()); | 110 backend_->HostRanInsecureContent(info->url().host(), info->child_id()); |
111 } | 111 } |
112 | 112 |
113 void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, | 113 void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, |
114 TabContents* tab_contents) { | 114 WebContentsImpl* web_contents) { |
115 DCHECK(entry); | 115 DCHECK(entry); |
116 | 116 |
117 InitializeEntryIfNeeded(entry); | 117 InitializeEntryIfNeeded(entry); |
118 | 118 |
119 if (!entry->GetURL().SchemeIsSecure()) | 119 if (!entry->GetURL().SchemeIsSecure()) |
120 return; | 120 return; |
121 | 121 |
122 // An HTTPS response may not have a certificate for some reason. When that | 122 // An HTTPS response may not have a certificate for some reason. When that |
123 // happens, use the unauthenticated (HTTP) rather than the authentication | 123 // happens, use the unauthenticated (HTTP) rather than the authentication |
124 // broken security style so that we can detect this error condition. | 124 // broken security style so that we can detect this error condition. |
(...skipping 26 matching lines...) Expand all Loading... |
151 // possibly have insecure content. See bug http://crbug.com/12423. | 151 // possibly have insecure content. See bug http://crbug.com/12423. |
152 if (site_instance && | 152 if (site_instance && |
153 backend_->DidHostRunInsecureContent( | 153 backend_->DidHostRunInsecureContent( |
154 entry->GetURL().host(), site_instance->GetProcess()->GetID())) { | 154 entry->GetURL().host(), site_instance->GetProcess()->GetID())) { |
155 entry->GetSSL().security_style = | 155 entry->GetSSL().security_style = |
156 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 156 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
157 entry->GetSSL().content_status |= SSLStatus::RAN_INSECURE_CONTENT; | 157 entry->GetSSL().content_status |= SSLStatus::RAN_INSECURE_CONTENT; |
158 return; | 158 return; |
159 } | 159 } |
160 | 160 |
161 if (tab_contents->DisplayedInsecureContent()) | 161 if (web_contents->DisplayedInsecureContent()) |
162 entry->GetSSL().content_status |= SSLStatus::DISPLAYED_INSECURE_CONTENT; | 162 entry->GetSSL().content_status |= SSLStatus::DISPLAYED_INSECURE_CONTENT; |
163 } | 163 } |
164 | 164 |
165 void SSLPolicy::OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, | 165 void SSLPolicy::OnAllowCertificate(scoped_refptr<SSLCertErrorHandler> handler, |
166 bool allow) { | 166 bool allow) { |
167 if (allow) { | 167 if (allow) { |
168 // Default behavior for accepting a certificate. | 168 // Default behavior for accepting a certificate. |
169 // Note that we should not call SetMaxSecurityStyle here, because the active | 169 // Note that we should not call SetMaxSecurityStyle here, because the active |
170 // NavigationEntry has just been deleted (in HideInterstitialPage) and the | 170 // NavigationEntry has just been deleted (in HideInterstitialPage) and the |
171 // new NavigationEntry will not be set until DidNavigate. This is ok, | 171 // new NavigationEntry will not be set until DidNavigate. This is ok, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 entry->GetSSL().security_style = entry->GetURL().SchemeIsSecure() ? | 226 entry->GetSSL().security_style = entry->GetURL().SchemeIsSecure() ? |
227 content::SECURITY_STYLE_AUTHENTICATED : | 227 content::SECURITY_STYLE_AUTHENTICATED : |
228 content::SECURITY_STYLE_UNAUTHENTICATED; | 228 content::SECURITY_STYLE_UNAUTHENTICATED; |
229 } | 229 } |
230 | 230 |
231 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { | 231 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { |
232 GURL parsed_origin(origin); | 232 GURL parsed_origin(origin); |
233 if (parsed_origin.SchemeIsSecure()) | 233 if (parsed_origin.SchemeIsSecure()) |
234 backend_->HostRanInsecureContent(parsed_origin.host(), pid); | 234 backend_->HostRanInsecureContent(parsed_origin.host(), pid); |
235 } | 235 } |
OLD | NEW |