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

Side by Side Diff: base/clipboard_mac.mm

Issue 194052: Clipboard:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fixes Created 11 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 | Annotate | Revision Log
« no previous file with comments | « base/clipboard_linux.cc ('k') | base/clipboard_unittest.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/clipboard.h" 5 #include "base/clipboard.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // TODO(avi): url_data? 66 // TODO(avi): url_data?
67 NSPasteboard* pb = GetPasteboard(); 67 NSPasteboard* pb = GetPasteboard();
68 [pb addTypes:[NSArray arrayWithObject:NSHTMLPboardType] owner:nil]; 68 [pb addTypes:[NSArray arrayWithObject:NSHTMLPboardType] owner:nil];
69 [pb setString:html_fragment forType:NSHTMLPboardType]; 69 [pb setString:html_fragment forType:NSHTMLPboardType];
70 } 70 }
71 71
72 void Clipboard::WriteBookmark(const char* title_data, 72 void Clipboard::WriteBookmark(const char* title_data,
73 size_t title_len, 73 size_t title_len,
74 const char* url_data, 74 const char* url_data,
75 size_t url_len) { 75 size_t url_len) {
76 WriteHyperlink(title_data, title_len, url_data, url_len);
77 }
78
79 void Clipboard::WriteHyperlink(const char* title_data,
80 size_t title_len,
81 const char* url_data,
82 size_t url_len) {
83 std::string title_str(title_data, title_len); 76 std::string title_str(title_data, title_len);
84 NSString *title = base::SysUTF8ToNSString(title_str); 77 NSString *title = base::SysUTF8ToNSString(title_str);
85 std::string url_str(url_data, url_len); 78 std::string url_str(url_data, url_len);
86 NSString *url = base::SysUTF8ToNSString(url_str); 79 NSString *url = base::SysUTF8ToNSString(url_str);
87 80
88 // TODO(playmobil): In the Windows version of this function, an HTML 81 // TODO(playmobil): In the Windows version of this function, an HTML
89 // representation of the bookmark is also added to the clipboard, to support 82 // representation of the bookmark is also added to the clipboard, to support
90 // drag and drop of web shortcuts. I don't think we need to do this on the 83 // drag and drop of web shortcuts. I don't think we need to do this on the
91 // Mac, but we should double check later on. 84 // Mac, but we should double check later on.
92 NSURL* nsurl = [NSURL URLWithString:url]; 85 NSURL* nsurl = [NSURL URLWithString:url];
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 static const std::string type = base::SysNSStringToUTF8(NSHTMLPboardType); 275 static const std::string type = base::SysNSStringToUTF8(NSHTMLPboardType);
283 return type; 276 return type;
284 } 277 }
285 278
286 // static 279 // static
287 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { 280 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() {
288 static const std::string type = 281 static const std::string type =
289 base::SysNSStringToUTF8(kWebSmartPastePboardType); 282 base::SysNSStringToUTF8(kWebSmartPastePboardType);
290 return type; 283 return type;
291 } 284 }
OLDNEW
« no previous file with comments | « base/clipboard_linux.cc ('k') | base/clipboard_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698