OLD | NEW |
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 "app/clipboard/clipboard.h" | 5 #include "app/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" |
11 #include "base/mac_util.h" | 11 #include "base/mac/mac_util.h" |
12 #include "base/mac/scoped_cftyperef.h" | 12 #include "base/mac/scoped_cftyperef.h" |
13 #include "base/scoped_nsobject.h" | 13 #include "base/scoped_nsobject.h" |
14 #include "base/sys_string_conversions.h" | 14 #include "base/sys_string_conversions.h" |
15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
16 #include "gfx/size.h" | 16 #include "gfx/size.h" |
17 #import "third_party/mozilla/NSPasteboard+Utils.h" | 17 #import "third_party/mozilla/NSPasteboard+Utils.h" |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Would be nice if this were in UTCoreTypes.h, but it isn't | 21 // Would be nice if this were in UTCoreTypes.h, but it isn't |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( | 114 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( |
115 CGDataProviderCreateWithCFData(data)); | 115 CGDataProviderCreateWithCFData(data)); |
116 | 116 |
117 base::mac::ScopedCFTypeRef<CGImageRef> cgimage( | 117 base::mac::ScopedCFTypeRef<CGImageRef> cgimage( |
118 CGImageCreate(size->width(), | 118 CGImageCreate(size->width(), |
119 size->height(), | 119 size->height(), |
120 8, | 120 8, |
121 32, | 121 32, |
122 size->width()*4, | 122 size->width()*4, |
123 mac_util::GetSRGBColorSpace(), // TODO(avi): do better | 123 base::mac::GetSRGBColorSpace(), // TODO(avi): do better |
124 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, | 124 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, |
125 data_provider, | 125 data_provider, |
126 NULL, | 126 NULL, |
127 false, | 127 false, |
128 kCGRenderingIntentDefault)); | 128 kCGRenderingIntentDefault)); |
129 // Aggressively free storage since image buffers can potentially be very | 129 // Aggressively free storage since image buffers can potentially be very |
130 // large. | 130 // large. |
131 data_provider.reset(); | 131 data_provider.reset(); |
132 data.reset(); | 132 data.reset(); |
133 | 133 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 static const std::string type = base::SysNSStringToUTF8(NSTIFFPboardType); | 320 static const std::string type = base::SysNSStringToUTF8(NSTIFFPboardType); |
321 return type; | 321 return type; |
322 } | 322 } |
323 | 323 |
324 // static | 324 // static |
325 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { | 325 Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { |
326 static const std::string type = | 326 static const std::string type = |
327 base::SysNSStringToUTF8(kWebSmartPastePboardType); | 327 base::SysNSStringToUTF8(kWebSmartPastePboardType); |
328 return type; | 328 return type; |
329 } | 329 } |
OLD | NEW |