Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / dragdrop / os_exchange_data_provider_aura.h
blobb489bcbd682b3a405435dc3a3dca99b7bef3aa8a
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.
5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURA_H_
6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURA_H_
8 #include <map>
10 #include "base/files/file_path.h"
11 #include "base/pickle.h"
12 #include "ui/base/dragdrop/os_exchange_data.h"
13 #include "ui/gfx/geometry/vector2d.h"
14 #include "ui/gfx/image/image_skia.h"
15 #include "url/gurl.h"
17 namespace ui {
19 class Clipboard;
21 // OSExchangeData::Provider implementation for aura on linux.
22 class UI_BASE_EXPORT OSExchangeDataProviderAura
23 : public OSExchangeData::Provider {
24 public:
25 OSExchangeDataProviderAura();
26 ~OSExchangeDataProviderAura() override;
28 // Overridden from OSExchangeData::Provider:
29 Provider* Clone() const override;
30 void MarkOriginatedFromRenderer() override;
31 bool DidOriginateFromRenderer() const override;
32 void SetString(const base::string16& data) override;
33 void SetURL(const GURL& url, const base::string16& title) override;
34 void SetFilename(const base::FilePath& path) override;
35 void SetFilenames(const std::vector<FileInfo>& filenames) override;
36 void SetPickledData(const OSExchangeData::CustomFormat& format,
37 const Pickle& data) override;
38 bool GetString(base::string16* data) const override;
39 bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy,
40 GURL* url,
41 base::string16* title) const override;
42 bool GetFilename(base::FilePath* path) const override;
43 bool GetFilenames(std::vector<FileInfo>* filenames) const override;
44 bool GetPickledData(const OSExchangeData::CustomFormat& format,
45 Pickle* data) const override;
46 bool HasString() const override;
47 bool HasURL(OSExchangeData::FilenameToURLPolicy policy) const override;
48 bool HasFile() const override;
49 bool HasCustomFormat(const OSExchangeData::CustomFormat& format) const
50 override;
52 void SetHtml(const base::string16& html, const GURL& base_url) override;
53 bool GetHtml(base::string16* html, GURL* base_url) const override;
54 bool HasHtml() const override;
55 void SetDragImage(const gfx::ImageSkia& image,
56 const gfx::Vector2d& cursor_offset) override;
57 const gfx::ImageSkia& GetDragImage() const override;
58 const gfx::Vector2d& GetDragImageOffset() const override;
60 private:
61 typedef std::map<OSExchangeData::CustomFormat, Pickle> PickleData;
63 // Returns true if |formats_| contains a string format and the string can be
64 // parsed as a URL.
65 bool GetPlainTextURL(GURL* url) const;
67 // Actual formats that have been set. See comment above |known_formats_|
68 // for details.
69 int formats_;
71 // String contents.
72 base::string16 string_;
74 // URL contents.
75 GURL url_;
76 base::string16 title_;
78 // File name.
79 std::vector<FileInfo> filenames_;
81 // PICKLED_DATA contents.
82 PickleData pickle_data_;
84 // Drag image and offset data.
85 gfx::ImageSkia drag_image_;
86 gfx::Vector2d drag_image_offset_;
88 // For HTML format
89 base::string16 html_;
90 GURL base_url_;
92 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAura);
95 } // namespace ui
97 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURA_H_