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/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) override; | |
| 43 void SetNativeEvent(const base::NativeEvent& event) override; | |
| 35 bool GetString(base::string16* data) const override; | 44 bool GetString(base::string16* data) const override; |
| 36 bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy, | 45 bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy, |
| 37 GURL* url, | 46 GURL* url, |
| 38 base::string16* title) const override; | 47 base::string16* title) const override; |
| 39 bool GetFilename(base::FilePath* path) const override; | 48 bool GetFilename(base::FilePath* path) const override; |
| 40 bool GetFilenames(std::vector<FileInfo>* filenames) const override; | 49 bool GetFilenames(std::vector<FileInfo>* filenames) const override; |
| 41 bool GetPickledData(const Clipboard::FormatType& format, | 50 bool GetPickledData(const Clipboard::FormatType& format, |
| 42 base::Pickle* data) const override; | 51 base::Pickle* data) const override; |
| 52 const gfx::ImageSkia& GetDragImage() const override; | |
| 53 const base::NativeEvent& GetNativeEvent() const override; | |
| 54 NSData* GetNSDataForType(NSString* type) const; | |
| 43 bool HasString() const override; | 55 bool HasString() const override; |
| 44 bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const override; | 56 bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const override; |
| 45 bool HasFile() const override; | 57 bool HasFile() const override; |
| 46 bool HasCustomFormat(const Clipboard::FormatType& format) const override; | 58 bool HasCustomFormat(const Clipboard::FormatType& format) const override; |
| 47 | 59 |
| 60 NSArray* GetPasteboardTypes() const; | |
| 61 | |
| 62 static Provider* CreateProviderFromPasteboard(NSPasteboard*); | |
|
tapted
2016/05/11 12:36:15
return std::unique_ptr maybe
spqchan
2016/05/23 21:26:21
Done.
| |
| 63 static NSArray* SupportedPasteboardTypes(); | |
| 64 | |
| 48 private: | 65 private: |
| 49 explicit OSExchangeDataProviderMac(scoped_refptr<ui::UniquePasteboard>); | 66 explicit OSExchangeDataProviderMac(scoped_refptr<ui::UniquePasteboard>); |
| 50 scoped_refptr<ui::UniquePasteboard> pasteboard_; | 67 scoped_refptr<ui::UniquePasteboard> pasteboard_; |
| 51 | 68 |
| 69 gfx::ImageSkia drag_image_; | |
| 70 | |
| 71 base::NativeEvent event_; | |
|
tapted
2016/05/11 12:36:15
this might need to be retained -> scoped_nsobject<
spqchan
2016/05/23 21:26:21
Done.
| |
| 72 | |
| 52 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderMac); | 73 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderMac); |
| 53 }; | 74 }; |
| 54 | 75 |
| 55 } // namespace ui | 76 } // namespace ui |
| 56 | 77 |
| 57 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_ | 78 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_ |
| OLD | NEW |