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 865ca6027a2e631637056b803fff0a9b7f724c20..30ac105e60d17742988f0aef0bda699c04b9ef31 100644 |
| --- a/content/browser/ssl/ssl_manager.cc |
| +++ b/content/browser/ssl/ssl_manager.cc |
| @@ -21,6 +21,7 @@ |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/load_from_memory_cache_details.h" |
| #include "content/public/browser/navigation_details.h" |
| +#include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/resource_request_details.h" |
| #include "content/public/common/ssl_status.h" |
| #include "net/url_request/url_request.h" |
| @@ -79,6 +80,31 @@ void SSLManager::OnSSLCertificateError( |
| } |
| // static |
| +void SSLManager::OnAuthDialog(int render_process_id, |
| + int render_frame_id, |
| + const std::string& serialized_security_info, |
| + bool is_main_frame) { |
| + if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
|
Charlie Reis
2015/03/18 17:46:38
Please have a separate method for the UI thread ve
palmer
2015/09/29 00:03:33
The sole call site is on the IO thread. Making the
|
| + BrowserThread::PostTask( |
| + BrowserThread::UI, FROM_HERE, |
| + base::Bind(SSLManager::OnAuthDialog, render_process_id, render_frame_id, |
| + serialized_security_info, is_main_frame)); |
| + return; |
| + } |
| + RenderFrameHost* render_frame_host = |
| + RenderFrameHostImpl::FromID(render_process_id, render_frame_id); |
| + WebContents* web_contents = |
| + WebContents::FromRenderFrameHost(render_frame_host); |
| + if (!web_contents) |
| + return; |
| + NavigationControllerImpl* controller = |
| + static_cast<NavigationControllerImpl*>(&web_contents->GetController()); |
| + NavigationEntryImpl* entry = controller->GetPendingEntry(); |
|
Charlie Reis
2015/03/18 17:46:38
If you've just done a PostTask to get here, then t
palmer
2015/09/29 00:03:33
Added a comment on the other CL.
|
| + 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)); |
| @@ -112,33 +138,33 @@ SSLManager::~SSLManager() { |
| void SSLManager::DidCommitProvisionalLoad(const LoadCommittedDetails& details) { |
| NavigationEntryImpl* entry = 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); |