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

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

Issue 1072933006: Support whitelisting to handle insecure origins as trustworthy origins (chromium) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test, added IsOriginSecure plumbing etc 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
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/origin_util.h" 5 #include "content/public/common/origin_util.h"
6 6
7 #include "content/public/common/url_constants.h"
8 #include "extensions/common/constants.h"
9 #include "net/base/net_util.h" 7 #include "net/base/net_util.h"
10 #include "url/gurl.h" 8 #include "url/gurl.h"
11 9
10 namespace content {
11
12 bool IsOriginSecure(const GURL& url) { 12 bool IsOriginSecure(const GURL& url) {
13 if (url.SchemeUsesTLS() || url.SchemeIsFile()) 13 if (url.SchemeUsesTLS() || url.SchemeIsFile())
14 return true; 14 return true;
15 15
16 if (url.SchemeIsFileSystem() && url.inner_url() && 16 if (url.SchemeIsFileSystem() && url.inner_url() &&
17 IsOriginSecure(*url.inner_url())) { 17 IsOriginSecure(*url.inner_url())) {
18 return true; 18 return true;
19 } 19 }
20 20
21 std::string hostname = url.HostNoBrackets(); 21 std::string hostname = url.HostNoBrackets();
22 if (net::IsLocalhost(hostname)) 22 if (net::IsLocalhost(hostname))
23 return true; 23 return true;
24 24
25 std::string scheme = url.scheme();
26 if (scheme == content::kChromeUIScheme ||
27 scheme == extensions::kExtensionScheme ||
28 scheme == extensions::kExtensionResourceScheme) {
29 return true;
30 }
31
32 return false; 25 return false;
33 } 26 }
27
28 } // namespace content
OLDNEW
« content/public/common/origin_util.h ('K') | « content/public/common/origin_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698