| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 static SiteInstance* CreateForURL( | 128 static SiteInstance* CreateForURL( |
| 129 content::BrowserContext* browser_context, const GURL& url); | 129 content::BrowserContext* browser_context, const GURL& url); |
| 130 | 130 |
| 131 // Return whether both URLs are part of the same web site, for the purpose of | 131 // Return whether both URLs are part of the same web site, for the purpose of |
| 132 // assigning them to processes accordingly. The decision is currently based | 132 // assigning them to processes accordingly. The decision is currently based |
| 133 // on the registered domain of the URLs (google.com, bbc.co.uk), as well as | 133 // on the registered domain of the URLs (google.com, bbc.co.uk), as well as |
| 134 // the scheme (https, http). This ensures that two pages will be in | 134 // the scheme (https, http). This ensures that two pages will be in |
| 135 // the same process if they can communicate with other via JavaScript. | 135 // the same process if they can communicate with other via JavaScript. |
| 136 // (e.g., docs.google.com and mail.google.com have DOM access to each other | 136 // (e.g., docs.google.com and mail.google.com have DOM access to each other |
| 137 // if they both set their document.domain properties to google.com.) | 137 // if they both set their document.domain properties to google.com.) |
| 138 // Note that if the destination is a blank page, we consider that to be part |
| 139 // of the same web site for the purposes for process assignment. |
| 138 static bool IsSameWebSite(content::BrowserContext* browser_context, | 140 static bool IsSameWebSite(content::BrowserContext* browser_context, |
| 139 const GURL& url1, const GURL& url2); | 141 const GURL& src_url, |
| 142 const GURL& dest_url); |
| 140 | 143 |
| 141 // Returns the site for the given URL, which includes only the scheme and | 144 // Returns the site for the given URL, which includes only the scheme and |
| 142 // registered domain. Returns an empty GURL if the URL has no host. | 145 // registered domain. Returns an empty GURL if the URL has no host. |
| 143 static GURL GetSiteForURL(BrowserContext* context, const GURL& url); | 146 static GURL GetSiteForURL(BrowserContext* context, const GURL& url); |
| 144 | 147 |
| 145 protected: | 148 protected: |
| 146 friend class base::RefCounted<SiteInstance>; | 149 friend class base::RefCounted<SiteInstance>; |
| 147 | 150 |
| 148 SiteInstance() {} | 151 SiteInstance() {} |
| 149 virtual ~SiteInstance() {} | 152 virtual ~SiteInstance() {} |
| 150 }; | 153 }; |
| 151 | 154 |
| 152 } // namespace content. | 155 } // namespace content. |
| 153 | 156 |
| 154 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ | 157 #endif // CONTENT_PUBLIC_BROWSER_SITE_INSTANCE_H_ |
| OLD | NEW |