Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "content/public/common/origin_util.h" | |
| 6 | |
| 7 #include <string.h> | |
| 8 | |
| 9 #include "content/public/common/url_constants.h" | |
| 10 #include "net/base/net_util.h" | |
| 11 #include "url/gurl.h" | |
| 12 | |
| 13 namespace content { | |
| 14 | |
| 15 bool IsOriginSecure(const GURL& url) { | |
| 16 if (url.SchemeUsesTLS() || url.SchemeIsFile()) | |
| 17 return true; | |
| 18 if (url.SchemeIsFileSystem() && url.inner_url() && | |
| 19 url.inner_url()->SchemeIsSecure()) { | |
|
davidben
2015/04/08 20:31:00
This should be IsOriginSecure(url.inner_url()), ri
| |
| 20 return true; | |
| 21 } | |
| 22 | |
| 23 std::string hostname = url.HostNoBrackets(); | |
| 24 if (net::IsLocalhost(hostname) || net::IsLocalhostTLD(hostname)) | |
| 25 return true; | |
| 26 | |
| 27 std::string scheme = url.scheme(); | |
| 28 if (scheme == content::kChromeUIScheme) | |
| 29 return true; | |
| 30 | |
| 31 return false; | |
| 32 } | |
| 33 | |
| 34 } // namespace content | |
| OLD | NEW |