| 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" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 | 71 |
| 72 } | 72 } |
| 73 | 73 |
| 74 void RenderViewContextMenuMac::LookUpInDictionary() { | 74 void RenderViewContextMenuMac::LookUpInDictionary() { |
| 75 // TODO(morrita): On Safari, A dictionary panel could be shown | 75 // TODO(morrita): On Safari, A dictionary panel could be shown |
| 76 // based on a preference setting of Dictionary.app. We currently | 76 // based on a preference setting of Dictionary.app. We currently |
| 77 // don't support it: http://crbug.com/17951 | 77 // don't support it: http://crbug.com/17951 |
| 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. |
| 81 // See the documentation on [NSPasteboard declareTypes]. |
| 82 NSArray* toDeclare = [NSArray arrayWithObject:NSStringPboardType]; |
| 83 [pboard declareTypes:toDeclare owner:nil]; |
| 80 BOOL ok = [pboard setString:text forType:NSStringPboardType]; | 84 BOOL ok = [pboard setString:text forType:NSStringPboardType]; |
| 81 if (ok) | 85 if (ok) |
| 82 NSPerformService(@"Look Up in Dictionary", pboard); | 86 NSPerformService(@"Look Up in Dictionary", pboard); |
| 83 } | 87 } |
| OLD | NEW |