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_util.h" |
12 #include "base/scoped_cftyperef.h" | 12 #include "base/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 |
22 const NSString* kUTTypeURLName = @"public.url-name"; | 22 NSString* const kUTTypeURLName = @"public.url-name"; |
23 | 23 |
24 // Tells us if WebKit was the last to write to the pasteboard. There's no | 24 // Tells us if WebKit was the last to write to the pasteboard. There's no |
25 // actual data associated with this type. | 25 // actual data associated with this type. |
26 const NSString *kWebSmartPastePboardType = @"NeXT smart paste pasteboard type"; | 26 NSString* const kWebSmartPastePboardType = @"NeXT smart paste pasteboard type"; |
27 | 27 |
28 NSPasteboard* GetPasteboard() { | 28 NSPasteboard* GetPasteboard() { |
29 // The pasteboard should not be nil in a UI session, but this handy DCHECK | 29 // The pasteboard should not be nil in a UI session, but this handy DCHECK |
30 // can help track down problems if someone tries using clipboard code outside | 30 // can help track down problems if someone tries using clipboard code outside |
31 // of a UI session. | 31 // of a UI session. |
32 NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; | 32 NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; |
33 DCHECK(pasteboard); | 33 DCHECK(pasteboard); |
34 return pasteboard; | 34 return pasteboard; |
35 } | 35 } |
36 | 36 |
(...skipping 283 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 |