Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef DataObject_h | 31 #ifndef DataObject_h |
| 32 #define DataObject_h | 32 #define DataObject_h |
| 33 | 33 |
| 34 #include "core/clipboard/DataObjectItem.h" | 34 #include "core/clipboard/DataObjectItem.h" |
| 35 #include "heap/Handle.h" | |
| 35 #include "platform/PasteMode.h" | 36 #include "platform/PasteMode.h" |
| 36 #include "platform/Supplementable.h" | 37 #include "platform/Supplementable.h" |
| 37 #include "wtf/ListHashSet.h" | 38 #include "wtf/ListHashSet.h" |
| 38 #include "wtf/RefCounted.h" | 39 #include "wtf/RefCounted.h" |
| 39 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 40 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 41 #include "wtf/text/StringHash.h" | 42 #include "wtf/text/StringHash.h" |
| 42 #include "wtf/text/WTFString.h" | 43 #include "wtf/text/WTFString.h" |
| 43 | 44 |
| 44 namespace WebCore { | 45 namespace WebCore { |
| 45 | 46 |
| 46 class KURL; | 47 class KURL; |
| 47 class SharedBuffer; | 48 class SharedBuffer; |
| 48 | 49 |
| 49 // A data object for holding data that would be in a clipboard or moved | 50 // A data object for holding data that would be in a clipboard or moved |
| 50 // during a drag-n-drop operation. This is the data that WebCore is aware | 51 // during a drag-n-drop operation. This is the data that WebCore is aware |
| 51 // of and is not specific to a platform. | 52 // of and is not specific to a platform. |
| 52 class DataObject : public RefCounted<DataObject>, public Supplementable<DataObje ct> { | 53 class DataObject : public RefCountedWillBeGarbageCollected<DataObject>, public S upplementable<DataObject> { |
|
Mads Ager (chromium)
2014/02/19 09:54:37
This needs to be finalized. Supplementable has a s
haraken
2014/02/19 10:37:24
Done.
| |
| 54 DECLARE_GC_INFO; | |
| 53 public: | 55 public: |
| 54 static PassRefPtr<DataObject> createFromPasteboard(PasteMode); | 56 static PassRefPtrWillBeRawPtr<DataObject> createFromPasteboard(PasteMode); |
| 55 static PassRefPtr<DataObject> create(); | 57 static PassRefPtrWillBeRawPtr<DataObject> create(); |
| 56 | 58 |
| 57 PassRefPtr<DataObject> copy() const; | 59 PassRefPtrWillBeRawPtr<DataObject> copy() const; |
| 58 | 60 |
| 59 // DataTransferItemList support. | 61 // DataTransferItemList support. |
| 60 size_t length() const; | 62 size_t length() const; |
| 61 PassRefPtr<DataObjectItem> item(unsigned long index); | 63 PassRefPtrWillBeRawPtr<DataObjectItem> item(unsigned long index); |
| 62 // FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get th is called. | 64 // FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get th is called. |
| 63 void deleteItem(unsigned long index); | 65 void deleteItem(unsigned long index); |
| 64 void clearAll(); | 66 void clearAll(); |
| 65 // Returns null if an item already exists with the provided type. | 67 // Returns null if an item already exists with the provided type. |
| 66 PassRefPtr<DataObjectItem> add(const String& data, const String& type); | 68 PassRefPtrWillBeRawPtr<DataObjectItem> add(const String& data, const String& type); |
| 67 PassRefPtr<DataObjectItem> add(PassRefPtr<File>); | 69 PassRefPtrWillBeRawPtr<DataObjectItem> add(PassRefPtr<File>); |
| 68 | 70 |
| 69 // WebCore helpers. | 71 // WebCore helpers. |
| 70 void clearData(const String& type); | 72 void clearData(const String& type); |
| 71 void clearAllExceptFiles(); | 73 void clearAllExceptFiles(); |
| 72 | 74 |
| 73 ListHashSet<String> types() const; | 75 ListHashSet<String> types() const; |
| 74 String getData(const String& type) const; | 76 String getData(const String& type) const; |
| 75 bool setData(const String& type, const String& data); | 77 bool setData(const String& type, const String& data); |
| 76 | 78 |
| 77 void urlAndTitle(String& url, String* title = 0) const; | 79 void urlAndTitle(String& url, String* title = 0) const; |
| 78 void setURLAndTitle(const String& url, const String& title); | 80 void setURLAndTitle(const String& url, const String& title); |
| 79 void htmlAndBaseURL(String& html, KURL& baseURL) const; | 81 void htmlAndBaseURL(String& html, KURL& baseURL) const; |
| 80 void setHTMLAndBaseURL(const String& html, const KURL& baseURL); | 82 void setHTMLAndBaseURL(const String& html, const KURL& baseURL); |
| 81 | 83 |
| 82 // Used for dragging in files from the desktop. | 84 // Used for dragging in files from the desktop. |
| 83 bool containsFilenames() const; | 85 bool containsFilenames() const; |
| 84 Vector<String> filenames() const; | 86 Vector<String> filenames() const; |
| 85 void addFilename(const String& filename, const String& displayName); | 87 void addFilename(const String& filename, const String& displayName); |
| 86 | 88 |
| 87 // Used to handle files (images) being dragged out. | 89 // Used to handle files (images) being dragged out. |
| 88 void addSharedBuffer(const String& name, PassRefPtr<SharedBuffer>); | 90 void addSharedBuffer(const String& name, PassRefPtr<SharedBuffer>); |
| 89 | 91 |
| 90 int modifierKeyState() const { return m_modifierKeyState; } | 92 int modifierKeyState() const { return m_modifierKeyState; } |
| 91 void setModifierKeyState(int modifierKeyState) { m_modifierKeyState = modifi erKeyState; } | 93 void setModifierKeyState(int modifierKeyState) { m_modifierKeyState = modifi erKeyState; } |
| 92 | 94 |
| 95 // FIXME: oilpan: This trace() has to trace Supplementable. | |
| 96 void trace(Visitor*); | |
| 97 | |
| 93 private: | 98 private: |
| 94 DataObject(); | 99 DataObject(); |
| 95 explicit DataObject(const DataObject&); | 100 explicit DataObject(const DataObject&); |
| 96 | 101 |
| 97 PassRefPtr<DataObjectItem> findStringItem(const String& type) const; | 102 PassRefPtrWillBeRawPtr<DataObjectItem> findStringItem(const String& type) co nst; |
| 98 bool internalAddStringItem(PassRefPtr<DataObjectItem>); | 103 bool internalAddStringItem(PassRefPtrWillBeRawPtr<DataObjectItem>); |
| 99 void internalAddFileItem(PassRefPtr<DataObjectItem>); | 104 void internalAddFileItem(PassRefPtrWillBeRawPtr<DataObjectItem>); |
| 100 | 105 |
| 101 Vector<RefPtr<DataObjectItem> > m_itemList; | 106 WillBeHeapVector<RefPtrWillBeMember<DataObjectItem> > m_itemList; |
| 102 | 107 |
| 103 // State of Shift/Ctrl/Alt/Meta keys. | 108 // State of Shift/Ctrl/Alt/Meta keys. |
| 104 int m_modifierKeyState; | 109 int m_modifierKeyState; |
| 105 }; | 110 }; |
| 106 | 111 |
| 107 } // namespace WebCore | 112 } // namespace WebCore |
| 108 | 113 |
| 109 #endif | 114 #endif |
| OLD | NEW |