| 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" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // are required to run this class. The design should probably be better such | 39 // are required to run this class. The design should probably be better such |
| 40 // that these are more clear. | 40 // that these are more clear. |
| 41 // | 41 // |
| 42 // There is additional complexity that some of the functions we need in | 42 // There is additional complexity that some of the functions we need in |
| 43 // TabContents are inherited and non-virtual. These are named with | 43 // TabContents are inherited and non-virtual. These are named with |
| 44 // "RenderManager" so that the duplicate implementation of them will be clear. | 44 // "RenderManager" so that the duplicate implementation of them will be clear. |
| 45 class CONTENT_EXPORT Delegate { | 45 class CONTENT_EXPORT Delegate { |
| 46 public: | 46 public: |
| 47 // See tab_contents.h's implementation for more. | 47 // See tab_contents.h's implementation for more. |
| 48 virtual bool CreateRenderViewForRenderManager( | 48 virtual bool CreateRenderViewForRenderManager( |
| 49 RenderViewHost* render_view_host) = 0; | 49 RenderViewHost* render_view_host, int opener_route_id) = 0; |
| 50 virtual void BeforeUnloadFiredFromRenderManager( | 50 virtual void BeforeUnloadFiredFromRenderManager( |
| 51 bool proceed, bool* proceed_to_fire_unload) = 0; | 51 bool proceed, bool* proceed_to_fire_unload) = 0; |
| 52 virtual void DidStartLoadingFromRenderManager( | 52 virtual void DidStartLoadingFromRenderManager( |
| 53 RenderViewHost* render_view_host) = 0; | 53 RenderViewHost* render_view_host) = 0; |
| 54 virtual void RenderViewGoneFromRenderManager( | 54 virtual void RenderViewGoneFromRenderManager( |
| 55 RenderViewHost* render_view_host) = 0; | 55 RenderViewHost* render_view_host) = 0; |
| 56 virtual void UpdateRenderViewSizeForRenderManager() = 0; | 56 virtual void UpdateRenderViewSizeForRenderManager() = 0; |
| 57 virtual void NotifySwappedFromRenderManager() = 0; | 57 virtual void NotifySwappedFromRenderManager() = 0; |
| 58 virtual NavigationController& GetControllerForRenderManager() = 0; | 58 virtual NavigationController& GetControllerForRenderManager() = 0; |
| 59 | 59 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 // Returns an appropriate SiteInstance object for the given NavigationEntry, | 211 // Returns an appropriate SiteInstance object for the given NavigationEntry, |
| 212 // possibly reusing the current SiteInstance. | 212 // possibly reusing the current SiteInstance. |
| 213 // Never called if --process-per-tab is used. | 213 // Never called if --process-per-tab is used. |
| 214 SiteInstance* GetSiteInstanceForEntry(const NavigationEntry& entry, | 214 SiteInstance* GetSiteInstanceForEntry(const NavigationEntry& entry, |
| 215 SiteInstance* curr_instance); | 215 SiteInstance* curr_instance); |
| 216 | 216 |
| 217 // Helper method to create a pending RenderViewHost for a cross-site | 217 // Helper method to create a pending RenderViewHost for a cross-site |
| 218 // navigation. | 218 // navigation. |
| 219 bool CreatePendingRenderView(const NavigationEntry& entry, | 219 bool CreatePendingRenderView(const NavigationEntry& entry, |
| 220 SiteInstance* instance); | 220 SiteInstance* instance, |
| 221 int opener_route_id); |
| 221 | 222 |
| 222 // Sets up the necessary state for a new RenderViewHost navigating to the | 223 // Sets up the necessary state for a new RenderViewHost navigating to the |
| 223 // given entry. | 224 // given entry. |
| 224 bool InitRenderView(RenderViewHost* render_view_host, | 225 bool InitRenderView(RenderViewHost* render_view_host, |
| 225 const NavigationEntry& entry); | 226 const NavigationEntry& entry, |
| 227 int opener_route_id); |
| 226 | 228 |
| 227 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this | 229 // Sets the pending RenderViewHost/WebUI to be the active one. Note that this |
| 228 // doesn't require the pending render_view_host_ pointer to be non-NULL, since | 230 // doesn't require the pending render_view_host_ pointer to be non-NULL, since |
| 229 // there could be Web UI switching as well. Call this for every commit. | 231 // there could be Web UI switching as well. Call this for every commit. |
| 230 void CommitPending(); | 232 void CommitPending(); |
| 231 | 233 |
| 232 // Helper method to terminate the pending RenderViewHost. | 234 // Helper method to terminate the pending RenderViewHost. |
| 233 void CancelPending(); | 235 void CancelPending(); |
| 234 | 236 |
| 235 RenderViewHost* UpdateRendererStateForNavigate(const NavigationEntry& entry); | 237 RenderViewHost* UpdateRendererStateForNavigate(const NavigationEntry& entry); |
| 236 | 238 |
| 237 // Called when a renderer process is starting to close. We should not | 239 // Called when a renderer process is starting to close. We should not |
| 238 // schedule new navigations in its swapped out RenderViewHosts after this. | 240 // schedule new navigations in its swapped out RenderViewHosts after this. |
| 239 void RendererProcessClosing(content::RenderProcessHost* render_process_host); | 241 void RendererProcessClosing(content::RenderProcessHost* render_process_host); |
| 240 | 242 |
| 243 // Returns a swapped-out RenderViewHost for a navigation entry. This is used |
| 244 // to generate RVHs for the opener chain when we swap RVHs on a navigation. |
| 245 RenderViewHost* SwappedOutRVHForNavigationEntry(const NavigationEntry& entry, |
| 246 int opener_route_id); |
| 247 |
| 241 // Our delegate, not owned by us. Guaranteed non-NULL. | 248 // Our delegate, not owned by us. Guaranteed non-NULL. |
| 242 Delegate* delegate_; | 249 Delegate* delegate_; |
| 243 | 250 |
| 244 // Whether a navigation requiring different RenderView's is pending. This is | 251 // Whether a navigation requiring different RenderView's is pending. This is |
| 245 // either cross-site request is (in the new process model), or when required | 252 // either cross-site request is (in the new process model), or when required |
| 246 // for the view type (like view source versus not). | 253 // for the view type (like view source versus not). |
| 247 bool cross_navigation_pending_; | 254 bool cross_navigation_pending_; |
| 248 | 255 |
| 249 // Implemented by the owner of this class, this delegate is installed into all | 256 // Implemented by the owner of this class, this delegate is installed into all |
| 250 // the RenderViewHosts that we create. | 257 // the RenderViewHosts that we create. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 271 // A map of site instance ID to swapped out RenderViewHosts. | 278 // A map of site instance ID to swapped out RenderViewHosts. |
| 272 typedef base::hash_map<int32, RenderViewHost*> RenderViewHostMap; | 279 typedef base::hash_map<int32, RenderViewHost*> RenderViewHostMap; |
| 273 RenderViewHostMap swapped_out_hosts_; | 280 RenderViewHostMap swapped_out_hosts_; |
| 274 | 281 |
| 275 // The intersitial page currently shown if any, not own by this class | 282 // The intersitial page currently shown if any, not own by this class |
| 276 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 283 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
| 277 InterstitialPage* interstitial_page_; | 284 InterstitialPage* interstitial_page_; |
| 278 | 285 |
| 279 content::NotificationRegistrar registrar_; | 286 content::NotificationRegistrar registrar_; |
| 280 | 287 |
| 288 content::BrowserContext* browser_context_; |
| 289 |
| 281 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 290 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
| 282 }; | 291 }; |
| 283 | 292 |
| 284 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old | 293 // The "details" for a NOTIFY_RENDER_VIEW_HOST_CHANGED notification. The old |
| 285 // host can be NULL when the first RenderViewHost is set. | 294 // host can be NULL when the first RenderViewHost is set. |
| 286 struct RenderViewHostSwitchedDetails { | 295 struct RenderViewHostSwitchedDetails { |
| 287 RenderViewHost* old_host; | 296 RenderViewHost* old_host; |
| 288 RenderViewHost* new_host; | 297 RenderViewHost* new_host; |
| 289 }; | 298 }; |
| 290 | 299 |
| 291 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 300 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| OLD | NEW |