#include "core/clipboard/DataObjectItem.h"
#include "platform/PasteMode.h"
#include "platform/Supplementable.h"
+#include "platform/heap/Handle.h"
#include "wtf/ListHashSet.h"
#include "wtf/RefCounted.h"
#include "wtf/RefPtr.h"
#include "wtf/text/StringHash.h"
#include "wtf/text/WTFString.h"
-namespace WebCore {
+namespace blink {
class KURL;
class SharedBuffer;
// A data object for holding data that would be in a clipboard or moved
// during a drag-n-drop operation. This is the data that WebCore is aware
// of and is not specific to a platform.
-class DataObject : public RefCounted<DataObject>, public Supplementable<DataObject> {
+class DataObject : public RefCountedWillBeGarbageCollectedFinalized<DataObject>, public WillBeHeapSupplementable<DataObject> {
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DataObject);
public:
- static PassRefPtr<DataObject> createFromPasteboard(PasteMode);
- static PassRefPtr<DataObject> create();
+ static PassRefPtrWillBeRawPtr<DataObject> createFromPasteboard(PasteMode);
+ static PassRefPtrWillBeRawPtr<DataObject> create();
- PassRefPtr<DataObject> copy() const;
+ PassRefPtrWillBeRawPtr<DataObject> copy() const;
+
+ virtual ~DataObject();
// DataTransferItemList support.
size_t length() const;
- PassRefPtr<DataObjectItem> item(unsigned long index);
+ PassRefPtrWillBeRawPtr<DataObjectItem> item(unsigned long index);
// FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get this called.
void deleteItem(unsigned long index);
void clearAll();
// Returns null if an item already exists with the provided type.
- PassRefPtr<DataObjectItem> add(const String& data, const String& type);
- PassRefPtr<DataObjectItem> add(PassRefPtr<File>);
+ PassRefPtrWillBeRawPtr<DataObjectItem> add(const String& data, const String& type);
+ PassRefPtrWillBeRawPtr<DataObjectItem> add(PassRefPtrWillBeRawPtr<File>);
// WebCore helpers.
void clearData(const String& type);
- void clearAllExceptFiles();
ListHashSet<String> types() const;
String getData(const String& type) const;
- bool setData(const String& type, const String& data);
+ void setData(const String& type, const String& data);
void urlAndTitle(String& url, String* title = 0) const;
void setURLAndTitle(const String& url, const String& title);
Vector<String> filenames() const;
void addFilename(const String& filename, const String& displayName);
+ // Used for dragging in filesystem from the desktop.
+ void setFilesystemId(const String& fileSystemId) { m_filesystemId = fileSystemId; }
+ const String& filesystemId() const { ASSERT(!m_filesystemId.isEmpty()); return m_filesystemId; }
+
// Used to handle files (images) being dragged out.
void addSharedBuffer(const String& name, PassRefPtr<SharedBuffer>);
int modifierKeyState() const { return m_modifierKeyState; }
void setModifierKeyState(int modifierKeyState) { m_modifierKeyState = modifierKeyState; }
+ void trace(Visitor*);
+
private:
DataObject();
explicit DataObject(const DataObject&);
- PassRefPtr<DataObjectItem> findStringItem(const String& type) const;
- bool internalAddStringItem(PassRefPtr<DataObjectItem>);
- void internalAddFileItem(PassRefPtr<DataObjectItem>);
+ PassRefPtrWillBeRawPtr<DataObjectItem> findStringItem(const String& type) const;
+ bool internalAddStringItem(PassRefPtrWillBeRawPtr<DataObjectItem>);
+ void internalAddFileItem(PassRefPtrWillBeRawPtr<DataObjectItem>);
- Vector<RefPtr<DataObjectItem> > m_itemList;
+ WillBeHeapVector<RefPtrWillBeMember<DataObjectItem> > m_itemList;
// State of Shift/Ctrl/Alt/Meta keys.
int m_modifierKeyState;
+ String m_filesystemId;
};
-} // namespace WebCore
+} // namespace blink
#endif