Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2262)

Unified Diff: content/browser/ssl/ssl_manager.cc

Issue 1368863002: Set SSL info when an HTTP auth dialog is triggered by direct navigation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to creis' comments on the other CL. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/ssl/ssl_manager.cc
diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc
index e4c71e3dc4e0f8b2c520afe4cb9d9979d51140d9..6d5ae82a4e9a93f1f2e5a06e71166962f0d6f5a7 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 SSLStatus& ssl_status,
+ bool is_main_frame) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(SSLManager::OnAuthDialogOnUI, render_process_id,
+ render_frame_id, ssl_status, is_main_frame));
+}
+
+// static
+void SSLManager::OnAuthDialogOnUI(int render_process_id,
+ int render_frame_id,
+ const SSLStatus& ssl_status,
+ bool is_main_frame) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ 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());
+ // TODO(palmer, creis, meacer): If you've just done a PostTask to get here,
+ // then there's no guarantee that the pending entry still exists or is for the
+ // same navigation. (It may have been discarded or replaced with a different
+ // one in the meantime.) Ensure this is safe.
+ NavigationEntryImpl* entry = controller->GetPendingEntry();
+ controller->ssl_manager()->UpdateEntry(ssl_status, is_main_frame, entry);
+}
+
+// static
void SSLManager::NotifySSLInternalStateChanged(BrowserContext* context) {
SSLManagerSet* managers = static_cast<SSLManagerSet*>(
context->GetUserData(kSSLManagerKeyName));
@@ -112,13 +147,22 @@ SSLManager::~SSLManager() {
void SSLManager::DidCommitProvisionalLoad(const LoadCommittedDetails& details) {
NavigationEntryImpl* entry = controller_->GetLastCommittedEntry();
+ UpdateEntry(details.ssl_status, details.is_main_frame, entry);
+}
- if (details.is_main_frame) {
- if (entry) {
- // We may not have an entry if this is a navigation to an initial blank
- // page. Add the new data we have.
- entry->GetSSL() = details.ssl_status;
- }
+void SSLManager::UpdateEntry(const SSLStatus& ssl_status,
+ bool is_main_frame,
+ NavigationEntryImpl* entry) {
+ if (is_main_frame && entry) {
+ // 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_status.cert_id;
+ entry->GetSSL().cert_status = ssl_status.cert_status;
+ entry->GetSSL().security_bits = ssl_status.security_bits;
+ entry->GetSSL().connection_status = ssl_status.connection_status;
+ entry->GetSSL().signed_certificate_timestamp_ids =
+ ssl_status.signed_certificate_timestamp_ids;
meacer 2015/09/29 00:17:02 estark added a constructor for SSLStatus, this can
palmer 2015/09/29 00:46:36 How shall we get the SecurityStyle argument?
meacer 2015/09/29 00:48:51 You can copy directly from ssl_status.security_sty
palmer 2015/09/29 00:56:46 Ah, right. But, now we are missing the SSLInfo...
}
policy()->UpdateEntry(entry, controller_->delegate()->GetWebContents());
« content/browser/loader/resource_loader.cc ('K') | « content/browser/ssl/ssl_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698