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