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

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

Issue 3139007: Added "Look Up in Dictionary" item to context menu for Mac. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: morrita@google.com Created 10 years, 4 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 3865f403de7c926191d8ada174c826a74118b077..2fae258cf1e288d39977fb38067ec6e3ac50bce1 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -400,6 +400,11 @@ void RenderViewContextMenu::InitMenu() {
AppendDeveloperItems();
}
+void RenderViewContextMenu::LookUpInDictionary() {
+ // Used only in the Mac port.
+ NOTREACHED();
+}
+
bool RenderViewContextMenu::AppendCustomItems() {
std::vector<WebMenuItem>& custom_items = params_.custom_items;
for (size_t i = 0; i < custom_items.size(); ++i) {
@@ -935,6 +940,10 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
WebContextMenuData::CheckableMenuItemEnabled;
case IDC_WRITING_DIRECTION_MENU:
return true;
+ case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY:
+ // This is OK because the menu is not shown when it isn't
+ // appropriate.
+ return true;
#elif defined(OS_POSIX)
// TODO(suzhe): this should not be enabled for password fields.
case IDC_INPUT_METHODS_MENU:
@@ -981,6 +990,8 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const {
if (id == IDC_WRITING_DIRECTION_LTR)
return params_.writing_direction_left_to_right &
WebContextMenuData::CheckableMenuItemChecked;
+ if (id == IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY)
+ return false;
#endif // OS_MACOSX
// Check box for 'Check the Spelling of this field'.
@@ -1323,6 +1334,9 @@ void RenderViewContextMenu::ExecuteCommand(int id) {
source_tab_contents_->render_view_host()->NotifyTextDirection();
break;
}
+ case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY:
+ LookUpInDictionary();
+ break;
#endif // OS_MACOSX
default:
« no previous file with comments | « chrome/browser/tab_contents/render_view_context_menu.h ('k') | chrome/browser/tab_contents/render_view_context_menu_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698