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

Side by Side Diff: content/public/common/origin_util.cc

Issue 1049533002: Add IsOriginSecure and GURL::SchemeUsesTLS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One does not simply check schemes and hosts for membership in tiny sets... Created 5 years, 8 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 unified diff | Download patch
OLDNEW
(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()) {
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
OLDNEW
« no previous file with comments | « content/public/common/origin_util.h ('k') | url/gurl.h » ('j') | url/gurl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698