| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebDragData_h | 31 #ifndef WebDragData_h |
| 32 #define WebDragData_h | 32 #define WebDragData_h |
| 33 | 33 |
| 34 #include "WebCommon.h" | 34 #include "WebCommon.h" |
| 35 #include "WebData.h" | 35 #include "WebData.h" |
| 36 #include "WebString.h" | 36 #include "WebString.h" |
| 37 #include "WebURL.h" | 37 #include "WebURL.h" |
| 38 | 38 |
| 39 #if BLINK_IMPLEMENTATION | |
| 40 namespace WebCore { class DataObject; } | 39 namespace WebCore { class DataObject; } |
| 41 namespace WTF { template <typename T> class PassRefPtr; } | |
| 42 #endif | |
| 43 | 40 |
| 44 namespace blink { | 41 namespace blink { |
| 45 | 42 |
| 46 class WebDragDataPrivate; | 43 class WebDragDataPrivate; |
| 47 template <typename T> class WebVector; | 44 template <typename T> class WebVector; |
| 48 | 45 |
| 49 // Holds data that may be exchanged through a drag-n-drop operation. It is | 46 // Holds data that may be exchanged through a drag-n-drop operation. It is |
| 50 // inexpensive to copy a WebDragData object. | 47 // inexpensive to copy a WebDragData object. |
| 51 class WebDragData { | 48 class WebDragData { |
| 52 public: | 49 public: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 WebData binaryData; | 73 WebData binaryData; |
| 77 | 74 |
| 78 // Title associated with a link when stringType == "text/uri-list". | 75 // Title associated with a link when stringType == "text/uri-list". |
| 79 // Filename when storageType == StorageTypeBinaryData. | 76 // Filename when storageType == StorageTypeBinaryData. |
| 80 WebString title; | 77 WebString title; |
| 81 | 78 |
| 82 // Only valid when stringType == "text/html". | 79 // Only valid when stringType == "text/html". |
| 83 WebURL baseURL; | 80 WebURL baseURL; |
| 84 }; | 81 }; |
| 85 | 82 |
| 83 WebDragData() { } |
| 84 WebDragData(const WebDragData& object) { assign(object); } |
| 85 WebDragData& operator=(const WebDragData& object) |
| 86 { |
| 87 assign(object); |
| 88 return *this; |
| 89 } |
| 86 ~WebDragData() { reset(); } | 90 ~WebDragData() { reset(); } |
| 87 | 91 |
| 88 WebDragData() : m_private(0) { } | 92 bool isNull() const { return m_private.isNull(); } |
| 89 WebDragData(const WebDragData& d) : m_private(0) { assign(d); } | |
| 90 WebDragData& operator=(const WebDragData& d) | |
| 91 { | |
| 92 assign(d); | |
| 93 return *this; | |
| 94 } | |
| 95 | 93 |
| 96 BLINK_EXPORT void initialize(); | 94 BLINK_EXPORT void initialize(); |
| 97 BLINK_EXPORT void reset(); | 95 BLINK_EXPORT void reset(); |
| 98 BLINK_EXPORT void assign(const WebDragData&); | 96 BLINK_EXPORT void assign(const WebDragData&); |
| 99 | 97 |
| 100 bool isNull() const { return !m_private; } | |
| 101 | |
| 102 BLINK_EXPORT WebVector<Item> items() const; | 98 BLINK_EXPORT WebVector<Item> items() const; |
| 103 BLINK_EXPORT void setItems(const WebVector<Item>&); | 99 BLINK_EXPORT void setItems(const WebVector<Item>&); |
| 104 BLINK_EXPORT void addItem(const Item&); | 100 BLINK_EXPORT void addItem(const Item&); |
| 105 | 101 |
| 106 BLINK_EXPORT WebString filesystemId() const; | 102 BLINK_EXPORT WebString filesystemId() const; |
| 107 BLINK_EXPORT void setFilesystemId(const WebString&); | 103 BLINK_EXPORT void setFilesystemId(const WebString&); |
| 108 | 104 |
| 109 #if BLINK_IMPLEMENTATION | 105 #if BLINK_IMPLEMENTATION |
| 110 WebDragData(const WTF::PassRefPtr<WebCore::DataObject>&); | 106 explicit WebDragData(const PassRefPtrWillBeRawPtr<WebCore::DataObject>&); |
| 111 WebDragData& operator=(const WTF::PassRefPtr<WebCore::DataObject>&); | 107 WebDragData& operator=(const PassRefPtrWillBeRawPtr<WebCore::DataObject>&); |
| 112 operator WTF::PassRefPtr<WebCore::DataObject>() const; | 108 WebCore::DataObject* getValue() const; |
| 113 #endif | 109 #endif |
| 114 | 110 |
| 115 private: | 111 private: |
| 116 void assign(WebDragDataPrivate*); | |
| 117 void ensureMutable(); | 112 void ensureMutable(); |
| 118 WebDragDataPrivate* m_private; | 113 WebPrivatePtr<WebCore::DataObject> m_private; |
| 119 }; | 114 }; |
| 120 | 115 |
| 121 } // namespace blink | 116 } // namespace blink |
| 122 | 117 |
| 123 #endif | 118 #endif |
| OLD | NEW |