| 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_BROWSER_SITE_INSTANCE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ | 6 #define CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Called when the renderer process of this SiteInstance has exited. | 32 // Called when the renderer process of this SiteInstance has exited. |
| 33 virtual void RenderProcessGone(SiteInstanceImpl* site_instance) = 0; | 33 virtual void RenderProcessGone(SiteInstanceImpl* site_instance) = 0; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 static scoped_refptr<SiteInstanceImpl> Create( | 36 static scoped_refptr<SiteInstanceImpl> Create( |
| 37 BrowserContext* browser_context); | 37 BrowserContext* browser_context); |
| 38 static scoped_refptr<SiteInstanceImpl> CreateForURL( | 38 static scoped_refptr<SiteInstanceImpl> CreateForURL( |
| 39 BrowserContext* browser_context, | 39 BrowserContext* browser_context, |
| 40 const GURL& url); | 40 const GURL& url); |
| 41 static scoped_refptr<SiteInstanceImpl> FindOrCreateForURL( |
| 42 BrowserContext* browser_context, |
| 43 const GURL& url); |
| 41 | 44 |
| 42 // SiteInstance interface overrides. | 45 // SiteInstance interface overrides. |
| 43 int32_t GetId() override; | 46 int32_t GetId() override; |
| 44 bool HasProcess() const override; | 47 bool HasProcess() const override; |
| 45 RenderProcessHost* GetProcess() override; | 48 RenderProcessHost* GetProcess() override; |
| 46 BrowserContext* GetBrowserContext() const override; | 49 BrowserContext* GetBrowserContext() const override; |
| 47 const GURL& GetSiteURL() const override; | 50 const GURL& GetSiteURL() const override; |
| 48 scoped_refptr<SiteInstance> GetRelatedSiteInstance(const GURL& url) override; | 51 scoped_refptr<SiteInstance> GetRelatedSiteInstance(const GURL& url) override; |
| 49 bool IsRelatedSiteInstance(const SiteInstance* instance) override; | 52 bool IsRelatedSiteInstance(const SiteInstance* instance) override; |
| 50 size_t GetRelatedActiveContentsCount() override; | 53 size_t GetRelatedActiveContentsCount() override; |
| 51 bool RequiresDedicatedProcess() override; | 54 bool RequiresDedicatedProcess() override; |
| 52 bool IsDefaultSubframeSiteInstance() const override; | 55 bool IsDefaultSubframeSiteInstance() const override; |
| 53 | 56 |
| 54 // Returns the SiteInstance, related to this one, that should be used | 57 // Returns the SiteInstance, related to this one, that should be used |
| 55 // for subframes when an oopif is required, but a dedicated process is not. | 58 // for subframes when an oopif is required, but a dedicated process is not. |
| 56 // This SiteInstance will be created if it doesn't already exist. There is | 59 // This SiteInstance will be created if it doesn't already exist. There is |
| 57 // at most one of these per BrowsingInstance. | 60 // at most one of these per BrowsingInstance. |
| 58 scoped_refptr<SiteInstanceImpl> GetDefaultSubframeSiteInstance(); | 61 scoped_refptr<SiteInstanceImpl> GetDefaultSubframeSiteInstance(); |
| 59 | 62 |
| 60 // Set the web site that this SiteInstance is rendering pages for. | 63 // Set the web site that this SiteInstance is rendering pages for. |
| 61 // This includes the scheme and registered domain, but not the port. If the | 64 // This includes the scheme and registered domain, but not the port. If the |
| 62 // URL does not have a valid registered domain, then the full hostname is | 65 // URL does not have a valid registered domain, then the full hostname is |
| 63 // stored. | 66 // stored. |
| 64 void SetSite(const GURL& url); | 67 void SetSite(const GURL& url); |
| 65 bool HasSite() const; | 68 bool HasSite() const; |
| 66 | 69 |
| 70 void UsedFor(const GURL& url); |
| 71 |
| 67 // Returns whether there is currently a related SiteInstance (registered with | 72 // Returns whether there is currently a related SiteInstance (registered with |
| 68 // BrowsingInstance) for the site of the given url. If so, we should try to | 73 // BrowsingInstance) for the site of the given url. If so, we should try to |
| 69 // avoid dedicating an unused SiteInstance to it (e.g., in a new tab). | 74 // avoid dedicating an unused SiteInstance to it (e.g., in a new tab). |
| 70 bool HasRelatedSiteInstance(const GURL& url); | 75 bool HasRelatedSiteInstance(const GURL& url); |
| 71 | 76 |
| 72 // Returns whether this SiteInstance has a process that is the wrong type for | 77 // Returns whether this SiteInstance has a process that is the wrong type for |
| 73 // the given URL. If so, the browser should force a process swap when | 78 // the given URL. If so, the browser should force a process swap when |
| 74 // navigating to the URL. | 79 // navigating to the URL. |
| 75 bool HasWrongProcessForURL(const GURL& url); | 80 bool HasWrongProcessForURL(const GURL& url); |
| 76 | 81 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 GURL site_; | 183 GURL site_; |
| 179 | 184 |
| 180 // Whether SetSite has been called. | 185 // Whether SetSite has been called. |
| 181 bool has_site_; | 186 bool has_site_; |
| 182 | 187 |
| 183 // Whether this SiteInstance is the default subframe SiteInstance for its | 188 // Whether this SiteInstance is the default subframe SiteInstance for its |
| 184 // BrowsingInstance. Only one SiteInstance per BrowsingInstance can have this | 189 // BrowsingInstance. Only one SiteInstance per BrowsingInstance can have this |
| 185 // be true. | 190 // be true. |
| 186 bool is_default_subframe_site_instance_; | 191 bool is_default_subframe_site_instance_; |
| 187 | 192 |
| 193 std::set<std::string> sites_displayed_; |
| 194 |
| 188 base::ObserverList<Observer, true> observers_; | 195 base::ObserverList<Observer, true> observers_; |
| 189 | 196 |
| 190 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); | 197 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); |
| 191 }; | 198 }; |
| 192 | 199 |
| 193 } // namespace content | 200 } // namespace content |
| 194 | 201 |
| 195 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ | 202 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
| OLD | NEW |