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 "content/common/content_export.h" |
| 9 #include "url/origin.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 class CONTENT_EXPORT IsolatedOriginUtil { |
| 14 public: |
| 15 // Checks whether |origin| matches the isolated origin specified by |
| 16 // |isolated_origin|. Subdomains are considered to match isolated origins, |
| 17 // so this will be true if |
| 18 // (1) |origin| has the same scheme, host, and port as |isolated_origin|, or |
| 19 // (2) |origin| has the same scheme and port as |isolated_origin|, and its |
| 20 // host is a subdomain of |isolated_origin|'s host. |
| 21 // This does not consider site URLs, which don't care about port. |
| 22 // |
| 23 // For example, if |isolated_origin| is https://isolated.foo.com, this will |
| 24 // return true if |origin| is https://isolated.foo.com or |
| 25 // https://bar.isolated.foo.com, but it will return false for an |origin| of |
| 26 // https://unisolated.foo.com or https://foo.com. |
| 27 static bool DoesOriginMatchIsolatedOrigin(const url::Origin& origin, |
| 28 const url::Origin& isolated_origin); |
| 29 |
| 30 // Check if |origin| is a valid isolated origin. Invalid isolated origins |
| 31 // include unique origins, origins that don't have an HTTP or HTTPS scheme, |
| 32 // and origins without a valid registry-controlled domain. IP addresses are |
| 33 // allowed. |
| 34 static bool IsValidIsolatedOrigin(const url::Origin& origin); |
| 35 }; |
| 36 |
| 37 } // namespace content |
| 38 |
| 39 #endif // CONTENT_BROWSER_ISOLATED_ORIGIN_UTIL_H_ |
OLD | NEW |