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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_context_menu_mac.mm
diff --git a/chrome/browser/tab_contents/render_view_context_menu_mac.mm b/chrome/browser/tab_contents/render_view_context_menu_mac.mm
index 582f8addedf652528b0b828769a98caec45ff92d..1e4e4c4089c11c8f5377142ee568fc01459d82f4 100644
--- a/chrome/browser/tab_contents/render_view_context_menu_mac.mm
+++ b/chrome/browser/tab_contents/render_view_context_menu_mac.mm
@@ -77,6 +77,10 @@ void RenderViewContextMenuMac::LookUpInDictionary() {
// don't support it: http://crbug.com/17951
NSString* text = base::SysWideToNSString(params_.selection_text);
NSPasteboard* pboard = [NSPasteboard pasteboardWithUniqueName];
+ // 10.5 and earlier require declareTypes before setData.
+ // See the documentation on [NSPasteboard declareTypes].
+ NSArray* toDeclare = [NSArray arrayWithObject:NSStringPboardType];
+ [pboard declareTypes:toDeclare owner:nil];
BOOL ok = [pboard setString:text forType:NSStringPboardType];
if (ok)
NSPerformService(@"Look Up in Dictionary", pboard);
« 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