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

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu_mac.mm

Issue 3217006: Mac: Fix a crash on "Look Up in Dictionary" context menu. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: took a feedback Created 10 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698