| 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/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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 SSL_GOOD_CERT_SEEN_EVENT_MAX); | 136 SSL_GOOD_CERT_SEEN_EVENT_MAX); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 | 139 |
| 140 void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, | 140 void SSLPolicy::UpdateEntry(NavigationEntryImpl* entry, |
| 141 WebContentsImpl* web_contents) { | 141 WebContentsImpl* web_contents) { |
| 142 DCHECK(entry); | 142 DCHECK(entry); |
| 143 | 143 |
| 144 InitializeEntryIfNeeded(entry); | 144 InitializeEntryIfNeeded(entry); |
| 145 | 145 |
| 146 if (!entry->GetURL().SchemeIsSecure()) | 146 if (!entry->GetURL().SchemeIsCryptographic()) |
| 147 return; | 147 return; |
| 148 | 148 |
| 149 if (!web_contents->DisplayedInsecureContent()) | 149 if (!web_contents->DisplayedInsecureContent()) |
| 150 entry->GetSSL().content_status &= ~SSLStatus::DISPLAYED_INSECURE_CONTENT; | 150 entry->GetSSL().content_status &= ~SSLStatus::DISPLAYED_INSECURE_CONTENT; |
| 151 | 151 |
| 152 // An HTTPS response may not have a certificate for some reason. When that | 152 // An HTTPS response may not have a certificate for some reason. When that |
| 153 // happens, use the unauthenticated (HTTP) rather than the authentication | 153 // happens, use the unauthenticated (HTTP) rather than the authentication |
| 154 // broken security style so that we can detect this error condition. | 154 // broken security style so that we can detect this error condition. |
| 155 if (!entry->GetSSL().cert_id) { | 155 if (!entry->GetSSL().cert_id) { |
| 156 entry->GetSSL().security_style = SECURITY_STYLE_UNAUTHENTICATED; | 156 entry->GetSSL().security_style = SECURITY_STYLE_UNAUTHENTICATED; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 break; | 244 break; |
| 245 default: | 245 default: |
| 246 NOTREACHED(); | 246 NOTREACHED(); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) { | 250 void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) { |
| 251 if (entry->GetSSL().security_style != SECURITY_STYLE_UNKNOWN) | 251 if (entry->GetSSL().security_style != SECURITY_STYLE_UNKNOWN) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 entry->GetSSL().security_style = entry->GetURL().SchemeIsSecure() ? | 254 entry->GetSSL().security_style = entry->GetURL().SchemeIsCryptographic() ? |
| 255 SECURITY_STYLE_AUTHENTICATED : SECURITY_STYLE_UNAUTHENTICATED; | 255 SECURITY_STYLE_AUTHENTICATED : SECURITY_STYLE_UNAUTHENTICATED; |
| 256 } | 256 } |
| 257 | 257 |
| 258 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { | 258 void SSLPolicy::OriginRanInsecureContent(const std::string& origin, int pid) { |
| 259 GURL parsed_origin(origin); | 259 GURL parsed_origin(origin); |
| 260 if (parsed_origin.SchemeIsSecure()) | 260 if (parsed_origin.SchemeIsCryptographic()) |
| 261 backend_->HostRanInsecureContent(parsed_origin.host(), pid); | 261 backend_->HostRanInsecureContent(parsed_origin.host(), pid); |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace content | 264 } // namespace content |
| OLD | NEW |