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

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

Issue 2228403003: content: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
« no previous file with comments | « content/child/worker_thread_registry.cc ('k') | content/public/test/download_test_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 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 "content/public/common/origin_util.h" 5 #include "content/public/common/origin_util.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/public/common/content_client.h" 10 #include "content/public/common/content_client.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 if (url.SchemeIsFileSystem() && url.inner_url() && 56 if (url.SchemeIsFileSystem() && url.inner_url() &&
57 IsOriginSecure(*url.inner_url())) { 57 IsOriginSecure(*url.inner_url())) {
58 return true; 58 return true;
59 } 59 }
60 60
61 std::string hostname = url.HostNoBrackets(); 61 std::string hostname = url.HostNoBrackets();
62 if (net::IsLocalhost(hostname)) 62 if (net::IsLocalhost(hostname))
63 return true; 63 return true;
64 64
65 if (ContainsKey(g_trustworthy_whitelist.Get().secure_schemes(), url.scheme())) 65 if (base::ContainsKey(g_trustworthy_whitelist.Get().secure_schemes(),
66 url.scheme()))
66 return true; 67 return true;
67 68
68 if (ContainsKey(g_trustworthy_whitelist.Get().secure_origins(), 69 if (base::ContainsKey(g_trustworthy_whitelist.Get().secure_origins(),
69 url.GetOrigin())) { 70 url.GetOrigin())) {
70 return true; 71 return true;
71 } 72 }
72 73
73 return false; 74 return false;
74 } 75 }
75 76
76 bool OriginCanAccessServiceWorkers(const GURL& url) { 77 bool OriginCanAccessServiceWorkers(const GURL& url) {
77 if (url.SchemeIsHTTPOrHTTPS() && IsOriginSecure(url)) 78 if (url.SchemeIsHTTPOrHTTPS() && IsOriginSecure(url))
78 return true; 79 return true;
79 80
80 if (ContainsKey(g_trustworthy_whitelist.Get().service_worker_schemes(), 81 if (base::ContainsKey(g_trustworthy_whitelist.Get().service_worker_schemes(),
81 url.scheme())) { 82 url.scheme())) {
82 return true; 83 return true;
83 } 84 }
84 85
85 return false; 86 return false;
86 } 87 }
87 88
88 void ResetSchemesAndOriginsWhitelistForTesting() { 89 void ResetSchemesAndOriginsWhitelistForTesting() {
89 g_trustworthy_whitelist.Get().Reset(); 90 g_trustworthy_whitelist.Get().Reset();
90 } 91 }
91 92
92 } // namespace content 93 } // namespace content
OLDNEW
« no previous file with comments | « content/child/worker_thread_registry.cc ('k') | content/public/test/download_test_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698