OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // Return whether both URLs are part of the same web site, for the purpose of | 127 // Return whether both URLs are part of the same web site, for the purpose of |
128 // assigning them to processes accordingly. The decision is currently based | 128 // assigning them to processes accordingly. The decision is currently based |
129 // on the registered domain of the URLs (google.com, bbc.co.uk), as well as | 129 // on the registered domain of the URLs (google.com, bbc.co.uk), as well as |
130 // the scheme (https, http). This ensures that two pages will be in | 130 // the scheme (https, http). This ensures that two pages will be in |
131 // the same process if they can communicate with other via JavaScript. | 131 // the same process if they can communicate with other via JavaScript. |
132 // (e.g., docs.google.com and mail.google.com have DOM access to each other | 132 // (e.g., docs.google.com and mail.google.com have DOM access to each other |
133 // if they both set their document.domain properties to google.com.) | 133 // if they both set their document.domain properties to google.com.) |
134 static bool IsSameWebSite(content::BrowserContext* browser_context, | 134 static bool IsSameWebSite(content::BrowserContext* browser_context, |
135 const GURL& url1, const GURL& url2); | 135 const GURL& url1, const GURL& url2); |
136 | 136 |
| 137 // Returns the site for the given URL, which includes only the scheme and |
| 138 // registered domain. Returns an empty GURL if the URL has no host. |
| 139 static GURL GetSiteForURL(BrowserContext* context, const GURL& url); |
| 140 |
137 protected: | 141 protected: |
138 friend class base::RefCounted<SiteInstance>; | 142 friend class base::RefCounted<SiteInstance>; |
139 | 143 |
140 SiteInstance() {} | 144 SiteInstance() {} |
141 virtual ~SiteInstance() {} | 145 virtual ~SiteInstance() {} |
142 }; | 146 }; |
143 | 147 |
144 } // namespace content. | 148 } // namespace content. |
145 | 149 |
146 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ | 150 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ |
OLD | NEW |