Chromium Code Reviews| 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_manager.h" | 5 #include "content/browser/ssl/ssl_manager.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 NavigationEntryImpl* entry = controller_->GetLastCommittedEntry(); | 114 NavigationEntryImpl* entry = controller_->GetLastCommittedEntry(); |
| 115 | 115 |
| 116 if (details.is_main_frame) { | 116 if (details.is_main_frame) { |
| 117 if (entry) { | 117 if (entry) { |
| 118 // We may not have an entry if this is a navigation to an initial blank | 118 // We may not have an entry if this is a navigation to an initial blank |
| 119 // page. Add the new data we have. | 119 // page. Add the new data we have. |
| 120 entry->GetSSL() = details.ssl_status; | 120 entry->GetSSL() = details.ssl_status; |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| 124 UpdateEntry(entry); | 124 if (!UpdateEntry(entry)) |
|
estark
2015/07/21 22:25:16
If you're wondering why this change is necessary..
davidben
2015/07/22 20:56:57
This probably wants a comment. It took me a while
estark
2015/07/22 22:56:55
Done. (Changed it to call policy()->UpdateEntry()
| |
| 125 NotifyDidChangeVisibleSSLState(); | |
| 125 } | 126 } |
| 126 | 127 |
| 127 void SSLManager::DidDisplayInsecureContent() { | 128 void SSLManager::DidDisplayInsecureContent() { |
| 128 UpdateEntry(controller_->GetLastCommittedEntry()); | 129 UpdateEntry(controller_->GetLastCommittedEntry()); |
| 129 } | 130 } |
| 130 | 131 |
| 131 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { | 132 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { |
| 132 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); | 133 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); |
| 133 policy()->DidRunInsecureContent(navigation_entry, security_origin); | 134 policy()->DidRunInsecureContent(navigation_entry, security_origin); |
| 134 UpdateEntry(navigation_entry); | 135 UpdateEntry(navigation_entry); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 | 170 |
| 170 void SSLManager::DidReceiveResourceRedirect( | 171 void SSLManager::DidReceiveResourceRedirect( |
| 171 const ResourceRedirectDetails& details) { | 172 const ResourceRedirectDetails& details) { |
| 172 // TODO(abarth): Make sure our redirect behavior is correct. If we ever see a | 173 // TODO(abarth): Make sure our redirect behavior is correct. If we ever see a |
| 173 // non-HTTPS resource in the redirect chain, we want to trigger | 174 // non-HTTPS resource in the redirect chain, we want to trigger |
| 174 // insecure content, even if the redirect chain goes back to | 175 // insecure content, even if the redirect chain goes back to |
| 175 // HTTPS. This is because the network attacker can redirect the | 176 // HTTPS. This is because the network attacker can redirect the |
| 176 // HTTP request to https://attacker.com/payload.js. | 177 // HTTP request to https://attacker.com/payload.js. |
| 177 } | 178 } |
| 178 | 179 |
| 179 void SSLManager::UpdateEntry(NavigationEntryImpl* entry) { | 180 bool SSLManager::UpdateEntry(NavigationEntryImpl* entry) { |
| 180 // We don't always have a navigation entry to update, for example in the | 181 // We don't always have a navigation entry to update, for example in the |
| 181 // case of the Web Inspector. | 182 // case of the Web Inspector. |
| 182 if (!entry) | 183 if (!entry) |
| 183 return; | 184 return false; |
| 184 | 185 |
| 185 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! | 186 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! |
| 186 | 187 |
| 188 policy()->UpdateEntry(entry, controller_->delegate()->GetWebContents()); | |
| 189 | |
| 190 if (entry->GetSSL().Equals(original_ssl_status)) | |
| 191 return false; | |
| 192 | |
| 193 NotifyDidChangeVisibleSSLState(); | |
| 194 return true; | |
| 195 } | |
| 196 | |
| 197 void SSLManager::NotifyDidChangeVisibleSSLState() { | |
| 187 WebContentsImpl* contents = | 198 WebContentsImpl* contents = |
| 188 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); | 199 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); |
| 189 policy()->UpdateEntry(entry, contents); | 200 contents->DidChangeVisibleSSLState(); |
| 190 | |
| 191 if (!entry->GetSSL().Equals(original_ssl_status)) | |
| 192 contents->DidChangeVisibleSSLState(); | |
| 193 } | 201 } |
| 194 | 202 |
| 195 } // namespace content | 203 } // namespace content |
| OLD | NEW |