diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 22:13:35 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-22 22:13:35 +0000 |
commit | 2e29d9243d84374d861a86252a2923cba9e49941 (patch) | |
tree | 099ca85a5204473118c853f42bdcef27c7b4dc38 | |
parent | 5b2a74318a8e597769fa882d4c979d4c907b023d (diff) | |
download | chromium_src-2e29d9243d84374d861a86252a2923cba9e49941.zip chromium_src-2e29d9243d84374d861a86252a2923cba9e49941.tar.gz chromium_src-2e29d9243d84374d861a86252a2923cba9e49941.tar.bz2 |
Fix for issue 18228.
Don't record browser history for navigations for tabs in app frame.
BUG=18228
TEST=Open chrome in app frame (via "-app", application shortcut or convert a page to app), navigations in app frame should not appear in history.
Review URL: http://codereview.chromium.org/306052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29830 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser.cc | 5 | ||||
-rw-r--r-- | chrome/browser/browser.h | 1 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_delegate.h | 3 |
4 files changed, 11 insertions, 1 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 0bc169f..da092b3 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -2129,6 +2129,11 @@ void Browser::ShowRepostFormWarningDialog(TabContents *tab_contents) { window()->ShowRepostFormWarningDialog(tab_contents); } +bool Browser::ShouldAddNavigationsToHistory() const { + // Don't update history if running as app. + return !IsApplication(); +} + /////////////////////////////////////////////////////////////////////////////// // Browser, SelectFileDialog::Listener implementation: diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 0f9cd60..a1e6f40 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -547,6 +547,7 @@ class Browser : public TabStripModelDelegate, bool show_history); virtual bool IsReservedAccelerator(const NativeWebKeyboardEvent& event); virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); + virtual bool ShouldAddNavigationsToHistory() const; // Overridden from SelectFileDialog::Listener: virtual void FileSelected(const FilePath& path, int index, void* params); diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index c23e8ba..089545f 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -2069,7 +2069,8 @@ void TabContents::DidNavigate(RenderViewHost* rvh, // Update history. Note that this needs to happen after the entry is complete, // which WillNavigate[Main,Sub]Frame will do before this function is called. - if (params.should_update_history) { + if (params.should_update_history && + (!delegate() || delegate()->ShouldAddNavigationsToHistory())) { // Most of the time, the displayURL matches the loaded URL, but for about: // URLs, we use a data: URL as the real value. We actually want to save // the about: URL to the history db and keep the data: URL hidden. This is diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index 1fcde96..5f084ed 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -237,6 +237,9 @@ class TabContentsDelegate { return true; } + // Returns whether this tab contents should add navigations to history. + virtual bool ShouldAddNavigationsToHistory() const { return true; } + protected: ~TabContentsDelegate() {} }; |