diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 23:12:16 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 23:12:16 +0000 |
commit | f21a884408531b243047e62a7f000013abbd42f1 (patch) | |
tree | 6703f99c5bf2e89c0fad87c043dd759ac4a4f24a /chrome/browser/tab_contents/render_view_host_manager.h | |
parent | 239e3521507a1bcc76c27a51c4b98f0a5d6ec347 (diff) | |
download | chromium_src-f21a884408531b243047e62a7f000013abbd42f1.zip chromium_src-f21a884408531b243047e62a7f000013abbd42f1.tar.gz chromium_src-f21a884408531b243047e62a7f000013abbd42f1.tar.bz2 |
Make the bookmarks bar disappear when the load after the new tab page commits
rather than when it is pending. This makes it change at the same time the
page changes.
To support this, we now have to keep track of both a pending and a committed
DOMUI object. This is tracked by the RenderManager, which does a similar
swapping between pending and committed RenderViewHosts.
Previous review URL: http://codereview.chromium.org/42512
The only difference is I swapped the order of creating the DOM UI in
RenderViewHostManager::Navigate.
BUG=8963
Review URL: http://codereview.chromium.org/42623
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents/render_view_host_manager.h')
-rw-r--r-- | chrome/browser/tab_contents/render_view_host_manager.h | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/chrome/browser/tab_contents/render_view_host_manager.h b/chrome/browser/tab_contents/render_view_host_manager.h index 160ecff..9d9bb67 100644 --- a/chrome/browser/tab_contents/render_view_host_manager.h +++ b/chrome/browser/tab_contents/render_view_host_manager.h @@ -6,10 +6,12 @@ #define CHROME_BROWSER_TAB_CONTENTS_RENDER_VIEW_HOST_MANAGER_H_ #include "base/basictypes.h" +#include "base/scoped_ptr.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_observer.h" +class DOMUI; class InterstitialPage; class NavigationController; class NavigationEntry; @@ -48,6 +50,11 @@ class RenderViewHostManager : public NotificationObserver { virtual void NotifySwappedFromRenderManager() = 0; virtual NavigationController* GetControllerForRenderManager() = 0; + // Creates a DOMUI object for the given URL if one applies. Ownership of the + // returned pointer will be passed to the caller. If no DOMUI applies, + // returns NULL. + virtual DOMUI* CreateDOMUIForRenderManager(const GURL& url) = 0; + // Returns the navigation entry of the current navigation, or NULL if there // is none. virtual NavigationEntry* @@ -94,6 +101,17 @@ class RenderViewHostManager : public NotificationObserver { return render_view_host_->view(); } + // Returns the pending render view host, or NULL if there is no pending one. + RenderViewHost* pending_render_view_host() const { + return pending_render_view_host_; + } + + // Returns the current committed DOM UI or NULL if none applies. + DOMUI* dom_ui() const { return dom_ui_.get(); } + + // Returns the DOM UI for the pending navigation, or NULL of none applies. + DOMUI* pending_dom_ui() const { return pending_dom_ui_.get(); } + // Called when we want to instruct the renderer to navigate to the given // navigation entry. It may create a new RenderViewHost or re-use an existing // one. The RenderViewHost to navigate will be returned. Returns NULL if one @@ -195,19 +213,15 @@ class RenderViewHostManager : public NotificationObserver { int routing_id, base::WaitableEvent* modal_dialog_event); - // Replaces the currently shown render_view_host_ with the RenderViewHost in - // the field pointed to by |new_render_view_host|, and then NULLs the field. - // Callers should only pass pointers to the pending_render_view_host_, - // interstitial_render_view_host_, or original_render_view_host_ fields of - // this object. If |destroy_after|, this method will call - // ScheduleDeferredDestroy on the previous render_view_host_. - void SwapToRenderView(RenderViewHost** new_render_view_host, - bool destroy_after); + // Sets the pending RenderViewHost/DOMUI to be the active one. Note that this + // doesn't require the pending render_view_host_ pointer to be non-NULL, since + // there could be DOM UI switching as well. Call this for every commit. + void CommitPending(); // Helper method to terminate the pending RenderViewHost. - void CancelPendingRenderView(); + void CancelPending(); - RenderViewHost* UpdateRendererStateNavigate(const NavigationEntry& entry); + RenderViewHost* UpdateRendererStateForNavigate(const NavigationEntry& entry); // Our delegate, not owned by us. Guaranteed non-NULL. Delegate* delegate_; @@ -224,13 +238,23 @@ class RenderViewHostManager : public NotificationObserver { // the RenderViewHosts that we create. RenderViewHostDelegate* render_view_delegate_; - // Our RenderView host. This object is responsible for all communication with + // Our RenderView host and its associated DOM UI (if any, will be NULL for + // non-DOM-UI pages). This object is responsible for all communication with // a child RenderView instance. RenderViewHost* render_view_host_; + scoped_ptr<DOMUI> dom_ui_; - // A RenderViewHost used to load a cross-site page. This remains hidden - // while a cross-site request is pending until it calls DidNavigate. + // A RenderViewHost used to load a cross-site page. This remains hidden + // while a cross-site request is pending until it calls DidNavigate. It may + // have an associated DOM UI, in which case the DOM UI pointer will be non- + // NULL. + // + // The pending_dom_ui may be non-NULL even when the pending_render_view_host_ + // is. This will happen when we're transitioning between two DOM UI pages: + // the RVH won't be swapped, so the pending pointer will be unused, but there + // will be a pending DOM UI associated with the navigation. RenderViewHost* pending_render_view_host_; + scoped_ptr<DOMUI> pending_dom_ui_; // The intersitial page currently shown if any, not own by this class // (the InterstitialPage is self-owned, it deletes itself when hidden). |