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

Unified Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 2721663002: Move Credentials when migrating to HSTS page (Closed)
Patch Set: More Explanation Created 3 years, 9 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: chrome/browser/password_manager/chrome_password_manager_client.cc
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc
index 30420b6e07831c2a4240248a4457220c9ebca61d..7e02fbb29d88f53daa2f061c6b598e9c71df784a 100644
--- a/chrome/browser/password_manager/chrome_password_manager_client.cc
+++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/singleton.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h"
@@ -50,6 +51,7 @@
#include "components/sessions/content/content_record_password_state.h"
#include "components/signin/core/browser/signin_manager.h"
#include "components/version_info/version_info.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
@@ -139,6 +141,22 @@ void ReportMetrics(bool password_manager_enabled,
profile->GetPrefs()));
}
+bool IsHSTSActiveForHostAndRequestContext(
+ const GURL& origin,
+ const scoped_refptr<net::URLRequestContextGetter>& request_context) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+ if (!origin.is_valid())
+ return false;
+
+ net::TransportSecurityState* security_state =
+ request_context->GetURLRequestContext()->transport_security_state();
+
+ if (!security_state)
+ return false;
+
+ return security_state->ShouldUpgradeToSSL(origin.host());
+}
+
} // namespace
// static
@@ -240,20 +258,14 @@ bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const {
IsPasswordManagementEnabledForCurrentPage();
}
-bool ChromePasswordManagerClient::IsHSTSActiveForHost(
- const GURL& origin) const {
- if (!origin.is_valid())
- return false;
-
- net::TransportSecurityState* security_state =
- profile_->GetRequestContext()
- ->GetURLRequestContext()
- ->transport_security_state();
-
- if (!security_state)
- return false;
-
- return security_state->ShouldUpgradeToSSL(origin.host());
+void ChromePasswordManagerClient::PostHSTSQueryForHost(
+ const GURL& origin,
+ const HSTSCallback& callback) const {
+ content::BrowserThread::PostTaskAndReplyWithResult(
+ content::BrowserThread::IO, FROM_HERE,
+ base::Bind(&IsHSTSActiveForHostAndRequestContext, origin,
+ make_scoped_refptr(profile_->GetRequestContext())),
+ callback);
}
bool ChromePasswordManagerClient::OnCredentialManagerUsed() {

Powered by Google App Engine
This is Rietveld 408576698