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

Unified Diff: components/password_manager/core/browser/hsts_query.cc

Issue 2714543006: Clean Obsolete HTTP Data from the Password Store (Closed)
Patch Set: Fix BUILD.dn, exclude compilation on iOS 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: components/password_manager/core/browser/hsts_query.cc
diff --git a/components/password_manager/core/browser/hsts_query.cc b/components/password_manager/core/browser/hsts_query.cc
new file mode 100644
index 0000000000000000000000000000000000000000..24810d3220cc79b34404b741c48be0c7b07d9993
--- /dev/null
+++ b/components/password_manager/core/browser/hsts_query.cc
@@ -0,0 +1,44 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/core/browser/hsts_query.h"
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/task_runner_util.h"
+#include "net/url_request/url_request_context.h"
+#include "url/gurl.h"
+
+namespace password_manager {
+
+namespace {
+
+bool IsHSTSActiveForHostAndRequestContext(
+ const GURL& origin,
+ const scoped_refptr<net::URLRequestContextGetter>& request_context) {
+ 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
+
+void PostHSTSQueryForHostAndRequestContext(
+ const GURL& origin,
+ const scoped_refptr<net::URLRequestContextGetter>& request_context,
+ const HSTSCallback& callback) {
+ base::PostTaskAndReplyWithResult(
+ request_context->GetNetworkTaskRunner().get(), FROM_HERE,
+ base::Bind(&IsHSTSActiveForHostAndRequestContext, origin,
+ request_context),
+ callback);
+}
+
+} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698