| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/renderer_host/render_view_host.h" | 10 #include "chrome/browser/renderer_host/render_view_host.h" |
| 11 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 11 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 12 #include "chrome/common/notification_registrar.h" | 12 #include "chrome/common/notification_registrar.h" |
| 13 #include "chrome/common/notification_observer.h" | 13 #include "chrome/common/notification_observer.h" |
| 14 | 14 |
| 15 class DOMUI; | 15 class DOMUI; |
| 16 class InterstitialPage; | 16 class InterstitialPage; |
| 17 class NavigationController; | 17 class NavigationController; |
| 18 class NavigationEntry; | 18 class NavigationEntry; |
| 19 class Profile; | 19 class Profile; |
| 20 class RenderWidgetHostView; | 20 class RenderWidgetHostView; |
| 21 class SiteInstance; | 21 class SiteInstance; |
| 22 struct RenderViewHostSwitchedDetails; |
| 22 | 23 |
| 23 // Manages RenderViewHosts for a TabContents. Normally there is only one and | 24 // Manages RenderViewHosts for a TabContents. Normally there is only one and |
| 24 // it is easy to do. But we can also have transitions of processes (and hence | 25 // it is easy to do. But we can also have transitions of processes (and hence |
| 25 // RenderViewHosts) that can get complex. | 26 // RenderViewHosts) that can get complex. |
| 26 class RenderViewHostManager | 27 class RenderViewHostManager |
| 27 : public RenderViewHostDelegate::RendererManagement { | 28 : public RenderViewHostDelegate::RendererManagement { |
| 28 public: | 29 public: |
| 29 // Functions implemented by our owner that we need. | 30 // Functions implemented by our owner that we need. |
| 30 // | 31 // |
| 31 // TODO(brettw) Clean this up! These are all the functions in TabContents that | 32 // TODO(brettw) Clean this up! These are all the functions in TabContents that |
| 32 // are required to run this class. The design should probably be better such | 33 // are required to run this class. The design should probably be better such |
| 33 // that these are more clear. | 34 // that these are more clear. |
| 34 // | 35 // |
| 35 // There is additional complexity that some of the functions we need in | 36 // There is additional complexity that some of the functions we need in |
| 36 // TabContents are inherited and non-virtual. These are named with | 37 // TabContents are inherited and non-virtual. These are named with |
| 37 // "RenderManager" so that the duplicate implementation of them will be clear. | 38 // "RenderManager" so that the duplicate implementation of them will be clear. |
| 38 class Delegate { | 39 class Delegate { |
| 39 public: | 40 public: |
| 41 virtual Profile* GetProfileForRenderManager() const = 0; |
| 42 virtual NavigationEntry* GetEntryAtOffsetForRenderManager( |
| 43 int offset) = 0; |
| 40 // See tab_contents.h's implementation for more. | 44 // See tab_contents.h's implementation for more. |
| 41 virtual bool CreateRenderViewForRenderManager( | 45 virtual bool CreateRenderViewForRenderManager( |
| 42 RenderViewHost* render_view_host) = 0; | 46 RenderViewHost* render_view_host) = 0; |
| 43 virtual void BeforeUnloadFiredFromRenderManager( | 47 virtual void BeforeUnloadFiredFromRenderManager( |
| 44 bool proceed, bool* proceed_to_fire_unload) = 0; | 48 bool proceed, bool* proceed_to_fire_unload) = 0; |
| 45 virtual void DidStartLoadingFromRenderManager( | 49 virtual void DidStartLoadingFromRenderManager( |
| 46 RenderViewHost* render_view_host) = 0; | 50 RenderViewHost* render_view_host) = 0; |
| 47 virtual void RenderViewGoneFromRenderManager( | 51 virtual void RenderViewGoneFromRenderManager( |
| 48 RenderViewHost* render_view_host) = 0; | 52 RenderViewHost* render_view_host) = 0; |
| 49 virtual void UpdateRenderViewSizeForRenderManager() = 0; | 53 virtual void UpdateRenderViewSizeForRenderManager() = 0; |
| 50 virtual void NotifySwappedFromRenderManager() = 0; | 54 virtual void NotifySwappedFromRenderManager() = 0; |
| 51 virtual NavigationController& GetControllerForRenderManager() = 0; | 55 virtual void NotifyRenderViewHostSwitchedFromRenderManager( |
| 56 RenderViewHostSwitchedDetails*) = 0; |
| 52 | 57 |
| 53 // Creates a DOMUI object for the given URL if one applies. Ownership of the | 58 // Creates a DOMUI object for the given URL if one applies. Ownership of the |
| 54 // returned pointer will be passed to the caller. If no DOMUI applies, | 59 // returned pointer will be passed to the caller. If no DOMUI applies, |
| 55 // returns NULL. | 60 // returns NULL. |
| 56 virtual DOMUI* CreateDOMUIForRenderManager(const GURL& url) = 0; | 61 virtual DOMUI* CreateDOMUIForRenderManager(const GURL& url) = 0; |
| 57 | 62 |
| 58 // Returns the navigation entry of the current navigation, or NULL if there | 63 // Returns the navigation entry of the current navigation, or NULL if there |
| 59 // is none. | 64 // is none. |
| 60 virtual NavigationEntry* | 65 virtual NavigationEntry* |
| 61 GetLastCommittedNavigationEntryForRenderManager() = 0; | 66 GetLastCommittedNavigationEntryForRenderManager() = 0; |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 }; | 253 }; |
| 249 | 254 |
| 250 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old | 255 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old |
| 251 // host can be NULL when the first RenderViewHost is set. | 256 // host can be NULL when the first RenderViewHost is set. |
| 252 struct RenderViewHostSwitchedDetails { | 257 struct RenderViewHostSwitchedDetails { |
| 253 RenderViewHost* old_host; | 258 RenderViewHost* old_host; |
| 254 RenderViewHost* new_host; | 259 RenderViewHost* new_host; |
| 255 }; | 260 }; |
| 256 | 261 |
| 257 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 262 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| OLD | NEW |