OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/base/clipboard/clipboard.h" | 5 #include "ui/base/clipboard/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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 [NSGraphicsContext graphicsContextWithGraphicsPort:gc flipped:NO]; | 277 [NSGraphicsContext graphicsContextWithGraphicsPort:gc flipped:NO]; |
278 [NSGraphicsContext setCurrentContext:cocoa_gc]; | 278 [NSGraphicsContext setCurrentContext:cocoa_gc]; |
279 [image drawInRect:NSMakeRect(0, 0, width, height) | 279 [image drawInRect:NSMakeRect(0, 0, width, height) |
280 fromRect:NSZeroRect | 280 fromRect:NSZeroRect |
281 operation:NSCompositeCopy | 281 operation:NSCompositeCopy |
282 fraction:1.0]; | 282 fraction:1.0]; |
283 } | 283 } |
284 return canvas.ExtractBitmap(); | 284 return canvas.ExtractBitmap(); |
285 } | 285 } |
286 | 286 |
287 void Clipboard::ReadCustomData(Buffer buffer, | |
288 const string16& type, | |
289 string16* data) const { | |
290 // TODO(dcheng): Implement this. | |
tony
2011/12/02 00:13:29
ditto
dcheng
2011/12/02 00:29:17
Done.
| |
291 } | |
292 | |
287 void Clipboard::ReadBookmark(string16* title, std::string* url) const { | 293 void Clipboard::ReadBookmark(string16* title, std::string* url) const { |
288 NSPasteboard* pb = GetPasteboard(); | 294 NSPasteboard* pb = GetPasteboard(); |
289 | 295 |
290 if (title) { | 296 if (title) { |
291 NSString* contents = [pb stringForType:kUTTypeURLName]; | 297 NSString* contents = [pb stringForType:kUTTypeURLName]; |
292 UTF8ToUTF16([contents UTF8String], | 298 UTF8ToUTF16([contents UTF8String], |
293 [contents lengthOfBytesUsingEncoding:NSUTF8StringEncoding], | 299 [contents lengthOfBytesUsingEncoding:NSUTF8StringEncoding], |
294 title); | 300 title); |
295 } | 301 } |
296 | 302 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 Clipboard::FormatType Clipboard::GetBitmapFormatType() { | 380 Clipboard::FormatType Clipboard::GetBitmapFormatType() { |
375 return base::SysNSStringToUTF8(NSTIFFPboardType); | 381 return base::SysNSStringToUTF8(NSTIFFPboardType); |
376 } | 382 } |
377 | 383 |
378 // static | 384 // static |
379 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { | 385 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { |
380 return base::SysNSStringToUTF8(kWebSmartPastePboardType); | 386 return base::SysNSStringToUTF8(kWebSmartPastePboardType); |
381 } | 387 } |
382 | 388 |
383 } // namespace ui | 389 } // namespace ui |
OLD | NEW |