]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/cef_drag_data.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / cef_drag_data.h
1 // Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
35 //
36
37 #ifndef CEF_INCLUDE_CEF_DRAG_DATA_H_
38 #define CEF_INCLUDE_CEF_DRAG_DATA_H_
39 #pragma once
40
41 #include "include/cef_base.h"
42 #include "include/cef_stream.h"
43 #include <vector>
44
45 ///
46 // Class used to represent drag data. The methods of this class may be called
47 // on any thread.
48 ///
49 /*--cef(source=library)--*/
50 class CefDragData : public virtual CefBase {
51  public:
52   ///
53   // Create a new CefDragData object.
54   ///
55   /*--cef()--*/
56   static CefRefPtr<CefDragData> Create();
57
58   ///
59   // Returns a copy of the current object.
60   ///
61   /*--cef()--*/
62   virtual CefRefPtr<CefDragData> Clone() =0;
63
64   ///
65   // Returns true if this object is read-only.
66   ///
67   /*--cef()--*/
68   virtual bool IsReadOnly() =0;
69
70   ///
71   // Returns true if the drag data is a link.
72   ///
73   /*--cef()--*/
74   virtual bool IsLink() =0;
75
76   ///
77   // Returns true if the drag data is a text or html fragment.
78   ///
79   /*--cef()--*/
80   virtual bool IsFragment() =0;
81
82   ///
83   // Returns true if the drag data is a file.
84   ///
85   /*--cef()--*/
86   virtual bool IsFile() =0;
87
88   ///
89   // Return the link URL that is being dragged.
90   ///
91   /*--cef()--*/
92   virtual CefString GetLinkURL() =0;
93
94   ///
95   // Return the title associated with the link being dragged.
96   ///
97   /*--cef()--*/
98   virtual CefString GetLinkTitle() =0;
99
100   ///
101   // Return the metadata, if any, associated with the link being dragged.
102   ///
103   /*--cef()--*/
104   virtual CefString GetLinkMetadata() =0;
105
106   ///
107   // Return the plain text fragment that is being dragged.
108   ///
109   /*--cef()--*/
110   virtual CefString GetFragmentText() =0;
111
112   ///
113   // Return the text/html fragment that is being dragged.
114   ///
115   /*--cef()--*/
116   virtual CefString GetFragmentHtml() =0;
117
118   ///
119   // Return the base URL that the fragment came from. This value is used for
120   // resolving relative URLs and may be empty.
121   ///
122   /*--cef()--*/
123   virtual CefString GetFragmentBaseURL() =0;
124
125   ///
126   // Return the name of the file being dragged out of the browser window.
127   ///
128   /*--cef()--*/
129   virtual CefString GetFileName() =0;
130
131   ///
132   // Write the contents of the file being dragged out of the web view into
133   // |writer|. Returns the number of bytes sent to |writer|. If |writer| is
134   // NULL this method will return the size of the file contents in bytes.
135   // Call GetFileName() to get a suggested name for the file.
136   ///
137   /*--cef(optional_param=writer)--*/
138   virtual size_t GetFileContents(CefRefPtr<CefStreamWriter> writer) =0;
139
140   ///
141   // Retrieve the list of file names that are being dragged into the browser
142   // window.
143   ///
144   /*--cef()--*/
145   virtual bool GetFileNames(std::vector<CefString>& names) =0;
146
147   ///
148   // Set the link URL that is being dragged.
149   ///
150   /*--cef(optional_param=url)--*/
151   virtual void SetLinkURL(const CefString& url) =0;
152
153   ///
154   // Set the title associated with the link being dragged.
155   ///
156   /*--cef(optional_param=title)--*/
157   virtual void SetLinkTitle(const CefString& title) =0;
158
159   ///
160   // Set the metadata associated with the link being dragged.
161   ///
162   /*--cef(optional_param=data)--*/
163   virtual void SetLinkMetadata(const CefString& data) =0;
164
165   ///
166   // Set the plain text fragment that is being dragged.
167   ///
168   /*--cef(optional_param=text)--*/
169   virtual void SetFragmentText(const CefString& text) =0;
170
171   ///
172   // Set the text/html fragment that is being dragged.
173   ///
174   /*--cef(optional_param=html)--*/
175   virtual void SetFragmentHtml(const CefString& html) =0;
176
177   ///
178   // Set the base URL that the fragment came from.
179   ///
180   /*--cef(optional_param=base_url)--*/
181   virtual void SetFragmentBaseURL(const CefString& base_url) =0;
182
183   ///
184   // Reset the file contents. You should do this before calling
185   // CefBrowserHost::DragTargetDragEnter as the web view does not allow us to
186   // drag in this kind of data.
187   ///
188   /*--cef()--*/
189   virtual void ResetFileContents() =0;
190
191   ///
192   // Add a file that is being dragged into the webview.
193   ///
194   /*--cef(optional_param=display_name)--*/
195   virtual void AddFile(const CefString& path, const CefString& display_name) =0;
196 };
197
198 #endif  // CEF_INCLUDE_CEF_DRAG_DATA_H_