OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ | 6 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
15 #include <objidl.h> | 15 #include <objidl.h> |
16 #elif !defined(OS_MACOSX) | 16 #elif !defined(OS_MACOSX) |
17 #include <gtk/gtk.h> | 17 #include <gtk/gtk.h> |
18 #endif | 18 #endif |
19 | 19 |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/file_path.h" | 21 #include "base/file_path.h" |
22 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
23 #include "ui/base/dragdrop/download_file_interface.h" | 23 #include "ui/base/dragdrop/download_file_interface.h" |
24 #include "ui/ui_api.h" | 24 #include "ui/base/ui_export.h" |
25 | 25 |
26 class GURL; | 26 class GURL; |
27 class Pickle; | 27 class Pickle; |
28 | 28 |
29 namespace ui { | 29 namespace ui { |
30 | 30 |
31 /////////////////////////////////////////////////////////////////////////////// | 31 /////////////////////////////////////////////////////////////////////////////// |
32 // | 32 // |
33 // OSExchangeData | 33 // OSExchangeData |
34 // An object that holds interchange data to be sent out to OS services like | 34 // An object that holds interchange data to be sent out to OS services like |
35 // clipboard, drag and drop, etc. This object exposes an API that clients can | 35 // clipboard, drag and drop, etc. This object exposes an API that clients can |
36 // use to specify raw data and its high level type. This object takes care of | 36 // use to specify raw data and its high level type. This object takes care of |
37 // translating that into something the OS can understand. | 37 // translating that into something the OS can understand. |
38 // | 38 // |
39 /////////////////////////////////////////////////////////////////////////////// | 39 /////////////////////////////////////////////////////////////////////////////// |
40 | 40 |
41 // NOTE: Support for html and file contents is required by TabContentViewWin. | 41 // NOTE: Support for html and file contents is required by TabContentViewWin. |
42 // TabContentsViewGtk uses a different class to handle drag support that does | 42 // TabContentsViewGtk uses a different class to handle drag support that does |
43 // not use OSExchangeData. As such, file contents and html support is only | 43 // not use OSExchangeData. As such, file contents and html support is only |
44 // compiled on windows. | 44 // compiled on windows. |
45 class UI_API OSExchangeData { | 45 class UI_EXPORT OSExchangeData { |
46 public: | 46 public: |
47 // CustomFormats are used for non-standard data types. For example, bookmark | 47 // CustomFormats are used for non-standard data types. For example, bookmark |
48 // nodes are written using a CustomFormat. | 48 // nodes are written using a CustomFormat. |
49 #if defined(OS_WIN) | 49 #if defined(OS_WIN) |
50 typedef CLIPFORMAT CustomFormat; | 50 typedef CLIPFORMAT CustomFormat; |
51 #elif !defined(OS_MACOSX) | 51 #elif !defined(OS_MACOSX) |
52 typedef GdkAtom CustomFormat; | 52 typedef GdkAtom CustomFormat; |
53 #endif | 53 #endif |
54 | 54 |
55 // Enumeration of the known formats. | 55 // Enumeration of the known formats. |
56 enum Format { | 56 enum Format { |
57 STRING = 1 << 0, | 57 STRING = 1 << 0, |
58 URL = 1 << 1, | 58 URL = 1 << 1, |
59 FILE_NAME = 1 << 2, | 59 FILE_NAME = 1 << 2, |
60 PICKLED_DATA = 1 << 3, | 60 PICKLED_DATA = 1 << 3, |
61 #if defined(OS_WIN) | 61 #if defined(OS_WIN) |
62 FILE_CONTENTS = 1 << 4, | 62 FILE_CONTENTS = 1 << 4, |
63 HTML = 1 << 5, | 63 HTML = 1 << 5, |
64 #endif | 64 #endif |
65 }; | 65 }; |
66 | 66 |
67 // Encapsulates the info about a file to be downloaded. | 67 // Encapsulates the info about a file to be downloaded. |
68 struct UI_API DownloadFileInfo { | 68 struct UI_EXPORT DownloadFileInfo { |
69 DownloadFileInfo(const FilePath& filename, | 69 DownloadFileInfo(const FilePath& filename, |
70 DownloadFileProvider* downloader); | 70 DownloadFileProvider* downloader); |
71 ~DownloadFileInfo(); | 71 ~DownloadFileInfo(); |
72 | 72 |
73 FilePath filename; | 73 FilePath filename; |
74 scoped_refptr<DownloadFileProvider> downloader; | 74 scoped_refptr<DownloadFileProvider> downloader; |
75 }; | 75 }; |
76 | 76 |
77 // Provider defines the platform specific part of OSExchangeData that | 77 // Provider defines the platform specific part of OSExchangeData that |
78 // interacts with the native system. | 78 // interacts with the native system. |
79 class UI_API Provider { | 79 class UI_EXPORT Provider { |
80 public: | 80 public: |
81 Provider() {} | 81 Provider() {} |
82 virtual ~Provider() {} | 82 virtual ~Provider() {} |
83 | 83 |
84 virtual void SetString(const string16& data) = 0; | 84 virtual void SetString(const string16& data) = 0; |
85 virtual void SetURL(const GURL& url, const string16& title) = 0; | 85 virtual void SetURL(const GURL& url, const string16& title) = 0; |
86 virtual void SetFilename(const FilePath& path) = 0; | 86 virtual void SetFilename(const FilePath& path) = 0; |
87 virtual void SetPickledData(CustomFormat format, const Pickle& data) = 0; | 87 virtual void SetPickledData(CustomFormat format, const Pickle& data) = 0; |
88 | 88 |
89 virtual bool GetString(string16* data) const = 0; | 89 virtual bool GetString(string16* data) const = 0; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 // Provides the actual data. | 191 // Provides the actual data. |
192 scoped_ptr<Provider> provider_; | 192 scoped_ptr<Provider> provider_; |
193 | 193 |
194 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); | 194 DISALLOW_COPY_AND_ASSIGN(OSExchangeData); |
195 }; | 195 }; |
196 | 196 |
197 } // namespace ui | 197 } // namespace ui |
198 | 198 |
199 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ | 199 #endif // UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_H_ |
OLD | NEW |