| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h" | 5 #include "chrome/browser/ui/cocoa/tab_contents/render_view_context_menu_mac.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #import "base/mac/scoped_sending_event.h" | 8 #import "base/mac/scoped_sending_event.h" |
| 9 #include "base/memory/scoped_nsobject.h" | 9 #include "base/memory/scoped_nsobject.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 bool RenderViewContextMenuMac::GetAcceleratorForCommandId( | 163 bool RenderViewContextMenuMac::GetAcceleratorForCommandId( |
| 164 int command_id, | 164 int command_id, |
| 165 ui::Accelerator* accelerator) { | 165 ui::Accelerator* accelerator) { |
| 166 return false; | 166 return false; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void RenderViewContextMenuMac::InitPlatformMenu() { | 169 void RenderViewContextMenuMac::InitPlatformMenu() { |
| 170 bool has_selection = !params_.selection_text.empty(); | 170 bool has_selection = !params_.selection_text.empty(); |
| 171 | 171 |
| 172 if (has_selection) { | 172 if (has_selection) { |
| 173 menu_model_.AddSeparator(); | 173 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 174 menu_model_.AddItemWithStringId( | 174 menu_model_.AddItemWithStringId( |
| 175 IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY, | 175 IDC_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY, |
| 176 IDS_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY); | 176 IDS_CONTENT_CONTEXT_LOOK_UP_IN_DICTIONARY); |
| 177 | 177 |
| 178 content::RenderWidgetHostView* view = GetRenderViewHost()->GetView(); | 178 content::RenderWidgetHostView* view = GetRenderViewHost()->GetView(); |
| 179 if (view && view->SupportsSpeech()) { | 179 if (view && view->SupportsSpeech()) { |
| 180 speech_submenu_model_.AddItemWithStringId( | 180 speech_submenu_model_.AddItemWithStringId( |
| 181 IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING, | 181 IDC_CONTENT_CONTEXT_SPEECH_START_SPEAKING, |
| 182 IDS_SPEECH_START_SPEAKING_MAC); | 182 IDS_SPEECH_START_SPEAKING_MAC); |
| 183 speech_submenu_model_.AddItemWithStringId( | 183 speech_submenu_model_.AddItemWithStringId( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 command_id); | 217 command_id); |
| 218 if (!item) | 218 if (!item) |
| 219 return; | 219 return; |
| 220 | 220 |
| 221 // Update the returned NSMenuItem directly so we can update it immediately. | 221 // Update the returned NSMenuItem directly so we can update it immediately. |
| 222 [item setEnabled:enabled]; | 222 [item setEnabled:enabled]; |
| 223 [item setTitle:SysUTF16ToNSString(title)]; | 223 [item setTitle:SysUTF16ToNSString(title)]; |
| 224 [item setHidden:hidden]; | 224 [item setHidden:hidden]; |
| 225 [[item menu] itemChanged:item]; | 225 [[item menu] itemChanged:item]; |
| 226 } | 226 } |
| OLD | NEW |