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 "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "content/public/browser/render_process_host_observer.h" | 10 #include "content/public/browser/render_process_host_observer.h" |
11 #include "content/public/browser/site_instance.h" | 11 #include "content/public/browser/site_instance.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class BrowsingInstance; | 15 class BrowsingInstance; |
16 class RenderProcessHostFactory; | 16 class RenderProcessHostFactory; |
17 | 17 |
18 class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance, | 18 class CONTENT_EXPORT SiteInstanceImpl : public SiteInstance, |
19 public RenderProcessHostObserver { | 19 public RenderProcessHostObserver { |
20 public: | 20 public: |
21 // SiteInstance interface overrides. | 21 // SiteInstance interface overrides. |
22 virtual int32 GetId() OVERRIDE; | 22 virtual int32 GetId() override; |
23 virtual bool HasProcess() const OVERRIDE; | 23 virtual bool HasProcess() const override; |
24 virtual RenderProcessHost* GetProcess() OVERRIDE; | 24 virtual RenderProcessHost* GetProcess() override; |
25 virtual BrowserContext* GetBrowserContext() const OVERRIDE; | 25 virtual BrowserContext* GetBrowserContext() const override; |
26 virtual const GURL& GetSiteURL() const OVERRIDE; | 26 virtual const GURL& GetSiteURL() const override; |
27 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) OVERRIDE; | 27 virtual SiteInstance* GetRelatedSiteInstance(const GURL& url) override; |
28 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) OVERRIDE; | 28 virtual bool IsRelatedSiteInstance(const SiteInstance* instance) override; |
29 virtual size_t GetRelatedActiveContentsCount() OVERRIDE; | 29 virtual size_t GetRelatedActiveContentsCount() override; |
30 | 30 |
31 // Set the web site that this SiteInstance is rendering pages for. | 31 // Set the web site that this SiteInstance is rendering pages for. |
32 // This includes the scheme and registered domain, but not the port. If the | 32 // This includes the scheme and registered domain, but not the port. If the |
33 // URL does not have a valid registered domain, then the full hostname is | 33 // URL does not have a valid registered domain, then the full hostname is |
34 // stored. | 34 // stored. |
35 void SetSite(const GURL& url); | 35 void SetSite(const GURL& url); |
36 bool HasSite() const; | 36 bool HasSite() const; |
37 | 37 |
38 // Returns whether there is currently a related SiteInstance (registered with | 38 // Returns whether there is currently a related SiteInstance (registered with |
39 // BrowsingInstance) for the site of the given url. If so, we should try to | 39 // BrowsingInstance) for the site of the given url. If so, we should try to |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Virtual to allow tests to extend it. | 91 // Virtual to allow tests to extend it. |
92 virtual ~SiteInstanceImpl(); | 92 virtual ~SiteInstanceImpl(); |
93 | 93 |
94 // Create a new SiteInstance. Protected to give access to BrowsingInstance | 94 // Create a new SiteInstance. Protected to give access to BrowsingInstance |
95 // and tests; most callers should use Create or GetRelatedSiteInstance | 95 // and tests; most callers should use Create or GetRelatedSiteInstance |
96 // instead. | 96 // instead. |
97 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); | 97 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); |
98 | 98 |
99 private: | 99 private: |
100 // RenderProcessHostObserver implementation. | 100 // RenderProcessHostObserver implementation. |
101 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) OVERRIDE; | 101 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) override; |
102 | 102 |
103 // Used to restrict a process' origin access rights. | 103 // Used to restrict a process' origin access rights. |
104 void LockToOrigin(); | 104 void LockToOrigin(); |
105 | 105 |
106 // An object used to construct RenderProcessHosts. | 106 // An object used to construct RenderProcessHosts. |
107 static const RenderProcessHostFactory* g_render_process_host_factory_; | 107 static const RenderProcessHostFactory* g_render_process_host_factory_; |
108 | 108 |
109 // The next available SiteInstance ID. | 109 // The next available SiteInstance ID. |
110 static int32 next_site_instance_id_; | 110 static int32 next_site_instance_id_; |
111 | 111 |
(...skipping 17 matching lines...) Expand all Loading... |
129 | 129 |
130 // Whether SetSite has been called. | 130 // Whether SetSite has been called. |
131 bool has_site_; | 131 bool has_site_; |
132 | 132 |
133 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); | 133 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); |
134 }; | 134 }; |
135 | 135 |
136 } // namespace content | 136 } // namespace content |
137 | 137 |
138 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ | 138 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
OLD | NEW |