diff options
author | stoyan@google.com <stoyan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 14:56:38 +0000 |
---|---|---|
committer | stoyan@google.com <stoyan@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-13 14:56:38 +0000 |
commit | f9cc4c4597f2455409008a76d88ed11dbe05796a (patch) | |
tree | 3d1df599805bde20ebfc063c9da87637bb240e08 /chrome/browser | |
parent | 2884a003274a81a3d67a0af97070c427e5ff8956 (diff) | |
download | chromium_src-f9cc4c4597f2455409008a76d88ed11dbe05796a.zip chromium_src-f9cc4c4597f2455409008a76d88ed11dbe05796a.tar.gz chromium_src-f9cc4c4597f2455409008a76d88ed11dbe05796a.tar.bz2 |
This CL is for the needs of ChromeFrame.
TabContentsDelegate implementation may override navigations caused by JsvaScript history object.
Yet not perfect since webkit view of navigation stack differs from the view of external-non-Chrome-host-browser.
We have to provide the full stack from host-browser (+visited links alongside) in the same way as Chrome-browser provides it to renderer.
BUG=24004
Review URL: http://codereview.chromium.org/261046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/external_tab_container.cc | 10 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.h | 1 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_delegate.h | 6 |
4 files changed, 19 insertions, 1 deletions
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index f66cab5..4529ac3 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -638,3 +638,13 @@ void ExternalTabContainer::Navigate(const GURL& url, const GURL& referrer) { tab_contents_->controller().LoadURL(url, referrer, PageTransition::START_PAGE); } + +bool ExternalTabContainer::OnGoToEntryOffset(int offset) { + if (load_requests_via_automation_) { + automation_->Send(new AutomationMsg_RequestGoToHistoryEntryOffset( + 0, tab_handle_, offset)); + return false; + } + + return true; +} diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h index 29cd62d..1438f5d 100644 --- a/chrome/browser/external_tab_container.h +++ b/chrome/browser/external_tab_container.h @@ -123,6 +123,7 @@ class ExternalTabContainer : public TabContentsDelegate, virtual bool HandleKeyboardEvent(const NativeWebKeyboardEvent& event); virtual bool TakeFocus(bool reverse); + virtual bool OnGoToEntryOffset(int offset); virtual void ShowPageInfo(Profile* profile, const GURL& url, diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index ba0c339..c4b5a7a 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -1695,7 +1695,8 @@ void TabContents::OnFindReply(int request_id, } void TabContents::GoToEntryAtOffset(int offset) { - controller_.GoToOffset(offset); + if (!delegate_ || delegate_->OnGoToEntryOffset(offset)) + controller_.GoToOffset(offset); } void TabContents::GetHistoryListCount(int* back_list_count, diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index 7ed952f..7b5f7a7 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -229,6 +229,12 @@ class TabContentsDelegate { // Shows the repost form confirmation dialog box. virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) {} + // Allows delegate to override navigation to the history entries. + // Returns true to allow TabContents to continue with the default processing. + virtual bool OnGoToEntryOffset(int offset) { + return true; + } + protected: ~TabContentsDelegate() {} |