| 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 policy()->UpdateEntry(entry, controller_->delegate()->GetWebContents()); | 124 UpdateEntry(entry); |
| 125 // Always notify the WebContents that the SSL state changed when a | |
| 126 // load is committed, in case the active navigation entry has changed. | |
| 127 NotifyDidChangeVisibleSSLState(); | |
| 128 } | 125 } |
| 129 | 126 |
| 130 void SSLManager::DidDisplayInsecureContent() { | 127 void SSLManager::DidDisplayInsecureContent() { |
| 131 UpdateEntry(controller_->GetLastCommittedEntry()); | 128 UpdateEntry(controller_->GetLastCommittedEntry()); |
| 132 } | 129 } |
| 133 | 130 |
| 134 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { | 131 void SSLManager::DidRunInsecureContent(const std::string& security_origin) { |
| 135 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); | 132 NavigationEntryImpl* navigation_entry = controller_->GetLastCommittedEntry(); |
| 136 policy()->DidRunInsecureContent(navigation_entry, security_origin); | 133 policy()->DidRunInsecureContent(navigation_entry, security_origin); |
| 137 UpdateEntry(navigation_entry); | 134 UpdateEntry(navigation_entry); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 177 } |
| 181 | 178 |
| 182 void SSLManager::UpdateEntry(NavigationEntryImpl* entry) { | 179 void SSLManager::UpdateEntry(NavigationEntryImpl* entry) { |
| 183 // We don't always have a navigation entry to update, for example in the | 180 // We don't always have a navigation entry to update, for example in the |
| 184 // case of the Web Inspector. | 181 // case of the Web Inspector. |
| 185 if (!entry) | 182 if (!entry) |
| 186 return; | 183 return; |
| 187 | 184 |
| 188 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! | 185 SSLStatus original_ssl_status = entry->GetSSL(); // Copy! |
| 189 | 186 |
| 190 policy()->UpdateEntry(entry, controller_->delegate()->GetWebContents()); | 187 WebContentsImpl* contents = |
| 188 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); |
| 189 policy()->UpdateEntry(entry, contents); |
| 191 | 190 |
| 192 if (!entry->GetSSL().Equals(original_ssl_status)) | 191 if (!entry->GetSSL().Equals(original_ssl_status)) |
| 193 NotifyDidChangeVisibleSSLState(); | 192 contents->DidChangeVisibleSSLState(); |
| 194 } | |
| 195 | |
| 196 void SSLManager::NotifyDidChangeVisibleSSLState() { | |
| 197 WebContentsImpl* contents = | |
| 198 static_cast<WebContentsImpl*>(controller_->delegate()->GetWebContents()); | |
| 199 contents->DidChangeVisibleSSLState(); | |
| 200 } | 193 } |
| 201 | 194 |
| 202 } // namespace content | 195 } // namespace content |
| OLD | NEW |