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_impl.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 InterstitialPageImpl; | 18 class InterstitialPageImpl; |
| 19 class NavigationControllerImpl; | 19 class NavigationControllerImpl; |
| 20 class RenderViewHost; | 20 class RenderViewHost; |
| 21 class RenderViewHostImpl; | |
| 21 class WebUIImpl; | 22 class WebUIImpl; |
| 22 | 23 |
| 23 namespace content { | 24 namespace content { |
| 24 class BrowserContext; | 25 class BrowserContext; |
| 25 class NavigationEntry; | 26 class NavigationEntry; |
| 26 class NavigationEntryImpl; | 27 class NavigationEntryImpl; |
| 27 class RenderWidgetHostView; | 28 class RenderWidgetHostView; |
| 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 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 content::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; |
|
jam
2012/02/29 01:40:47
nit: this and below should return the Impl, since
Jói
2012/03/02 10:40:36
Done.
| |
| 113 return render_view_host_; | |
| 114 } | |
| 115 | 114 |
| 116 // Returns the view associated with the current RenderViewHost, or NULL if | 115 // Returns the view associated with the current RenderViewHost, or NULL if |
| 117 // there is no current one. | 116 // there is no current one. |
| 118 content::RenderWidgetHostView* GetRenderWidgetHostView() const; | 117 content::RenderWidgetHostView* GetRenderWidgetHostView() const; |
| 119 | 118 |
| 120 // Returns the pending render view host, or NULL if there is no pending one. | 119 // Returns the pending render view host, or NULL if there is no pending one. |
| 121 RenderViewHost* pending_render_view_host() const { | 120 RenderViewHost* pending_render_view_host() const; |
| 122 return pending_render_view_host_; | |
| 123 } | |
| 124 | 121 |
| 125 // Returns the current committed Web UI or NULL if none applies. | 122 // Returns the current committed Web UI or NULL if none applies. |
| 126 WebUIImpl* web_ui() const { return web_ui_.get(); } | 123 WebUIImpl* web_ui() const { return web_ui_.get(); } |
| 127 | 124 |
| 128 // Returns the Web UI for the pending navigation, or NULL of none applies. | 125 // Returns the Web UI for the pending navigation, or NULL of none applies. |
| 129 WebUIImpl* pending_web_ui() const { return pending_web_ui_.get(); } | 126 WebUIImpl* pending_web_ui() const { return pending_web_ui_.get(); } |
| 130 | 127 |
| 131 // Called when we want to instruct the renderer to navigate to the given | 128 // 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 | 129 // 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 | 130 // one. The RenderViewHost to navigate will be returned. Returns NULL if one |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 // for the view type (like view source versus not). | 254 // for the view type (like view source versus not). |
| 258 bool cross_navigation_pending_; | 255 bool cross_navigation_pending_; |
| 259 | 256 |
| 260 // Implemented by the owner of this class, this delegate is installed into all | 257 // Implemented by the owner of this class, this delegate is installed into all |
| 261 // the RenderViewHosts that we create. | 258 // the RenderViewHosts that we create. |
| 262 content::RenderViewHostDelegate* render_view_delegate_; | 259 content::RenderViewHostDelegate* render_view_delegate_; |
| 263 | 260 |
| 264 // Our RenderView host and its associated Web UI (if any, will be NULL for | 261 // Our RenderView host and its associated Web UI (if any, will be NULL for |
| 265 // non-DOM-UI pages). This object is responsible for all communication with | 262 // non-DOM-UI pages). This object is responsible for all communication with |
| 266 // a child RenderView instance. | 263 // a child RenderView instance. |
| 267 RenderViewHost* render_view_host_; | 264 RenderViewHostImpl* render_view_host_; |
| 268 scoped_ptr<WebUIImpl> web_ui_; | 265 scoped_ptr<WebUIImpl> web_ui_; |
| 269 | 266 |
| 270 // A RenderViewHost used to load a cross-site page. This remains hidden | 267 // A RenderViewHost used to load a cross-site page. This remains hidden |
| 271 // while a cross-site request is pending until it calls DidNavigate. It may | 268 // while a cross-site request is pending until it calls DidNavigate. It may |
| 272 // have an associated Web UI, in which case the Web UI pointer will be non- | 269 // have an associated Web UI, in which case the Web UI pointer will be non- |
| 273 // NULL. | 270 // NULL. |
| 274 // | 271 // |
| 275 // The pending_web_ui may be non-NULL even when the pending_render_view_host_ | 272 // The pending_web_ui may be non-NULL even when the pending_render_view_host_ |
| 276 // is. This will happen when we're transitioning between two Web UI pages: | 273 // is. This will happen when we're transitioning between two Web UI pages: |
| 277 // the RVH won't be swapped, so the pending pointer will be unused, but there | 274 // the RVH won't be swapped, so the pending pointer will be unused, but there |
| 278 // will be a pending Web UI associated with the navigation. | 275 // will be a pending Web UI associated with the navigation. |
| 279 RenderViewHost* pending_render_view_host_; | 276 RenderViewHostImpl* pending_render_view_host_; |
| 280 scoped_ptr<WebUIImpl> pending_web_ui_; | 277 scoped_ptr<WebUIImpl> pending_web_ui_; |
| 281 | 278 |
| 282 // A map of site instance ID to swapped out RenderViewHosts. | 279 // A map of site instance ID to swapped out RenderViewHosts. |
| 283 typedef base::hash_map<int32, RenderViewHost*> RenderViewHostMap; | 280 typedef base::hash_map<int32, RenderViewHostImpl*> RenderViewHostMap; |
| 284 RenderViewHostMap swapped_out_hosts_; | 281 RenderViewHostMap swapped_out_hosts_; |
| 285 | 282 |
| 286 // The intersitial page currently shown if any, not own by this class | 283 // The intersitial page currently shown if any, not own by this class |
| 287 // (the InterstitialPage is self-owned, it deletes itself when hidden). | 284 // (the InterstitialPage is self-owned, it deletes itself when hidden). |
| 288 InterstitialPageImpl* interstitial_page_; | 285 InterstitialPageImpl* interstitial_page_; |
| 289 | 286 |
| 290 content::NotificationRegistrar registrar_; | 287 content::NotificationRegistrar registrar_; |
| 291 | 288 |
| 292 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); | 289 DISALLOW_COPY_AND_ASSIGN(RenderViewHostManager); |
| 293 }; | 290 }; |
| 294 | 291 |
| 295 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ | 292 #endif // CONTENT_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ |
| OLD | NEW |