Index: chrome/browser/tab_contents/render_view_context_menu.cc |
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc |
index c7b4e5e19da2f615122f7998477ac0871f31b4ca..bbc563641fa35b5ddc34756f5c1568d2d237b1e5 100644 |
--- a/chrome/browser/tab_contents/render_view_context_menu.cc |
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc |
@@ -41,6 +41,8 @@ |
#include "chrome/browser/translate/translate_manager.h" |
#include "chrome/browser/translate/translate_prefs.h" |
#include "chrome/browser/translate/translate_tab_helper.h" |
+#include "chrome/browser/ui/browser.h" |
brettw
2011/04/28 20:43:39
You can see we've been careful to never call into
|
+#include "chrome/browser/ui/browser_list.h" |
#include "chrome/browser/ui/download/download_tab_helper.h" |
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
#include "chrome/common/chrome_constants.h" |
@@ -62,6 +64,7 @@ |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/gfx/favicon_size.h" |
#include "webkit/glue/webmenuitem.h" |
+#include "webkit/glue/window_open_disposition.h" |
using WebKit::WebContextMenuData; |
using WebKit::WebMediaPlayerAction; |
@@ -1157,6 +1160,36 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const { |
(id - IDC_SPELLCHECK_LANGUAGES_FIRST); |
} |
+void RenderViewContextMenu::ExecuteCommandWithDisposition( |
brettw
2011/04/28 20:43:39
Be sure the implementation order matches the heade
|
+ int id, WindowOpenDisposition disposition) { |
+ |
+ switch (id) { |
+ case IDC_BACK: { |
+ Profile* profile = source_tab_contents_->profile(); |
+ Browser* browser = |
+ BrowserList::FindBrowserWithType(profile, |
+ Browser::TYPE_NORMAL, false); |
+ if (browser) { |
+ browser->GoBack(disposition); |
+ return; |
+ } |
+ } |
+ case IDC_FORWARD: { |
+ Profile* profile = source_tab_contents_->profile(); |
+ Browser* browser = |
+ BrowserList::FindBrowserWithType(profile, |
+ Browser::TYPE_NORMAL, false); |
+ if (browser) { |
+ browser->GoForward(disposition); |
+ return; |
+ } |
+ } |
+ } |
+ |
+ // If not processed, call ExecuteCommand instead. |
+ ExecuteCommand(id); |
+} |
+ |
void RenderViewContextMenu::ExecuteCommand(int id) { |
// Check to see if one of the spell check language ids have been clicked. |
if (id >= IDC_SPELLCHECK_LANGUAGES_FIRST && |