| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2008, 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #ifndef DataObject_h | 31 #ifndef DataObject_h |
| 32 #define DataObject_h | 32 #define DataObject_h |
| 33 | 33 |
| 34 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 35 #include "core/clipboard/DataObjectItem.h" | 35 #include "core/clipboard/DataObjectItem.h" |
| 36 #include "platform/PasteMode.h" | 36 #include "platform/PasteMode.h" |
| 37 #include "platform/Supplementable.h" | 37 #include "platform/Supplementable.h" |
| 38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 39 #include "wtf/ListHashSet.h" | 39 #include "wtf/ListHashSet.h" |
| 40 #include "wtf/RefCounted.h" | 40 #include "wtf/PassRefPtr.h" |
| 41 #include "wtf/RefPtr.h" | |
| 42 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 43 #include "wtf/text/StringHash.h" | 42 #include "wtf/text/StringHash.h" |
| 44 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
| 45 | 44 |
| 46 namespace blink { | 45 namespace blink { |
| 47 | 46 |
| 48 class KURL; | 47 class KURL; |
| 49 class SharedBuffer; | 48 class SharedBuffer; |
| 50 class WebDragData; | 49 class WebDragData; |
| 51 | 50 |
| 52 // A data object for holding data that would be in a clipboard or moved | 51 // A data object for holding data that would be in a clipboard or moved |
| 53 // during a drag-n-drop operation. This is the data that WebCore is aware | 52 // during a drag-n-drop operation. This is the data that WebCore is aware |
| 54 // of and is not specific to a platform. | 53 // of and is not specific to a platform. |
| 55 class CORE_EXPORT DataObject : public RefCountedWillBeGarbageCollectedFinalized<
DataObject>, public WillBeHeapSupplementable<DataObject> { | 54 class CORE_EXPORT DataObject : public GarbageCollectedFinalized<DataObject>, pub
lic HeapSupplementable<DataObject> { |
| 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DataObject); | 55 USING_GARBAGE_COLLECTED_MIXIN(DataObject); |
| 57 public: | 56 public: |
| 58 static PassRefPtrWillBeRawPtr<DataObject> createFromPasteboard(PasteMode); | 57 static DataObject* createFromPasteboard(PasteMode); |
| 59 static PassRefPtrWillBeRawPtr<DataObject> create(); | 58 static DataObject* create(); |
| 60 static PassRefPtrWillBeRawPtr<DataObject> create(WebDragData); | 59 static DataObject* create(WebDragData); |
| 61 | 60 |
| 62 virtual ~DataObject(); | 61 virtual ~DataObject(); |
| 63 | 62 |
| 64 // DataTransferItemList support. | 63 // DataTransferItemList support. |
| 65 size_t length() const; | 64 size_t length() const; |
| 66 PassRefPtrWillBeRawPtr<DataObjectItem> item(unsigned long index); | 65 DataObjectItem* item(unsigned long index); |
| 67 // FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get th
is called. | 66 // FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get th
is called. |
| 68 void deleteItem(unsigned long index); | 67 void deleteItem(unsigned long index); |
| 69 void clearAll(); | 68 void clearAll(); |
| 70 // Returns null if an item already exists with the provided type. | 69 // Returns null if an item already exists with the provided type. |
| 71 PassRefPtrWillBeRawPtr<DataObjectItem> add(const String& data, const String&
type); | 70 DataObjectItem* add(const String& data, const String& type); |
| 72 PassRefPtrWillBeRawPtr<DataObjectItem> add(File*); | 71 DataObjectItem* add(File*); |
| 73 | 72 |
| 74 // WebCore helpers. | 73 // WebCore helpers. |
| 75 void clearData(const String& type); | 74 void clearData(const String& type); |
| 76 | 75 |
| 77 ListHashSet<String> types() const; | 76 ListHashSet<String> types() const; |
| 78 String getData(const String& type) const; | 77 String getData(const String& type) const; |
| 79 void setData(const String& type, const String& data); | 78 void setData(const String& type, const String& data); |
| 80 | 79 |
| 81 void urlAndTitle(String& url, String* title = 0) const; | 80 void urlAndTitle(String& url, String* title = 0) const; |
| 82 void setURLAndTitle(const String& url, const String& title); | 81 void setURLAndTitle(const String& url, const String& title); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 98 int modifiers() const { return m_modifiers; } | 97 int modifiers() const { return m_modifiers; } |
| 99 void setModifiers(int modifiers) { m_modifiers = modifiers; } | 98 void setModifiers(int modifiers) { m_modifiers = modifiers; } |
| 100 | 99 |
| 101 DECLARE_TRACE(); | 100 DECLARE_TRACE(); |
| 102 | 101 |
| 103 WebDragData toWebDragData(); | 102 WebDragData toWebDragData(); |
| 104 | 103 |
| 105 private: | 104 private: |
| 106 DataObject(); | 105 DataObject(); |
| 107 | 106 |
| 108 PassRefPtrWillBeRawPtr<DataObjectItem> findStringItem(const String& type) co
nst; | 107 DataObjectItem* findStringItem(const String& type) const; |
| 109 bool internalAddStringItem(PassRefPtrWillBeRawPtr<DataObjectItem>); | 108 bool internalAddStringItem(DataObjectItem*); |
| 110 void internalAddFileItem(PassRefPtrWillBeRawPtr<DataObjectItem>); | 109 void internalAddFileItem(DataObjectItem*); |
| 111 | 110 |
| 112 WillBeHeapVector<RefPtrWillBeMember<DataObjectItem>> m_itemList; | 111 HeapVector<Member<DataObjectItem>> m_itemList; |
| 113 | 112 |
| 114 // State of Shift/Ctrl/Alt/Meta keys and Left/Right/Middle mouse buttons | 113 // State of Shift/Ctrl/Alt/Meta keys and Left/Right/Middle mouse buttons |
| 115 int m_modifiers; | 114 int m_modifiers; |
| 116 String m_filesystemId; | 115 String m_filesystemId; |
| 117 }; | 116 }; |
| 118 | 117 |
| 119 } // namespace blink | 118 } // namespace blink |
| 120 | 119 |
| 121 #endif | 120 #endif |
| OLD | NEW |