| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/render_view_context_menu_mac.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu_mac.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // See the documentation on [NSPasteboard declareTypes]. | 136 // See the documentation on [NSPasteboard declareTypes]. |
| 137 NSArray* toDeclare = [NSArray arrayWithObject:NSStringPboardType]; | 137 NSArray* toDeclare = [NSArray arrayWithObject:NSStringPboardType]; |
| 138 [pboard declareTypes:toDeclare owner:nil]; | 138 [pboard declareTypes:toDeclare owner:nil]; |
| 139 BOOL ok = [pboard setString:text forType:NSStringPboardType]; | 139 BOOL ok = [pboard setString:text forType:NSStringPboardType]; |
| 140 if (ok) | 140 if (ok) |
| 141 NSPerformService(@"Look Up in Dictionary", pboard); | 141 NSPerformService(@"Look Up in Dictionary", pboard); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void RenderViewContextMenuMac::UpdateMenuItem(int command_id, | 144 void RenderViewContextMenuMac::UpdateMenuItem(int command_id, |
| 145 bool enabled, | 145 bool enabled, |
| 146 bool hidden, |
| 146 const string16& title) { | 147 const string16& title) { |
| 147 NSMenuItem* item = GetMenuItemByID(&menu_model_, [menuController_ menu], | 148 NSMenuItem* item = GetMenuItemByID(&menu_model_, [menuController_ menu], |
| 148 command_id); | 149 command_id); |
| 149 if (!item) | 150 if (!item) |
| 150 return; | 151 return; |
| 151 | 152 |
| 152 // Update the returned NSMenuItem directly so we can update it immediately. | 153 // Update the returned NSMenuItem directly so we can update it immediately. |
| 153 [item setEnabled:enabled]; | 154 [item setEnabled:enabled]; |
| 154 [item setTitle:SysUTF16ToNSString(title)]; | 155 [item setTitle:SysUTF16ToNSString(title)]; |
| 156 [item setHidden:hidden]; |
| 155 [[item menu] itemChanged:item]; | 157 [[item menu] itemChanged:item]; |
| 156 } | 158 } |
| OLD | NEW |