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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // discarded to save memory. | 59 // discarded to save memory. |
60 size_t active_view_count() { return active_view_count_; } | 60 size_t active_view_count() { return active_view_count_; } |
61 | 61 |
62 // Sets the global factory used to create new RenderProcessHosts. It may be | 62 // Sets the global factory used to create new RenderProcessHosts. It may be |
63 // NULL, in which case the default BrowserRenderProcessHost will be created | 63 // NULL, in which case the default BrowserRenderProcessHost will be created |
64 // (this is the behavior if you don't call this function). The factory must | 64 // (this is the behavior if you don't call this function). The factory must |
65 // be set back to NULL before it's destroyed; ownership is not transferred. | 65 // be set back to NULL before it's destroyed; ownership is not transferred. |
66 static void set_render_process_host_factory( | 66 static void set_render_process_host_factory( |
67 const RenderProcessHostFactory* rph_factory); | 67 const RenderProcessHostFactory* rph_factory); |
68 | 68 |
| 69 // Get the effective URL for the given actual URL. This allows the |
| 70 // ContentBrowserClient to override the SiteInstance's site for certain URLs. |
| 71 // For example, Chrome uses this to replace hosted app URLs with extension |
| 72 // hosts. |
| 73 // Only public so that we can make a consistent process swap decision in |
| 74 // RenderViewHostManager. |
| 75 static GURL GetEffectiveURL(BrowserContext* browser_context, |
| 76 const GURL& url); |
| 77 |
69 protected: | 78 protected: |
70 friend class BrowsingInstance; | 79 friend class BrowsingInstance; |
71 friend class SiteInstance; | 80 friend class SiteInstance; |
72 | 81 |
73 // Virtual to allow tests to extend it. | 82 // Virtual to allow tests to extend it. |
74 virtual ~SiteInstanceImpl(); | 83 virtual ~SiteInstanceImpl(); |
75 | 84 |
76 // Create a new SiteInstance. Protected to give access to BrowsingInstance | 85 // Create a new SiteInstance. Protected to give access to BrowsingInstance |
77 // and tests; most callers should use Create or GetRelatedSiteInstance | 86 // and tests; most callers should use Create or GetRelatedSiteInstance |
78 // instead. | 87 // instead. |
79 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); | 88 explicit SiteInstanceImpl(BrowsingInstance* browsing_instance); |
80 | 89 |
81 private: | 90 private: |
82 // Get the effective URL for the given actual URL. | |
83 static GURL GetEffectiveURL(BrowserContext* browser_context, | |
84 const GURL& url); | |
85 | |
86 // RenderProcessHostObserver implementation. | 91 // RenderProcessHostObserver implementation. |
87 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) OVERRIDE; | 92 virtual void RenderProcessHostDestroyed(RenderProcessHost* host) OVERRIDE; |
88 | 93 |
89 // Used to restrict a process' origin access rights. | 94 // Used to restrict a process' origin access rights. |
90 void LockToOrigin(); | 95 void LockToOrigin(); |
91 | 96 |
92 // An object used to construct RenderProcessHosts. | 97 // An object used to construct RenderProcessHosts. |
93 static const RenderProcessHostFactory* g_render_process_host_factory_; | 98 static const RenderProcessHostFactory* g_render_process_host_factory_; |
94 | 99 |
95 // The next available SiteInstance ID. | 100 // The next available SiteInstance ID. |
(...skipping 19 matching lines...) Expand all Loading... |
115 | 120 |
116 // Whether SetSite has been called. | 121 // Whether SetSite has been called. |
117 bool has_site_; | 122 bool has_site_; |
118 | 123 |
119 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); | 124 DISALLOW_COPY_AND_ASSIGN(SiteInstanceImpl); |
120 }; | 125 }; |
121 | 126 |
122 } // namespace content | 127 } // namespace content |
123 | 128 |
124 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ | 129 #endif // CONTENT_BROWSER_SITE_INSTANCE_IMPL_H_ |
OLD | NEW |