| 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..a64ceaece5ea5188762ff46dfc50b16735bd8d36 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,40 @@ 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)) {
|
| + 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());
|
| + NavigationEntry* pending_entry = controller->GetPendingEntry();
|
| + ui::PageTransition transition = pending_entry->GetTransitionType();
|
| + // For non-user initiated navigations, auth dialog is displayed when the
|
| + // visible url points to the page that initiated the navigation and not the
|
| + // actual auth url. Update the pending entry in that case.
|
| + NavigationEntryImpl* entry =
|
| + (transition & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR)
|
| + ? NavigationEntryImpl::FromNavigationEntry(
|
| + controller->GetVisibleEntry())
|
| + : NavigationEntryImpl::FromNavigationEntry(pending_entry);
|
| + 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 +147,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);
|
|
|