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_
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"
21 // OSExchangeData::Provider implementation for aura on linux.
22 class UI_BASE_EXPORT OSExchangeDataProviderAura
23 : public OSExchangeData::Provider
{
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 base::Pickle
& data
) override
;
38 bool GetString(base::string16
* data
) const override
;
39 bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy
,
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 base::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
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
;
61 typedef std::map
<OSExchangeData::CustomFormat
, base::Pickle
> PickleData
;
63 // Returns true if |formats_| contains a string format and the string can be
65 bool GetPlainTextURL(GURL
* url
) const;
67 // Actual formats that have been set. See comment above |known_formats_|
72 base::string16 string_
;
76 base::string16 title_
;
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_
;
92 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAura
);
97 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURA_H_