Chromium Code Reviews| 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_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "content/browser/site_instance.h" | 12 #include "content/browser/site_instance_impl.h" |
| 13 #include "content/common/content_export.h" | 13 #include "content/common/content_export.h" |
| 14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
| 16 #include "content/public/browser/render_view_host_delegate.h" | 16 #include "content/public/browser/render_view_host_delegate.h" |
| 17 | 17 |
| 18 class InterstitialPage; | 18 class InterstitialPage; |
| 19 class NavigationControllerImpl; | 19 class NavigationControllerImpl; |
| 20 class RenderViewHost; | 20 class RenderViewHost; |
| 21 class RenderWidgetHostView; | 21 class RenderWidgetHostView; |
| 22 class WebUIImpl; | 22 class WebUIImpl; |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 class BrowserContext; | 25 class BrowserContext; |
| 26 class NavigationEntry; | 26 class NavigationEntry; |
| 27 class NavigationEntryImpl; | 27 class NavigationEntryImpl; |
| 28 class SiteInstance; | |
|
jam
2012/01/24 03:29:33
nit: not needed since you include the impl header
ananta
2012/01/24 23:46:26
Done.
| |
| 28 } | 29 } |
| 29 | 30 |
| 30 // Manages RenderViewHosts for a TabContents. Normally there is only one and | 31 // Manages RenderViewHosts for a TabContents. Normally there is only one and |
| 31 // it is easy to do. But we can also have transitions of processes (and hence | 32 // it is easy to do. But we can also have transitions of processes (and hence |
| 32 // RenderViewHosts) that can get complex. | 33 // RenderViewHosts) that can get complex. |
| 33 class CONTENT_EXPORT RenderViewHostManager | 34 class CONTENT_EXPORT RenderViewHostManager |
| 34 : public content::RenderViewHostDelegate::RendererManagement, | 35 : public content::RenderViewHostDelegate::RendererManagement, |
| 35 public content::NotificationObserver { | 36 public content::NotificationObserver { |
| 36 public: | 37 public: |
| 37 // Functions implemented by our owner that we need. | 38 // Functions implemented by our owner that we need. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 // They must outlive this class. The RenderViewHostDelegate is what will be | 95 // They must outlive this class. The RenderViewHostDelegate is what will be |
| 95 // installed into all RenderViewHosts that are created. | 96 // installed into all RenderViewHosts that are created. |
| 96 // | 97 // |
| 97 // You must call Init() before using this class. | 98 // You must call Init() before using this class. |
| 98 RenderViewHostManager(content::RenderViewHostDelegate* render_view_delegate, | 99 RenderViewHostManager(content::RenderViewHostDelegate* render_view_delegate, |
| 99 Delegate* delegate); | 100 Delegate* delegate); |
| 100 virtual ~RenderViewHostManager(); | 101 virtual ~RenderViewHostManager(); |
| 101 | 102 |
| 102 // For arguments, see TabContents constructor. | 103 // For arguments, see TabContents constructor. |
| 103 void Init(content::BrowserContext* browser_context, | 104 void Init(content::BrowserContext* browser_context, |
| 104 SiteInstance* site_instance, | 105 content::SiteInstance* site_instance, |
| 105 int routing_id); | 106 int routing_id); |
| 106 | 107 |
| 107 // Returns the currently active RenderViewHost. | 108 // Returns the currently active RenderViewHost. |
| 108 // | 109 // |
| 109 // This will be non-NULL between Init() and Shutdown(). You may want to NULL | 110 // This will be non-NULL between Init() and Shutdown(). You may want to NULL |
| 110 // check it in many cases, however. Windows can send us messages during the | 111 // check it in many cases, however. Windows can send us messages during the |
| 111 // destruction process after it has been shut down. | 112 // destruction process after it has been shut down. |
| 112 RenderViewHost* current_host() const { | 113 RenderViewHost* current_host() const { |
| 113 return render_view_host_; | 114 return render_view_host_; |
| 114 } | 115 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 213 // RenderProcessHosts) even if the site instance would otherwise be the same. | 214 // RenderProcessHosts) even if the site instance would otherwise be the same. |
| 214 // As part of this, we'll also force new SiteInstances and BrowsingInstances. | 215 // As part of this, we'll also force new SiteInstances and BrowsingInstances. |
| 215 // Either of the entries may be NULL. | 216 // Either of the entries may be NULL. |
| 216 bool ShouldSwapProcessesForNavigation( | 217 bool ShouldSwapProcessesForNavigation( |
| 217 const content::NavigationEntry* cur_entry, | 218 const content::NavigationEntry* cur_entry, |
| 218 const content::NavigationEntryImpl* new_entry) const; | 219 const content::NavigationEntryImpl* new_entry) const; |
| 219 | 220 |
| 220 // Returns an appropriate SiteInstance object for the given NavigationEntry, | 221 // Returns an appropriate SiteInstance object for the given NavigationEntry, |
| 221 // possibly reusing the current SiteInstance. | 222 // possibly reusing the current SiteInstance. |
| 222 // Never called if --process-per-tab is used. | 223 // Never called if --process-per-tab is used. |
| 223 SiteInstance* GetSiteInstanceForEntry( | 224 content::SiteInstance* GetSiteInstanceForEntry( |
| 224 const content::NavigationEntryImpl& entry, | 225 const content::NavigationEntryImpl& entry, |
| 225 SiteInstance* curr_instance); | 226 content::SiteInstance* curr_instance); |
| 226 | 227 |
| 227 // Helper method to create a pending RenderViewHost for a cross-site | 228 // Helper method to create a pending RenderViewHost for a cross-site |
| 228 // navigation. | 229 // navigation. |
| 229 bool CreatePendingRenderView(const content::NavigationEntryImpl& entry, | 230 bool CreatePendingRenderView(const content::NavigationEntryImpl& entry, |
| 230 SiteInstance* instance); | 231 content::SiteInstance* instance); |
| 231 | 232 |
| 232 // Sets up the necessary state for a new RenderViewHost navigating to the | 233 // Sets up the necessary state for a new RenderViewHost navigating to the |
| 233 // given entry. | 234 // given entry. |
| 234 bool InitRenderView(RenderViewHost* render_view_host, | 235 bool InitRenderView(RenderViewHost* render_view_host, |
| 235 const content::NavigationEntryImpl& entry); | 236 const content::NavigationEntryImpl& entry); |
| 236 | 237 |
| 237 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this | 238 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this |
| 238 // doesn't require the pending render_view_host_ pointer to be non-NULL, since | 239 // doesn't require the pending render_view_host_ pointer to be non-NULL, since |
| 239 // there could be Web UI switching as well. Call this for every commit. | 240 // there could be Web UI switching as well. Call this for every commit. |
| 240 void CommitPending(); | 241 void CommitPending(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 // The intersitial page currently shown if any, not own by this class | 287 // The intersitial page currently shown if any, not own by this class |
| 287 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 288 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
| 288 InterstitialPage* interstitial_page_; | 289 InterstitialPage* interstitial_page_; |
| 289 | 290 |
| 290 content::NotificationRegistrar registrar_; | 291 content::NotificationRegistrar registrar_; |
| 291 | 292 |
| 292 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 293 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
| 293 }; | 294 }; |
| 294 | 295 |
| 295 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 296 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| OLD | NEW |