| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 if (entry->GetSSL().security_style == SECURITY_STYLE_UNAUTHENTICATED) | 150 if (entry->GetSSL().security_style == SECURITY_STYLE_UNAUTHENTICATED) |
| 151 return; | 151 return; |
| 152 | 152 |
| 153 if (!web_contents->DisplayedInsecureContent()) | 153 if (!web_contents->DisplayedInsecureContent()) |
| 154 entry->GetSSL().content_status &= ~SSLStatus::DISPLAYED_INSECURE_CONTENT; | 154 entry->GetSSL().content_status &= ~SSLStatus::DISPLAYED_INSECURE_CONTENT; |
| 155 | 155 |
| 156 if (web_contents->DisplayedInsecureContent()) | 156 if (web_contents->DisplayedInsecureContent()) |
| 157 entry->GetSSL().content_status |= SSLStatus::DISPLAYED_INSECURE_CONTENT; | 157 entry->GetSSL().content_status |= SSLStatus::DISPLAYED_INSECURE_CONTENT; |
| 158 | 158 |
| 159 if (entry->GetSSL().security_style == SECURITY_STYLE_AUTHENTICATION_BROKEN) | |
| 160 return; | |
| 161 | |
| 162 SiteInstance* site_instance = entry->site_instance(); | 159 SiteInstance* site_instance = entry->site_instance(); |
| 163 // Note that |site_instance| can be NULL here because NavigationEntries don't | 160 // Note that |site_instance| can be NULL here because NavigationEntries don't |
| 164 // necessarily have site instances. Without a process, the entry can't | 161 // necessarily have site instances. Without a process, the entry can't |
| 165 // possibly have insecure content. See bug http://crbug.com/12423. | 162 // possibly have insecure content. See bug http://crbug.com/12423. |
| 166 if (site_instance && | 163 if (site_instance && |
| 167 backend_->DidHostRunInsecureContent( | 164 backend_->DidHostRunInsecureContent( |
| 168 entry->GetURL().host(), site_instance->GetProcess()->GetID())) { | 165 entry->GetURL().host(), site_instance->GetProcess()->GetID())) { |
| 169 entry->GetSSL().security_style = | 166 entry->GetSSL().security_style = |
| 170 SECURITY_STYLE_AUTHENTICATION_BROKEN; | 167 SECURITY_STYLE_AUTHENTICATION_BROKEN; |
| 171 entry->GetSSL().content_status |= SSLStatus::RAN_INSECURE_CONTENT; | 168 entry->GetSSL().content_status |= SSLStatus::RAN_INSECURE_CONTENT; |
| 172 return; | |
| 173 } | 169 } |
| 174 } | 170 } |
| 175 | 171 |
| 176 // Static | 172 // Static |
| 177 SecurityStyle SSLPolicy::GetSecurityStyleForResource( | 173 SecurityStyle SSLPolicy::GetSecurityStyleForResource( |
| 178 const GURL& url, | 174 const GURL& url, |
| 179 int cert_id, | 175 int cert_id, |
| 180 net::CertStatus cert_status) { | 176 net::CertStatus cert_status) { |
| 181 // An HTTPS response may not have a certificate for some reason. When that | 177 // An HTTPS response may not have a certificate for some reason. When that |
| 182 // happens, use the unauthenticated (HTTP) rather than the authentication | 178 // happens, use the unauthenticated (HTTP) rather than the authentication |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 249 |
| 254 void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) { | 250 void SSLPolicy::InitializeEntryIfNeeded(NavigationEntryImpl* entry) { |
| 255 if (entry->GetSSL().security_style != SECURITY_STYLE_UNKNOWN) | 251 if (entry->GetSSL().security_style != SECURITY_STYLE_UNKNOWN) |
| 256 return; | 252 return; |
| 257 | 253 |
| 258 entry->GetSSL().security_style = GetSecurityStyleForResource( | 254 entry->GetSSL().security_style = GetSecurityStyleForResource( |
| 259 entry->GetURL(), entry->GetSSL().cert_id, entry->GetSSL().cert_status); | 255 entry->GetURL(), entry->GetSSL().cert_id, entry->GetSSL().cert_status); |
| 260 } | 256 } |
| 261 | 257 |
| 262 } // namespace content | 258 } // namespace content |
| OLD | NEW |