OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/scoped_nsobject.h" | 9 #include "base/scoped_nsobject.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
11 #include "chrome/app/chrome_dll_resource.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #import "chrome/browser/cocoa/menu_controller.h" | 12 #import "chrome/browser/cocoa/menu_controller.h" |
13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
14 | 14 |
15 // Obj-C bridge class that is the target of all items in the context menu. | 15 // Obj-C bridge class that is the target of all items in the context menu. |
16 // Relies on the tag being set to the command id. | 16 // Relies on the tag being set to the command id. |
17 | 17 |
18 RenderViewContextMenuMac::RenderViewContextMenuMac( | 18 RenderViewContextMenuMac::RenderViewContextMenuMac( |
19 TabContents* web_contents, | 19 TabContents* web_contents, |
20 const ContextMenuParams& params, | 20 const ContextMenuParams& params, |
21 NSView* parent_view) | 21 NSView* parent_view) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 NSString* text = base::SysWideToNSString(params_.selection_text); | 78 NSString* text = base::SysWideToNSString(params_.selection_text); |
79 NSPasteboard* pboard = [NSPasteboard pasteboardWithUniqueName]; | 79 NSPasteboard* pboard = [NSPasteboard pasteboardWithUniqueName]; |
80 // 10.5 and earlier require declareTypes before setData. | 80 // 10.5 and earlier require declareTypes before setData. |
81 // See the documentation on [NSPasteboard declareTypes]. | 81 // See the documentation on [NSPasteboard declareTypes]. |
82 NSArray* toDeclare = [NSArray arrayWithObject:NSStringPboardType]; | 82 NSArray* toDeclare = [NSArray arrayWithObject:NSStringPboardType]; |
83 [pboard declareTypes:toDeclare owner:nil]; | 83 [pboard declareTypes:toDeclare owner:nil]; |
84 BOOL ok = [pboard setString:text forType:NSStringPboardType]; | 84 BOOL ok = [pboard setString:text forType:NSStringPboardType]; |
85 if (ok) | 85 if (ok) |
86 NSPerformService(@"Look Up in Dictionary", pboard); | 86 NSPerformService(@"Look Up in Dictionary", pboard); |
87 } | 87 } |
OLD | NEW |