OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_ | 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_ |
6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_ | 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_ |
7 | 7 |
| 8 #include "base/event_types.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
10 #import "ui/base/clipboard/clipboard_util_mac.h" | 11 #import "ui/base/clipboard/clipboard_util_mac.h" |
11 #include "ui/base/dragdrop/os_exchange_data.h" | 12 #include "ui/base/dragdrop/os_exchange_data.h" |
| 13 #include "ui/events/event.h" |
| 14 #include "ui/gfx/geometry/vector2d.h" |
| 15 #include "ui/gfx/image/image_skia.h" |
12 | 16 |
13 @class NSPasteboard; | 17 @class NSPasteboard; |
| 18 @class NSArray; |
| 19 @class NSData; |
| 20 @class NSString; |
14 | 21 |
15 namespace ui { | 22 namespace ui { |
16 class UniquePasteboard; | 23 class UniquePasteboard; |
17 | 24 |
18 // OSExchangeData::Provider implementation for Mac. | 25 // OSExchangeData::Provider implementation for Mac. |
19 class UI_BASE_EXPORT OSExchangeDataProviderMac | 26 class UI_BASE_EXPORT OSExchangeDataProviderMac |
20 : public OSExchangeData::Provider { | 27 : public OSExchangeData::Provider { |
21 public: | 28 public: |
22 OSExchangeDataProviderMac(); | 29 OSExchangeDataProviderMac(); |
23 ~OSExchangeDataProviderMac() override; | 30 ~OSExchangeDataProviderMac() override; |
(...skipping 13 matching lines...) Expand all Loading... |
37 GURL* url, | 44 GURL* url, |
38 base::string16* title) const override; | 45 base::string16* title) const override; |
39 bool GetFilename(base::FilePath* path) const override; | 46 bool GetFilename(base::FilePath* path) const override; |
40 bool GetFilenames(std::vector<FileInfo>* filenames) const override; | 47 bool GetFilenames(std::vector<FileInfo>* filenames) const override; |
41 bool GetPickledData(const Clipboard::FormatType& format, | 48 bool GetPickledData(const Clipboard::FormatType& format, |
42 base::Pickle* data) const override; | 49 base::Pickle* data) const override; |
43 bool HasString() const override; | 50 bool HasString() const override; |
44 bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const override; | 51 bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const override; |
45 bool HasFile() const override; | 52 bool HasFile() const override; |
46 bool HasCustomFormat(const Clipboard::FormatType& format) const override; | 53 bool HasCustomFormat(const Clipboard::FormatType& format) const override; |
| 54 void SetDragImage(const gfx::ImageSkia& image, |
| 55 const gfx::Vector2d& cursor_offset) override; |
| 56 const gfx::ImageSkia& GetDragImage() const override; |
| 57 const gfx::Vector2d& GetDragImageOffset() const override; |
| 58 |
| 59 // Returns the data for the specified type in the pasteboard. |
| 60 NSData* GetNSDataForType(NSString* type) const; |
| 61 |
| 62 // Returns an array containing the types of data currently contained in |
| 63 // the pasteboard. |
| 64 NSArray* GetPasteboardTypes() const; |
| 65 |
| 66 // Creates an OSExchangeData object from the given NSPasteboard object. |
| 67 static std::unique_ptr<OSExchangeData> CreateDataFromPasteboard( |
| 68 NSPasteboard*); |
| 69 |
| 70 // Returns an array of pasteboard types that can be supported by |
| 71 // OSExchangeData. |
| 72 static NSArray* SupportedPasteboardTypes(); |
47 | 73 |
48 private: | 74 private: |
49 explicit OSExchangeDataProviderMac(scoped_refptr<ui::UniquePasteboard>); | 75 explicit OSExchangeDataProviderMac(scoped_refptr<ui::UniquePasteboard>); |
50 scoped_refptr<ui::UniquePasteboard> pasteboard_; | 76 scoped_refptr<ui::UniquePasteboard> pasteboard_; |
| 77 std::unique_ptr<Event> event_; |
| 78 |
| 79 gfx::ImageSkia drag_image_; |
| 80 gfx::Vector2d cursor_offset_; |
51 | 81 |
52 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderMac); | 82 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderMac); |
53 }; | 83 }; |
54 | 84 |
55 } // namespace ui | 85 } // namespace ui |
56 | 86 |
57 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_ | 87 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_ |
OLD | NEW |