| 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* result) const { |
| 290 // TODO(dcheng): Implement this. |
| 291 NOTIMPLEMENTED(); |
| 292 } |
| 293 |
| 287 void Clipboard::ReadBookmark(string16* title, std::string* url) const { | 294 void Clipboard::ReadBookmark(string16* title, std::string* url) const { |
| 288 NSPasteboard* pb = GetPasteboard(); | 295 NSPasteboard* pb = GetPasteboard(); |
| 289 | 296 |
| 290 if (title) { | 297 if (title) { |
| 291 NSString* contents = [pb stringForType:kUTTypeURLName]; | 298 NSString* contents = [pb stringForType:kUTTypeURLName]; |
| 292 UTF8ToUTF16([contents UTF8String], | 299 UTF8ToUTF16([contents UTF8String], |
| 293 [contents lengthOfBytesUsingEncoding:NSUTF8StringEncoding], | 300 [contents lengthOfBytesUsingEncoding:NSUTF8StringEncoding], |
| 294 title); | 301 title); |
| 295 } | 302 } |
| 296 | 303 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 Clipboard::FormatType Clipboard::GetBitmapFormatType() { | 381 Clipboard::FormatType Clipboard::GetBitmapFormatType() { |
| 375 return base::SysNSStringToUTF8(NSTIFFPboardType); | 382 return base::SysNSStringToUTF8(NSTIFFPboardType); |
| 376 } | 383 } |
| 377 | 384 |
| 378 // static | 385 // static |
| 379 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { | 386 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { |
| 380 return base::SysNSStringToUTF8(kWebSmartPastePboardType); | 387 return base::SysNSStringToUTF8(kWebSmartPastePboardType); |
| 381 } | 388 } |
| 382 | 389 |
| 383 } // namespace ui | 390 } // namespace ui |
| OLD | NEW |