OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ISOLATED_ORIGIN_UTIL_H_ |
| 6 #define CONTENT_BROWSER_ISOLATED_ORIGIN_UTIL_H_ |
| 7 |
| 8 #include "url/origin.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 class IsolatedOriginUtil { |
| 13 public: |
| 14 // Checks whether |origin| matches the isolated origin specified by |
| 15 // |isolated_origin|. Subdomains are considered to match isolated origins, |
| 16 // so this will be true if |
| 17 // (1) |origin| has the same scheme, host, and port as |isolated_origin|, or |
| 18 // (2) |origin| has the same scheme and port as |isolated_origin|, and its |
| 19 // host is a subdomain of |isolated_origin|'s host. |
| 20 // This does not consider site URLs, which don't care about port. |
| 21 // |
| 22 // For example, if |isolated_origin| is https://isolated.foo.com, this will |
| 23 // return true if |origin| is https://isolated.foo.com or |
| 24 // https://bar.isolated.foo.com, but it will return false for an |origin| of |
| 25 // https://unisolated.foo.com or https://foo.com. |
| 26 static bool DoesOriginMatchIsolatedOrigin(const url::Origin& origin, |
| 27 const url::Origin& isolated_origin); |
| 28 }; |
| 29 |
| 30 } // namespace content |
| 31 |
| 32 #endif // CONTENT_BROWSER_ISOLATED_ORIGIN_UTIL_H_ |
OLD | NEW |