Chromium Code Reviews| Index: content/browser/ssl/ssl_manager.cc |
| diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc |
| index 68906ced1ec63ea7ec93480e429fc67c368e4afe..149981f752dcc2e447ad8cc9342b1c0c675ad8dc 100644 |
| --- a/content/browser/ssl/ssl_manager.cc |
| +++ b/content/browser/ssl/ssl_manager.cc |
| @@ -80,6 +80,34 @@ void SSLManager::OnSSLCertificateError( |
| } |
| // static |
| +void SSLManager::OnAuthDialog(int render_process_id, |
| + int render_frame_host, |
| + const std::string& serialized_security_info, |
| + bool is_main_frame) { |
| + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| + base::Bind(SSLManager::OnAuthDialog, |
| + render_process_id, |
| + render_frame_host, |
| + serialized_security_info, |
| + is_main_frame)); |
| + return; |
| + } |
| + RenderFrameHost* host = |
|
Charlie Reis
2014/07/24 18:39:32
nit: render_frame_host (once we've renamed the id
meacer
2014/07/24 18:48:32
Done.
|
| + RenderFrameHostImpl::FromID(render_process_id, render_frame_host); |
| + WebContents* web_contents = WebContents::FromRenderFrameHost(host); |
| + if (!web_contents) |
| + return; |
| + NavigationControllerImpl* controller = |
| + static_cast<NavigationControllerImpl*>(&web_contents->GetController()); |
| + NavigationEntryImpl* entry = |
| + NavigationEntryImpl::FromNavigationEntry(controller->GetVisibleEntry()); |
| + controller->ssl_manager()->UpdateEntry(serialized_security_info, |
| + is_main_frame, |
| + entry); |
| +} |
| + |
| +// static |
| void SSLManager::NotifySSLInternalStateChanged(BrowserContext* context) { |
| SSLManagerSet* managers = static_cast<SSLManagerSet*>( |
| context->GetUserData(kSSLManagerKeyName)); |
| @@ -116,35 +144,39 @@ void SSLManager::DidCommitProvisionalLoad(const LoadCommittedDetails& details) { |
| NavigationEntryImpl* entry = |
| NavigationEntryImpl::FromNavigationEntry( |
| controller_->GetLastCommittedEntry()); |
| + UpdateEntry(details.serialized_security_info, |
| + details.is_main_frame, |
| + entry); |
| +} |
| - if (details.is_main_frame) { |
| - if (entry) { |
| - // Decode the security details. |
| - int ssl_cert_id; |
| - net::CertStatus ssl_cert_status; |
| - int ssl_security_bits; |
| - int ssl_connection_status; |
| - SignedCertificateTimestampIDStatusList |
| - ssl_signed_certificate_timestamp_ids; |
| - DeserializeSecurityInfo(details.serialized_security_info, |
| - &ssl_cert_id, |
| - &ssl_cert_status, |
| - &ssl_security_bits, |
| - &ssl_connection_status, |
| - &ssl_signed_certificate_timestamp_ids); |
| - |
| - // We may not have an entry if this is a navigation to an initial blank |
| - // page. Reset the SSL information and add the new data we have. |
| - entry->GetSSL() = SSLStatus(); |
| - entry->GetSSL().cert_id = ssl_cert_id; |
| - entry->GetSSL().cert_status = ssl_cert_status; |
| - entry->GetSSL().security_bits = ssl_security_bits; |
| - entry->GetSSL().connection_status = ssl_connection_status; |
| - entry->GetSSL().signed_certificate_timestamp_ids = |
| - ssl_signed_certificate_timestamp_ids; |
| - } |
| +void SSLManager::UpdateEntry(const std::string& serialized_security_info, |
| + bool is_main_frame, |
| + NavigationEntryImpl* entry) { |
| + if (is_main_frame && entry) { |
| + // Decode the security details. |
| + int ssl_cert_id; |
| + net::CertStatus ssl_cert_status; |
| + int ssl_security_bits; |
| + int ssl_connection_status; |
| + SignedCertificateTimestampIDStatusList |
| + ssl_signed_certificate_timestamp_ids; |
| + DeserializeSecurityInfo(serialized_security_info, |
| + &ssl_cert_id, |
| + &ssl_cert_status, |
| + &ssl_security_bits, |
| + &ssl_connection_status, |
| + &ssl_signed_certificate_timestamp_ids); |
| + |
| + // We may not have an entry if this is a navigation to an initial blank |
| + // page. Reset the SSL information and add the new data we have. |
| + entry->GetSSL() = SSLStatus(); |
| + entry->GetSSL().cert_id = ssl_cert_id; |
| + entry->GetSSL().cert_status = ssl_cert_status; |
| + entry->GetSSL().security_bits = ssl_security_bits; |
| + entry->GetSSL().connection_status = ssl_connection_status; |
| + entry->GetSSL().signed_certificate_timestamp_ids = |
| + ssl_signed_certificate_timestamp_ids; |
| } |
| - |
| UpdateEntry(entry); |
| } |