Chromium Code Reviews| Index: chrome/common/origin_util.cc |
| diff --git a/chrome/common/origin_util.cc b/chrome/common/origin_util.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c84180ba580879423a9203d3c8c6a6977f0e5f9c |
| --- /dev/null |
| +++ b/chrome/common/origin_util.cc |
| @@ -0,0 +1,33 @@ |
| +// Copyright (c) 2015 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 "chrome/common/origin_util.h" |
| + |
| +#include "content/public/common/url_constants.h" |
| +#include "extensions/common/constants.h" |
| +#include "net/base/net_util.h" |
| +#include "url/gurl.h" |
| + |
| +bool IsOriginSecure(const GURL& url) { |
| + if (url.SchemeUsesTLS() || url.SchemeIsFile()) |
|
markusheintz_
2015/04/15 14:12:36
hm ... I may remember something wrong here (sorry
palmer
2015/04/16 17:15:40
We decided that, as far as the browser can know, t
|
| + return true; |
| + |
| + if (url.SchemeIsFileSystem() && url.inner_url() && |
| + IsOriginSecure(*url.inner_url())) { |
| + return true; |
| + } |
| + |
| + std::string hostname = url.HostNoBrackets(); |
| + if (net::IsLocalhost(hostname) || net::IsLocalhostTLD(hostname)) |
|
estark
2015/04/15 00:35:52
Was just looking at this out of curiosity and noti
palmer
2015/04/16 17:15:40
Ah, thanks.
|
| + return true; |
| + |
| + std::string scheme = url.scheme(); |
| + if (scheme == content::kChromeUIScheme || |
| + scheme == extensions::kExtensionScheme || |
| + scheme == extensions::kExtensionResourceScheme) { |
| + return true; |
| + } |
| + |
| + return false; |
| +} |