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

Unified Diff: content/common/url_schemes.cc

Issue 1049533002: Add IsOriginSecure and GURL::SchemeUsesTLS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move it to content::, so we can call into net:: and blink::. Created 5 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
« no previous file with comments | « content/common/url_schemes.h ('k') | url/gurl.h » ('j') | url/gurl.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/url_schemes.cc
diff --git a/content/common/url_schemes.cc b/content/common/url_schemes.cc
index c65bb14562de2f2c0f182c6882bc9d9d808e4205..2038fe83122ff85449ab8b1aad8d1fc1641324b3 100644
--- a/content/common/url_schemes.cc
+++ b/content/common/url_schemes.cc
@@ -12,9 +12,14 @@
#include "base/basictypes.h"
#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
#include "content/common/savable_url_schemes.h"
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
+#include "net/base/net_util.h"
+#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
+#include "url/gurl.h"
#include "url/url_util.h"
namespace {
@@ -74,4 +79,19 @@ void RegisterContentSchemes(bool lock_standard_schemes) {
}
}
+bool IsOriginSecure(const GURL& url) {
+ if (url.SchemeIsSecure())
+ return true;
+
+ std::string hostname = url.host();
+ if (net::IsLocalhost(hostname) || net::IsLocalhostTLD(hostname))
+ return true;
+
+ blink::WebString scheme(base::ASCIIToUTF16(url.scheme()));
+ if (blink::WebSecurityPolicy::shouldTreatURLSchemeAsSecure(scheme))
tkent 2015/04/05 22:31:38 Does this code run in the browser process? If so,
+ return true;
+
+ return false;
+}
+
} // namespace content
« no previous file with comments | « content/common/url_schemes.h ('k') | url/gurl.h » ('j') | url/gurl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698