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; |
24 | 31 |
25 // Overridden from OSExchangeData::Provider: | 32 // Overridden from OSExchangeData::Provider: |
26 Provider* Clone() const override; | 33 Provider* Clone() const override; |
27 void MarkOriginatedFromRenderer() override; | 34 void MarkOriginatedFromRenderer() override; |
28 bool DidOriginateFromRenderer() const override; | 35 bool DidOriginateFromRenderer() const override; |
29 void SetString(const base::string16& data) override; | 36 void SetString(const base::string16& data) override; |
30 void SetURL(const GURL& url, const base::string16& title) override; | 37 void SetURL(const GURL& url, const base::string16& title) override; |
31 void SetFilename(const base::FilePath& path) override; | 38 void SetFilename(const base::FilePath& path) override; |
32 void SetFilenames(const std::vector<FileInfo>& filenames) override; | 39 void SetFilenames(const std::vector<FileInfo>& filenames) override; |
33 void SetPickledData(const Clipboard::FormatType& format, | 40 void SetPickledData(const Clipboard::FormatType& format, |
34 const base::Pickle& data) override; | 41 const base::Pickle& data) override; |
42 void SetDragImage(const gfx::ImageSkia& image, | |
tapted
2016/05/24 08:06:00
nit: move down after HasCustomFormat() -- generall
spqchan
2016/05/26 01:56:53
Done.
| |
43 const gfx::Vector2d& cursor_offset) override; | |
44 void SetEvent(const Event& event) override; | |
35 bool GetString(base::string16* data) const override; | 45 bool GetString(base::string16* data) const override; |
36 bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy, | 46 bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy, |
37 GURL* url, | 47 GURL* url, |
38 base::string16* title) const override; | 48 base::string16* title) const override; |
39 bool GetFilename(base::FilePath* path) const override; | 49 bool GetFilename(base::FilePath* path) const override; |
40 bool GetFilenames(std::vector<FileInfo>* filenames) const override; | 50 bool GetFilenames(std::vector<FileInfo>* filenames) const override; |
41 bool GetPickledData(const Clipboard::FormatType& format, | 51 bool GetPickledData(const Clipboard::FormatType& format, |
42 base::Pickle* data) const override; | 52 base::Pickle* data) const override; |
53 const gfx::ImageSkia& GetDragImage() const override; | |
54 const gfx::Vector2d& GetDragImageOffset() const override; | |
55 const Event* GetEvent() const override; | |
56 NSData* GetNSDataForType(NSString* type) const; | |
tapted
2016/05/24 08:06:00
non-overrides should be separate (move below, with
spqchan
2016/05/26 01:56:53
Done.
| |
43 bool HasString() const override; | 57 bool HasString() const override; |
44 bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const override; | 58 bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const override; |
45 bool HasFile() const override; | 59 bool HasFile() const override; |
46 bool HasCustomFormat(const Clipboard::FormatType& format) const override; | 60 bool HasCustomFormat(const Clipboard::FormatType& format) const override; |
47 | 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(); | |
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 |