Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 6893046: added CTRL+Click and SHIFT+Click handler for context menu, Back and Forward. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: reflected comments. Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 71aa90960e0266aabc5e26d8d426dbc4270735df..1142e21fa8d701ca9d552e8a379830db500b0e2e 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -24,6 +24,7 @@
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/download/save_package.h"
+#include "chrome/browser/event_disposition.h"
#include "chrome/browser/extensions/extension_event_router.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/net/browser_url_util.h"
@@ -64,6 +65,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;
@@ -1200,6 +1202,20 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const {
(id - IDC_SPELLCHECK_LANGUAGES_FIRST);
}
+void RenderViewContextMenu::ExecuteCommandWithFlags(int id, int flags) {
+ switch (id) {
+ case IDC_BACK:
+ GoBack(flags);
+ return;
+ case IDC_FORWARD:
+ GoForward(flags);
+ 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 &&
@@ -1621,6 +1637,20 @@ void RenderViewContextMenu::OpenURL(
source_tab_contents_->OpenURL(url, referrer, disposition, transition);
}
+void RenderViewContextMenu::GoBack(int event_flags) {
+ WindowOpenDisposition disposition =
+ browser::DispositionFromEventFlags(event_flags);
+ if (source_tab_contents_->delegate())
+ source_tab_contents_->delegate()->GoBack(disposition);
+}
+
+void RenderViewContextMenu::GoForward(int event_flags) {
+ WindowOpenDisposition disposition =
+ browser::DispositionFromEventFlags(event_flags);
+ if (source_tab_contents_->delegate())
+ source_tab_contents_->delegate()->GoForward(disposition);
+}
+
void RenderViewContextMenu::CopyImageAt(int x, int y) {
RenderViewHost* rvh = source_tab_contents_->render_view_host();
rvh->Send(new ViewMsg_CopyImageAt(rvh->routing_id(), x, y));

Powered by Google App Engine
This is Rietveld 408576698