| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_CHROMEOS_H_ | |
| 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_CHROMEOS_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/files/file_path.h" | |
| 11 #include "base/pickle.h" | |
| 12 #include "googleurl/src/gurl.h" | |
| 13 #include "ui/base/dragdrop/os_exchange_data.h" | |
| 14 #include "ui/gfx/image/image_skia.h" | |
| 15 #include "ui/gfx/vector2d.h" | |
| 16 | |
| 17 namespace ui { | |
| 18 | |
| 19 class Clipboard; | |
| 20 | |
| 21 // OSExchangeData::Provider implementation for aura on linux. | |
| 22 class UI_EXPORT OSExchangeDataProviderChromeos | |
| 23 : public OSExchangeData::Provider { | |
| 24 public: | |
| 25 OSExchangeDataProviderChromeos(); | |
| 26 virtual ~OSExchangeDataProviderChromeos(); | |
| 27 | |
| 28 // Overridden from OSExchangeData::Provider: | |
| 29 virtual void SetString(const string16& data) OVERRIDE; | |
| 30 virtual void SetURL(const GURL& url, const string16& title) OVERRIDE; | |
| 31 virtual void SetFilename(const base::FilePath& path) OVERRIDE; | |
| 32 virtual void SetFilenames( | |
| 33 const std::vector<OSExchangeData::FileInfo>& filenames) OVERRIDE; | |
| 34 virtual void SetPickledData(OSExchangeData::CustomFormat format, | |
| 35 const Pickle& data) OVERRIDE; | |
| 36 virtual bool GetString(string16* data) const OVERRIDE; | |
| 37 virtual bool GetURLAndTitle(GURL* url, string16* title) const OVERRIDE; | |
| 38 virtual bool GetFilename(base::FilePath* path) const OVERRIDE; | |
| 39 virtual bool GetFilenames( | |
| 40 std::vector<OSExchangeData::FileInfo>* filenames) const OVERRIDE; | |
| 41 virtual bool GetPickledData(OSExchangeData::CustomFormat format, | |
| 42 Pickle* data) const OVERRIDE; | |
| 43 virtual bool HasString() const OVERRIDE; | |
| 44 virtual bool HasURL() const OVERRIDE; | |
| 45 virtual bool HasFile() const OVERRIDE; | |
| 46 virtual bool HasCustomFormat( | |
| 47 OSExchangeData::CustomFormat format) const OVERRIDE; | |
| 48 | |
| 49 virtual void SetHtml(const string16& html, const GURL& base_url) OVERRIDE; | |
| 50 virtual bool GetHtml(string16* html, GURL* base_url) const OVERRIDE; | |
| 51 virtual bool HasHtml() const OVERRIDE; | |
| 52 virtual void SetDragImage(const gfx::ImageSkia& image, | |
| 53 const gfx::Vector2d& cursor_offset) OVERRIDE; | |
| 54 virtual const gfx::ImageSkia& GetDragImage() const OVERRIDE; | |
| 55 virtual const gfx::Vector2d& GetDragImageOffset() const OVERRIDE; | |
| 56 | |
| 57 private: | |
| 58 typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData; | |
| 59 | |
| 60 // Returns true if |formats_| contains a string format and the string can be | |
| 61 // parsed as a URL. | |
| 62 bool GetPlainTextURL(GURL* url) const; | |
| 63 | |
| 64 // Actual formats that have been set. See comment above |known_formats_| | |
| 65 // for details. | |
| 66 int formats_; | |
| 67 | |
| 68 // String contents. | |
| 69 string16 string_; | |
| 70 | |
| 71 // URL contents. | |
| 72 GURL url_; | |
| 73 string16 title_; | |
| 74 | |
| 75 // File name. | |
| 76 std::vector<OSExchangeData::FileInfo> filenames_; | |
| 77 | |
| 78 // PICKLED_DATA contents. | |
| 79 PickleData pickle_data_; | |
| 80 | |
| 81 // Drag image and offset data. | |
| 82 gfx::ImageSkia drag_image_; | |
| 83 gfx::Vector2d drag_image_offset_; | |
| 84 | |
| 85 // For HTML format | |
| 86 string16 html_; | |
| 87 GURL base_url_; | |
| 88 | |
| 89 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderChromeos); | |
| 90 }; | |
| 91 | |
| 92 } // namespace ui | |
| 93 | |
| 94 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_CHROMEOS_H_ | |
| OLD | NEW |