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 |