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

Side by Side Diff: content/browser/isolated_origin_util.cc

Issue 2716583003: Rename Origin.unique() to opaque().
Patch Set: Update new uses post-rebase Created 3 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
OLDNEW
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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/browser/isolated_origin_util.h" 5 #include "content/browser/isolated_origin_util.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 8 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 13 matching lines...) Expand all
24 if (origin.port() != isolated_origin.port()) 24 if (origin.port() != isolated_origin.port())
25 return false; 25 return false;
26 26
27 // Subdomains of an isolated origin are considered to be in the same isolated 27 // Subdomains of an isolated origin are considered to be in the same isolated
28 // origin. 28 // origin.
29 return origin.DomainIs(isolated_origin.host()); 29 return origin.DomainIs(isolated_origin.host());
30 } 30 }
31 31
32 // static 32 // static
33 bool IsolatedOriginUtil::IsValidIsolatedOrigin(const url::Origin& origin) { 33 bool IsolatedOriginUtil::IsValidIsolatedOrigin(const url::Origin& origin) {
34 if (origin.unique()) 34 if (origin.opaque())
35 return false; 35 return false;
36 36
37 // Isolated origins should have HTTP or HTTPS schemes. Hosts in other 37 // Isolated origins should have HTTP or HTTPS schemes. Hosts in other
38 // schemes may not be compatible with subdomain matching. 38 // schemes may not be compatible with subdomain matching.
39 GURL origin_gurl = origin.GetURL(); 39 GURL origin_gurl = origin.GetURL();
40 if (!origin_gurl.SchemeIsHTTPOrHTTPS()) 40 if (!origin_gurl.SchemeIsHTTPOrHTTPS())
41 return false; 41 return false;
42 42
43 // IP addresses are allowed. 43 // IP addresses are allowed.
44 if (origin_gurl.HostIsIPAddress()) 44 if (origin_gurl.HostIsIPAddress())
(...skipping 13 matching lines...) Expand all
58 // For now, disallow hosts with a trailing dot. 58 // For now, disallow hosts with a trailing dot.
59 // TODO(alexmos): Enabling this would require carefully thinking about 59 // TODO(alexmos): Enabling this would require carefully thinking about
60 // whether hosts without a trailing dot should match it. 60 // whether hosts without a trailing dot should match it.
61 if (origin.host().back() == '.') 61 if (origin.host().back() == '.')
62 return false; 62 return false;
63 63
64 return true; 64 return true;
65 } 65 }
66 66
67 } // namespace content 67 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_dispatcher_host.cc ('k') | content/browser/renderer_host/database_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698