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

Unified Diff: chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm

Issue 1244723003: [Mac] Update context menu dictionary lookup wording and placement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 5 years, 5 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/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
diff --git a/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm b/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
index 033c0addd3520806ef32bbabd7413ec64ee17f55..d8c37b501d8011905b7be7beceae49844c63b730 100644
--- a/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
+++ b/chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac.mm
@@ -135,7 +135,7 @@ void RenderViewContextMenuMac::Show() {
void RenderViewContextMenuMac::ExecuteCommand(int command_id, int event_flags) {
switch (command_id) {
- case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY:
+ case IDC_CONTENT_CONTEXT_LOOK_UP:
LookUpInDictionary();
break;
@@ -188,7 +188,7 @@ bool RenderViewContextMenuMac::IsCommandIdChecked(int command_id) const {
bool RenderViewContextMenuMac::IsCommandIdEnabled(int command_id) const {
switch (command_id) {
- case IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY:
+ case IDC_CONTENT_CONTEXT_LOOK_UP:
// This is OK because the menu is not shown when it isn't
// appropriate.
return true;
@@ -232,27 +232,34 @@ void RenderViewContextMenuMac::AppendPlatformEditableItems() {
}
void RenderViewContextMenuMac::InitToolkitMenu() {
- bool has_selection = !params_.selection_text.empty();
+ if (params_.selection_text.empty())
+ return;
+
+ if (params_.link_url.is_empty()) {
+ base::string16 printable_selection_text = PrintableSelectionText();
+ EscapeAmpersands(&printable_selection_text);
+ int index = 0;
+ menu_model_.InsertItemAt(
+ index++,
+ IDC_CONTENT_CONTEXT_LOOK_UP,
+ l10n_util::GetStringFUTF16(IDS_CONTENT_CONTEXT_LOOK_UP,
+ printable_selection_text));
+ menu_model_.InsertSeparatorAt(index++, ui::NORMAL_SEPARATOR);
+ }
- if (has_selection) {
+ content::RenderWidgetHostView* view = GetRenderViewHost()->GetView();
+ if (view && view->SupportsSpeech()) {
menu_model_.AddSeparator(ui::NORMAL_SEPARATOR);
- menu_model_.AddItemWithStringId(
- IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY,
- IDS_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY);
-
- content::RenderWidgetHostView* view = GetRenderViewHost()->GetView();
- if (view && view->SupportsSpeech()) {
- speech_submenu_model_.AddItemWithStringId(
- IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING,
- IDS_SPEECH_START_SPEAKING_MAC);
- speech_submenu_model_.AddItemWithStringId(
- IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING,
- IDS_SPEECH_STOP_SPEAKING_MAC);
- menu_model_.AddSubMenu(
- IDC_CONTENT_CONTEXT_SPEECH_MENU,
- l10n_util::GetStringUTF16(IDS_SPEECH_MAC),
- &speech_submenu_model_);
- }
+ speech_submenu_model_.AddItemWithStringId(
+ IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING,
+ IDS_SPEECH_START_SPEAKING_MAC);
+ speech_submenu_model_.AddItemWithStringId(
+ IDC_CONTENT_CONTEXT_SPEECH_STOP_SPEAKING,
+ IDS_SPEECH_STOP_SPEAKING_MAC);
+ menu_model_.AddSubMenu(
+ IDC_CONTENT_CONTEXT_SPEECH_MENU,
+ l10n_util::GetStringUTF16(IDS_SPEECH_MAC),
+ &speech_submenu_model_);
}
}

Powered by Google App Engine
This is Rietveld 408576698