| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ | 5 #ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ |
| 6 #define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ | 6 #define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ |
| 7 | 7 |
| 8 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "base/memory/ref_counted.h" |
| 11 #include "ui/base/ui_base_export.h" | 12 #include "ui/base/ui_base_export.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 16 class UniquePasteboard : public base::RefCounted<UniquePasteboard> { |
| 17 public: |
| 18 UniquePasteboard(); |
| 19 |
| 20 NSPasteboard* get() { return pasteboard_; } |
| 21 |
| 22 private: |
| 23 friend class base::RefCounted<UniquePasteboard>; |
| 24 ~UniquePasteboard(); |
| 25 base::scoped_nsobject<NSPasteboard> pasteboard_; |
| 26 }; |
| 27 |
| 15 class UI_BASE_EXPORT ClipboardUtil { | 28 class UI_BASE_EXPORT ClipboardUtil { |
| 16 public: | 29 public: |
| 17 // Returns an NSPasteboardItem that represents the given |url|. | 30 // Returns an NSPasteboardItem that represents the given |url|. |
| 18 // |url| must not be nil. | 31 // |url| must not be nil. |
| 19 // If |title| is nil, |url| is used in its place. | 32 // If |title| is nil, |url| is used in its place. |
| 20 static base::scoped_nsobject<NSPasteboardItem> PasteboardItemFromUrl( | 33 static base::scoped_nsobject<NSPasteboardItem> PasteboardItemFromUrl( |
| 21 NSString* url, | 34 NSString* url, |
| 22 NSString* title); | 35 NSString* title); |
| 23 }; | 36 }; |
| 24 } | 37 } |
| 25 | 38 |
| 26 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ | 39 #endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ |
| OLD | NEW |