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..7b97189a0f6517d6cbf9265d8a0aa79d96224d8b 100644 |
| --- a/content/browser/ssl/ssl_manager.cc |
| +++ b/content/browser/ssl/ssl_manager.cc |
| @@ -80,6 +80,38 @@ 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; |
| + } |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
|
nasko
2014/07/24 09:32:34
This DCHECK seems useless because of the if statem
meacer
2014/07/24 17:32:32
Done.
|
| + RenderFrameHost* host = |
| + RenderFrameHostImpl::FromID(render_process_id, render_frame_host); |
| + WebContentsImpl* web_contents = |
| + static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(host)); |
|
nasko
2014/07/24 09:32:34
Why do you need to cast this? GetController() is a
meacer
2014/07/24 17:32:32
I agree it's confusing. It's now casting Navigatio
|
| + if (!web_contents) |
| + return; |
| + |
| + NavigationControllerImpl* controller = &web_contents->GetController(); |
|
nasko
2014/07/24 09:32:34
Ah, this is the place where a cast will be needed.
meacer
2014/07/24 17:32:32
Acknowledged.
|
| + NavigationEntryImpl* entry = |
| + NavigationEntryImpl::FromNavigationEntry(controller->GetVisibleEntry()); |
| + |
| + scoped_ptr<SSLManager> ssl_manager(new SSLManager(controller)); |
|
nasko
2014/07/24 09:32:34
Why do we need to construct a SSLManager? The nav
meacer
2014/07/24 17:32:32
Done.
|
| + 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 +148,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, |
|
nasko
2014/07/24 09:32:34
nit: all params should be on new lines
meacer
2014/07/24 17:32:32
Done.
|
| + 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); |
| } |