2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
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.
34 #include "WebCommon.h"
36 #if WEBKIT_IMPLEMENTATION
37 namespace WebCore { class ChromiumDataObject; }
38 namespace WTF { template <typename T> class PassRefPtr; }
44 class WebDragDataPrivate;
47 template <typename T> class WebVector;
49 // Holds data that may be exchanged through a drag-n-drop operation. It is
50 // inexpensive to copy a WebDragData object.
53 ~WebDragData() { reset(); }
55 WebDragData() : m_private(0) { }
56 WebDragData(const WebDragData& d) : m_private(0) { assign(d); }
57 WebDragData& operator=(const WebDragData& d)
63 WEBKIT_EXPORT void initialize();
64 WEBKIT_EXPORT void reset();
65 WEBKIT_EXPORT void assign(const WebDragData&);
67 bool isNull() const { return !m_private; }
69 WEBKIT_EXPORT WebString url() const;
70 WEBKIT_EXPORT void setURL(const WebURL&);
72 WEBKIT_EXPORT WebString urlTitle() const;
73 WEBKIT_EXPORT void setURLTitle(const WebString&);
75 WEBKIT_EXPORT WebString downloadMetadata() const;
76 WEBKIT_EXPORT void setDownloadMetadata(const WebString&);
78 WEBKIT_EXPORT WebString fileExtension() const;
79 WEBKIT_EXPORT void setFileExtension(const WebString&);
81 WEBKIT_EXPORT bool containsFilenames() const;
82 WEBKIT_EXPORT void filenames(WebVector<WebString>&) const;
83 WEBKIT_EXPORT void setFilenames(const WebVector<WebString>&);
84 WEBKIT_EXPORT void appendToFilenames(const WebString&);
86 WEBKIT_EXPORT WebString plainText() const;
87 WEBKIT_EXPORT void setPlainText(const WebString&);
89 WEBKIT_EXPORT WebString htmlText() const;
90 WEBKIT_EXPORT void setHTMLText(const WebString&);
92 WEBKIT_EXPORT WebURL htmlBaseURL() const;
93 WEBKIT_EXPORT void setHTMLBaseURL(const WebURL&);
95 WEBKIT_EXPORT WebString fileContentFilename() const;
96 WEBKIT_EXPORT void setFileContentFilename(const WebString&);
98 WEBKIT_EXPORT WebData fileContent() const;
99 WEBKIT_EXPORT void setFileContent(const WebData&);
101 #if WEBKIT_IMPLEMENTATION
102 WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&);
103 WebDragData& operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&);
104 operator WTF::PassRefPtr<WebCore::ChromiumDataObject>() const;
108 void assign(WebDragDataPrivate*);
109 void ensureMutable();
110 WebDragDataPrivate* m_private;
113 } // namespace WebKit