| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer_host/render_view_host_delegate.h" | 12 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 13 #include "content/browser/site_instance.h" | 13 #include "content/browser/site_instance.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 | 17 |
| 18 class InterstitialPage; | 18 class InterstitialPage; |
| 19 class NavigationController; | 19 class NavigationController; |
| 20 class NavigationEntry; | |
| 21 class RenderViewHost; | 20 class RenderViewHost; |
| 22 class RenderWidgetHostView; | 21 class RenderWidgetHostView; |
| 23 class WebUI; | 22 class WebUI; |
| 24 | 23 |
| 25 namespace content { | 24 namespace content { |
| 26 class BrowserContext; | 25 class BrowserContext; |
| 27 class NavigationEntry; | 26 class NavigationEntry; |
| 27 class NavigationEntryImpl; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Manages RenderViewHosts for a TabContents. Normally there is only one and | 30 // 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 | 31 // it is easy to do. But we can also have transitions of processes (and hence |
| 32 // RenderViewHosts) that can get complex. | 32 // RenderViewHosts) that can get complex. |
| 33 class CONTENT_EXPORT RenderViewHostManager | 33 class CONTENT_EXPORT RenderViewHostManager |
| 34 : public RenderViewHostDelegate::RendererManagement, | 34 : public RenderViewHostDelegate::RendererManagement, |
| 35 public content::NotificationObserver { | 35 public content::NotificationObserver { |
| 36 public: | 36 public: |
| 37 // Functions implemented by our owner that we need. | 37 // Functions implemented by our owner that we need. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // Returns the current committed Web UI or NULL if none applies. | 125 // Returns the current committed Web UI or NULL if none applies. |
| 126 WebUI* web_ui() const { return web_ui_.get(); } | 126 WebUI* web_ui() const { return web_ui_.get(); } |
| 127 | 127 |
| 128 // Returns the Web UI for the pending navigation, or NULL of none applies. | 128 // Returns the Web UI for the pending navigation, or NULL of none applies. |
| 129 WebUI* pending_web_ui() const { return pending_web_ui_.get(); } | 129 WebUI* pending_web_ui() const { return pending_web_ui_.get(); } |
| 130 | 130 |
| 131 // Called when we want to instruct the renderer to navigate to the given | 131 // Called when we want to instruct the renderer to navigate to the given |
| 132 // navigation entry. It may create a new RenderViewHost or re-use an existing | 132 // navigation entry. It may create a new RenderViewHost or re-use an existing |
| 133 // one. The RenderViewHost to navigate will be returned. Returns NULL if one | 133 // one. The RenderViewHost to navigate will be returned. Returns NULL if one |
| 134 // could not be created. | 134 // could not be created. |
| 135 RenderViewHost* Navigate(const NavigationEntry& entry); | 135 RenderViewHost* Navigate(const content::NavigationEntryImpl& entry); |
| 136 | 136 |
| 137 // Instructs the various live views to stop. Called when the user directed the | 137 // Instructs the various live views to stop. Called when the user directed the |
| 138 // page to stop loading. | 138 // page to stop loading. |
| 139 void Stop(); | 139 void Stop(); |
| 140 | 140 |
| 141 // Notifies the regular and pending RenderViewHosts that a load is or is not | 141 // Notifies the regular and pending RenderViewHosts that a load is or is not |
| 142 // happening. Even though the message is only for one of them, we don't know | 142 // happening. Even though the message is only for one of them, we don't know |
| 143 // which one so we tell both. | 143 // which one so we tell both. |
| 144 void SetIsLoading(bool is_loading); | 144 void SetIsLoading(bool is_loading); |
| 145 | 145 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 bool ShouldTransitionCrossSite(); | 208 bool ShouldTransitionCrossSite(); |
| 209 | 209 |
| 210 // Returns true if the two navigation entries are incompatible in some way | 210 // Returns true if the two navigation entries are incompatible in some way |
| 211 // other than site instances. Cases where this can happen include Web UI | 211 // other than site instances. Cases where this can happen include Web UI |
| 212 // to regular web pages. It will cause us to swap RenderViewHosts (and hence | 212 // to regular web pages. It will cause us to swap RenderViewHosts (and hence |
| 213 // RenderProcessHosts) even if the site instance would otherwise be the same. | 213 // RenderProcessHosts) even if the site instance would otherwise be the same. |
| 214 // As part of this, we'll also force new SiteInstances and BrowsingInstances. | 214 // As part of this, we'll also force new SiteInstances and BrowsingInstances. |
| 215 // Either of the entries may be NULL. | 215 // Either of the entries may be NULL. |
| 216 bool ShouldSwapProcessesForNavigation( | 216 bool ShouldSwapProcessesForNavigation( |
| 217 const content::NavigationEntry* cur_entry, | 217 const content::NavigationEntry* cur_entry, |
| 218 const NavigationEntry* new_entry) const; | 218 const content::NavigationEntryImpl* new_entry) const; |
| 219 | 219 |
| 220 // Returns an appropriate SiteInstance object for the given NavigationEntry, | 220 // Returns an appropriate SiteInstance object for the given NavigationEntry, |
| 221 // possibly reusing the current SiteInstance. | 221 // possibly reusing the current SiteInstance. |
| 222 // Never called if --process-per-tab is used. | 222 // Never called if --process-per-tab is used. |
| 223 SiteInstance* GetSiteInstanceForEntry(const NavigationEntry& entry, | 223 SiteInstance* GetSiteInstanceForEntry( |
| 224 SiteInstance* curr_instance); | 224 const content::NavigationEntryImpl& entry, |
| 225 SiteInstance* curr_instance); |
| 225 | 226 |
| 226 // Helper method to create a pending RenderViewHost for a cross-site | 227 // Helper method to create a pending RenderViewHost for a cross-site |
| 227 // navigation. | 228 // navigation. |
| 228 bool CreatePendingRenderView(const NavigationEntry& entry, | 229 bool CreatePendingRenderView(const content::NavigationEntryImpl& entry, |
| 229 SiteInstance* instance); | 230 SiteInstance* instance); |
| 230 | 231 |
| 231 // Sets up the necessary state for a new RenderViewHost navigating to the | 232 // Sets up the necessary state for a new RenderViewHost navigating to the |
| 232 // given entry. | 233 // given entry. |
| 233 bool InitRenderView(RenderViewHost* render_view_host, | 234 bool InitRenderView(RenderViewHost* render_view_host, |
| 234 const NavigationEntry& entry); | 235 const content::NavigationEntryImpl& entry); |
| 235 | 236 |
| 236 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this | 237 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this |
| 237 // doesn't require the pending render_view_host_ pointer to be non-NULL, since | 238 // doesn't require the pending render_view_host_ pointer to be non-NULL, since |
| 238 // there could be Web UI switching as well. Call this for every commit. | 239 // there could be Web UI switching as well. Call this for every commit. |
| 239 void CommitPending(); | 240 void CommitPending(); |
| 240 | 241 |
| 241 // Helper method to terminate the pending RenderViewHost. | 242 // Helper method to terminate the pending RenderViewHost. |
| 242 void CancelPending(); | 243 void CancelPending(); |
| 243 | 244 |
| 244 RenderViewHost* UpdateRendererStateForNavigate(const NavigationEntry& entry); | 245 RenderViewHost* UpdateRendererStateForNavigate( |
| 246 const content::NavigationEntryImpl& entry); |
| 245 | 247 |
| 246 // Called when a renderer process is starting to close. We should not | 248 // Called when a renderer process is starting to close. We should not |
| 247 // schedule new navigations in its swapped out RenderViewHosts after this. | 249 // schedule new navigations in its swapped out RenderViewHosts after this. |
| 248 void RendererProcessClosing(content::RenderProcessHost* render_process_host); | 250 void RendererProcessClosing(content::RenderProcessHost* render_process_host); |
| 249 | 251 |
| 250 // Our delegate, not owned by us. Guaranteed non-NULL. | 252 // Our delegate, not owned by us. Guaranteed non-NULL. |
| 251 Delegate* delegate_; | 253 Delegate* delegate_; |
| 252 | 254 |
| 253 // Whether a navigation requiring different RenderView's is pending. This is | 255 // Whether a navigation requiring different RenderView's is pending. This is |
| 254 // either cross-site request is (in the new process model), or when required | 256 // either cross-site request is (in the new process model), or when required |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 }; | 293 }; |
| 292 | 294 |
| 293 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old | 295 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old |
| 294 // host can be NULL when the first RenderViewHost is set. | 296 // host can be NULL when the first RenderViewHost is set. |
| 295 struct RenderViewHostSwitchedDetails { | 297 struct RenderViewHostSwitchedDetails { |
| 296 RenderViewHost* old_host; | 298 RenderViewHost* old_host; |
| 297 RenderViewHost* new_host; | 299 RenderViewHost* new_host; |
| 298 }; | 300 }; |
| 299 | 301 |
| 300 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 302 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| OLD | NEW |