diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 21:21:48 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-24 21:21:48 +0000 |
commit | 0e8db94aef1b57355c3d154cb4682ce2f94c51eb (patch) | |
tree | a6290715d64cf7da39ce82005d3f6121a40ee85e /chrome/browser/external_tab_container.cc | |
parent | 14e81bfe528c0d79ba82a9326a7071a1daa101ed (diff) | |
download | chromium_src-0e8db94aef1b57355c3d154cb4682ce2f94c51eb.zip chromium_src-0e8db94aef1b57355c3d154cb4682ce2f94c51eb.tar.gz chromium_src-0e8db94aef1b57355c3d154cb4682ce2f94c51eb.tar.bz2 |
Remove DidNavigate from the tab contents delegate and all the related plumbing.
I added additional information to the regular load commit notification so all
interested parties can listen for that instead.
I removed the old navigation type enum, and replaced it with the enum from
the NavigationController, so it's now public.
Review URL: http://codereview.chromium.org/3112
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/external_tab_container.cc')
-rw-r--r-- | chrome/browser/external_tab_container.cc | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index 50f5123..c6188c3 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -81,6 +81,8 @@ bool ExternalTabContainer::Init(Profile* profile) { NavigationController* controller = tab_contents_->controller(); DCHECK(controller); + registrar_.Add(this, NOTIFY_NAV_ENTRY_COMMITTED, + Source<NavigationController>(controller)); NotificationService::current()-> Notify(NOTIFY_EXTERNAL_TAB_CREATED, Source<NavigationController>(controller), @@ -208,15 +210,6 @@ void ExternalTabContainer::ToolbarSizeChanged(TabContents* source, bool finished) { } -void ExternalTabContainer::DidNavigate(NavigationType nav_type, - int relative_navigation_offet) { - if (automation_) { - automation_->Send( - new AutomationMsg_DidNavigate(0, nav_type, - relative_navigation_offet)); - } -} - void ExternalTabContainer::ForwardMessageToExternalHost( const std::string& receiver, const std::string& message) { if(automation_) { @@ -228,6 +221,24 @@ void ExternalTabContainer::ForwardMessageToExternalHost( void ExternalTabContainer::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { + switch (type) { + case NOTIFY_NAV_ENTRY_COMMITTED: + if (automation_) { + const NavigationController::LoadCommittedDetails* commit = + Details<NavigationController::LoadCommittedDetails>(details).ptr(); + + // When the previous entry index is invalid, it will be -1, which will + // still make the computation come out right (navigating to the 0th + // entry will be +1). + automation_->Send(new AutomationMsg_DidNavigate( + 0, commit->type, + commit->previous_entry_index - + tab_contents_->controller()->GetLastCommittedEntryIndex())); + } + break; + default: + NOTREACHED(); + } } void ExternalTabContainer::GetBounds(CRect *out, bool including_frame) const { |