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/image/image_skia.h"
14 #include "ui/gfx/vector2d.h"
21 // OSExchangeData::Provider implementation for aura on linux.
22 class UI_BASE_EXPORT OSExchangeDataProviderAura
23 : public OSExchangeData::Provider
{
25 OSExchangeDataProviderAura();
26 virtual ~OSExchangeDataProviderAura();
28 // Overridden from OSExchangeData::Provider:
29 virtual Provider
* Clone() const OVERRIDE
;
30 virtual void MarkOriginatedFromRenderer() OVERRIDE
;
31 virtual bool DidOriginateFromRenderer() const OVERRIDE
;
32 virtual void SetString(const base::string16
& data
) OVERRIDE
;
33 virtual void SetURL(const GURL
& url
, const base::string16
& title
) OVERRIDE
;
34 virtual void SetFilename(const base::FilePath
& path
) OVERRIDE
;
35 virtual void SetFilenames(const std::vector
<FileInfo
>& filenames
) OVERRIDE
;
36 virtual void SetPickledData(const OSExchangeData::CustomFormat
& format
,
37 const Pickle
& data
) OVERRIDE
;
38 virtual bool GetString(base::string16
* data
) const OVERRIDE
;
39 virtual bool GetURLAndTitle(OSExchangeData::FilenameToURLPolicy policy
,
41 base::string16
* title
) const OVERRIDE
;
42 virtual bool GetFilename(base::FilePath
* path
) const OVERRIDE
;
43 virtual bool GetFilenames(std::vector
<FileInfo
>* filenames
) const OVERRIDE
;
44 virtual bool GetPickledData(const OSExchangeData::CustomFormat
& format
,
45 Pickle
* data
) const OVERRIDE
;
46 virtual bool HasString() const OVERRIDE
;
47 virtual bool HasURL(OSExchangeData::FilenameToURLPolicy policy
) const
49 virtual bool HasFile() const OVERRIDE
;
50 virtual bool HasCustomFormat(const OSExchangeData::CustomFormat
& format
) const
53 virtual void SetHtml(const base::string16
& html
,
54 const GURL
& base_url
) OVERRIDE
;
55 virtual bool GetHtml(base::string16
* html
, GURL
* base_url
) const OVERRIDE
;
56 virtual bool HasHtml() const OVERRIDE
;
57 virtual void SetDragImage(const gfx::ImageSkia
& image
,
58 const gfx::Vector2d
& cursor_offset
) OVERRIDE
;
59 virtual const gfx::ImageSkia
& GetDragImage() const OVERRIDE
;
60 virtual const gfx::Vector2d
& GetDragImageOffset() const OVERRIDE
;
63 typedef std::map
<OSExchangeData::CustomFormat
, Pickle
> PickleData
;
65 // Returns true if |formats_| contains a string format and the string can be
67 bool GetPlainTextURL(GURL
* url
) const;
69 // Actual formats that have been set. See comment above |known_formats_|
74 base::string16 string_
;
78 base::string16 title_
;
81 std::vector
<FileInfo
> filenames_
;
83 // PICKLED_DATA contents.
84 PickleData pickle_data_
;
86 // Drag image and offset data.
87 gfx::ImageSkia drag_image_
;
88 gfx::Vector2d drag_image_offset_
;
94 DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderAura
);
99 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_AURA_H_