Index: content/browser/isolated_origin_util.cc |
diff --git a/content/browser/isolated_origin_util.cc b/content/browser/isolated_origin_util.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..811ded12b16e488da3d24594b393fc59b9e28b49 |
--- /dev/null |
+++ b/content/browser/isolated_origin_util.cc |
@@ -0,0 +1,27 @@ |
+// Copyright (c) 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/isolated_origin_util.h" |
+ |
+#include "base/strings/string_util.h" |
+#include "url/gurl.h" |
+ |
+namespace content { |
+ |
+// static |
+bool IsolatedOriginUtil::DoesOriginMatchIsolatedOrigin( |
+ const url::Origin& origin, |
+ const url::Origin& isolated_origin) { |
+ if (origin.scheme() != isolated_origin.scheme()) |
+ return false; |
+ |
+ if (origin.port() != isolated_origin.port()) |
+ return false; |
+ |
+ // Subdomains of an isolated origin are considered to be in the same isolated |
+ // origin. |
+ return origin.GetURL().DomainIs(isolated_origin.host()); |
+} |
+ |
+} // namespace content |