| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_RENDERER_HOST_SITE_INSTANCE_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_SITE_INSTANCE_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_SITE_INSTANCE_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_SITE_INSTANCE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "content/browser/renderer_host/render_process_host.h" | 9 #include "content/browser/renderer_host/render_process_host.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Return whether both URLs are part of the same web site, for the purpose of | 141 // Return whether both URLs are part of the same web site, for the purpose of |
| 142 // assigning them to processes accordingly. The decision is currently based | 142 // assigning them to processes accordingly. The decision is currently based |
| 143 // on the registered domain of the URLs (google.com, bbc.co.uk), as well as | 143 // on the registered domain of the URLs (google.com, bbc.co.uk), as well as |
| 144 // the scheme (https, http). This ensures that two pages will be in | 144 // the scheme (https, http). This ensures that two pages will be in |
| 145 // the same process if they can communicate with other via JavaScript. | 145 // the same process if they can communicate with other via JavaScript. |
| 146 // (e.g., docs.google.com and mail.google.com have DOM access to each other | 146 // (e.g., docs.google.com and mail.google.com have DOM access to each other |
| 147 // if they both set their document.domain properties to google.com.) | 147 // if they both set their document.domain properties to google.com.) |
| 148 static bool IsSameWebSite(content::BrowserContext* browser_context, | 148 static bool IsSameWebSite(content::BrowserContext* browser_context, |
| 149 const GURL& url1, const GURL& url2); | 149 const GURL& url1, const GURL& url2); |
| 150 | 150 |
| 151 // Returns the renderer type for this URL. | |
| 152 static RenderProcessHost::Type RendererTypeForURL(const GURL& url); | |
| 153 | |
| 154 protected: | 151 protected: |
| 155 friend class base::RefCounted<SiteInstance>; | 152 friend class base::RefCounted<SiteInstance>; |
| 156 friend class BrowsingInstance; | 153 friend class BrowsingInstance; |
| 157 | 154 |
| 158 // Virtual to allow tests to extend it. | 155 // Virtual to allow tests to extend it. |
| 159 virtual ~SiteInstance(); | 156 virtual ~SiteInstance(); |
| 160 | 157 |
| 161 // Create a new SiteInstance. Protected to give access to BrowsingInstance | 158 // Create a new SiteInstance. Protected to give access to BrowsingInstance |
| 162 // and tests; most callers should use CreateSiteInstance or | 159 // and tests; most callers should use CreateSiteInstance or |
| 163 // GetRelatedSiteInstance instead. | 160 // GetRelatedSiteInstance instead. |
| 164 explicit SiteInstance(BrowsingInstance* browsing_instance); | 161 explicit SiteInstance(BrowsingInstance* browsing_instance); |
| 165 | 162 |
| 166 // Get the effective URL for the given actual URL. | 163 // Get the effective URL for the given actual URL. |
| 167 static GURL GetEffectiveURL(content::BrowserContext* browser_context, | 164 static GURL GetEffectiveURL(content::BrowserContext* browser_context, |
| 168 const GURL& url); | 165 const GURL& url); |
| 169 | 166 |
| 170 // Returns the type of renderer process this instance belongs in, for grouping | |
| 171 // purposes. | |
| 172 RenderProcessHost::Type GetRendererType(); | |
| 173 | |
| 174 private: | 167 private: |
| 175 // NotificationObserver implementation. | 168 // NotificationObserver implementation. |
| 176 virtual void Observe(int type, | 169 virtual void Observe(int type, |
| 177 const NotificationSource& source, | 170 const NotificationSource& source, |
| 178 const NotificationDetails& details); | 171 const NotificationDetails& details); |
| 179 | 172 |
| 180 // The next available SiteInstance ID. | 173 // The next available SiteInstance ID. |
| 181 static int32 next_site_instance_id_; | 174 static int32 next_site_instance_id_; |
| 182 | 175 |
| 183 // A unique ID for this SiteInstance. | 176 // A unique ID for this SiteInstance. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 206 // The web site that this SiteInstance is rendering pages for. | 199 // The web site that this SiteInstance is rendering pages for. |
| 207 GURL site_; | 200 GURL site_; |
| 208 | 201 |
| 209 // Whether SetSite has been called. | 202 // Whether SetSite has been called. |
| 210 bool has_site_; | 203 bool has_site_; |
| 211 | 204 |
| 212 DISALLOW_COPY_AND_ASSIGN(SiteInstance); | 205 DISALLOW_COPY_AND_ASSIGN(SiteInstance); |
| 213 }; | 206 }; |
| 214 | 207 |
| 215 #endif // CONTENT_BROWSER_RENDERER_HOST_SITE_INSTANCE_H_ | 208 #endif // CONTENT_BROWSER_RENDERER_HOST_SITE_INSTANCE_H_ |
| OLD | NEW |