| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_view_host.h" | 9 #include "chrome/browser/renderer_host/render_view_host.h" |
| 10 #include "chrome/common/notification_registrar.h" |
| 11 #include "chrome/common/notification_observer.h" |
| 10 | 12 |
| 11 class InterstitialPage; | 13 class InterstitialPage; |
| 12 class NavigationController; | 14 class NavigationController; |
| 13 class NavigationEntry; | 15 class NavigationEntry; |
| 14 class Profile; | 16 class Profile; |
| 15 class RenderViewHostDelegate; | 17 class RenderViewHostDelegate; |
| 16 class RenderViewHostFactory; | 18 class RenderViewHostFactory; |
| 17 class RenderWidgetHostView; | 19 class RenderWidgetHostView; |
| 18 class SiteInstance; | 20 class SiteInstance; |
| 19 | 21 |
| 20 // Manages RenderViewHosts for a WebContents. Normally there is only one and | 22 // Manages RenderViewHosts for a WebContents. Normally there is only one and |
| 21 // it is easy to do. But we can also have transitions of processes (and hence | 23 // it is easy to do. But we can also have transitions of processes (and hence |
| 22 // RenderViewHosts) that can get complex. | 24 // RenderViewHosts) that can get complex. |
| 23 class RenderViewHostManager { | 25 class RenderViewHostManager : public NotificationObserver { |
| 24 public: | 26 public: |
| 25 // Functions implemented by our owner that we need. | 27 // Functions implemented by our owner that we need. |
| 26 // | 28 // |
| 27 // TODO(brettw) Clean this up! These are all the functions in WebContents that | 29 // TODO(brettw) Clean this up! These are all the functions in WebContents that |
| 28 // are required to run this class. The design should probably be better such | 30 // are required to run this class. The design should probably be better such |
| 29 // that these are more clear. | 31 // that these are more clear. |
| 30 // | 32 // |
| 31 // There is additional complexity that some of the functions we need in | 33 // There is additional complexity that some of the functions we need in |
| 32 // WebContents are inherited and non-virtual. These are named with | 34 // WebContents are inherited and non-virtual. These are named with |
| 33 // "RenderManager" so that the duplicate implementation of them will be clear. | 35 // "RenderManager" so that the duplicate implementation of them will be clear. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 DCHECK(interstitial_page_); | 148 DCHECK(interstitial_page_); |
| 147 interstitial_page_ = NULL; | 149 interstitial_page_ = NULL; |
| 148 } | 150 } |
| 149 | 151 |
| 150 // Returns the currently showing interstitial, NULL if no interstitial is | 152 // Returns the currently showing interstitial, NULL if no interstitial is |
| 151 // showing. | 153 // showing. |
| 152 InterstitialPage* interstitial_page() const { | 154 InterstitialPage* interstitial_page() const { |
| 153 return interstitial_page_; | 155 return interstitial_page_; |
| 154 } | 156 } |
| 155 | 157 |
| 158 virtual void Observe(NotificationType type, |
| 159 const NotificationSource& source, |
| 160 const NotificationDetails& details); |
| 161 |
| 156 private: | 162 private: |
| 157 friend class TestWebContents; | 163 friend class TestWebContents; |
| 158 | 164 |
| 159 // Returns whether this tab should transition to a new renderer for | 165 // Returns whether this tab should transition to a new renderer for |
| 160 // cross-site URLs. Enabled unless we see the --process-per-tab command line | 166 // cross-site URLs. Enabled unless we see the --process-per-tab command line |
| 161 // switch. Can be overridden in unit tests. | 167 // switch. Can be overridden in unit tests. |
| 162 bool ShouldTransitionCrossSite(); | 168 bool ShouldTransitionCrossSite(); |
| 163 | 169 |
| 164 // Returns an appropriate SiteInstance object for the given NavigationEntry, | 170 // Returns an appropriate SiteInstance object for the given NavigationEntry, |
| 165 // possibly reusing the current SiteInstance. | 171 // possibly reusing the current SiteInstance. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 RenderViewHost* render_view_host_; | 215 RenderViewHost* render_view_host_; |
| 210 | 216 |
| 211 // A RenderViewHost used to load a cross-site page. This remains hidden | 217 // A RenderViewHost used to load a cross-site page. This remains hidden |
| 212 // while a cross-site request is pending until it calls DidNavigate. | 218 // while a cross-site request is pending until it calls DidNavigate. |
| 213 RenderViewHost* pending_render_view_host_; | 219 RenderViewHost* pending_render_view_host_; |
| 214 | 220 |
| 215 // The intersitial page currently shown if any, not own by this class | 221 // The intersitial page currently shown if any, not own by this class |
| 216 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 222 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
| 217 InterstitialPage* interstitial_page_; | 223 InterstitialPage* interstitial_page_; |
| 218 | 224 |
| 225 NotificationRegistrar registrar_; |
| 226 |
| 219 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 227 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
| 220 }; | 228 }; |
| 221 | 229 |
| 222 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old | 230 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old |
| 223 // host can be NULL when the first RenderViewHost is set. | 231 // host can be NULL when the first RenderViewHost is set. |
| 224 struct RenderViewHostSwitchedDetails { | 232 struct RenderViewHostSwitchedDetails { |
| 225 RenderViewHost* old_host; | 233 RenderViewHost* old_host; |
| 226 RenderViewHost* new_host; | 234 RenderViewHost* new_host; |
| 227 }; | 235 }; |
| 228 | 236 |
| 229 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 237 #endif // CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| OLD | NEW |