| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 class DataObjectItem : public RefCountedWillBeGarbageCollectedFinalized<DataObje
ctItem> { | 46 class DataObjectItem : public RefCountedWillBeGarbageCollectedFinalized<DataObje
ctItem> { |
| 47 DECLARE_GC_INFO; | 47 DECLARE_GC_INFO; |
| 48 public: | 48 public: |
| 49 enum Kind { | 49 enum Kind { |
| 50 StringKind, | 50 StringKind, |
| 51 FileKind | 51 FileKind |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromString(const String&
type, const String& data); | 54 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromString(const String&
type, const String& data); |
| 55 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromFile(PassRefPtr<File
>); | 55 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromFile(PassRefPtrWillB
eRawPtr<File>); |
| 56 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromURL(const String& ur
l, const String& title); | 56 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromURL(const String& ur
l, const String& title); |
| 57 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromHTML(const String& h
tml, const KURL& baseURL); | 57 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromHTML(const String& h
tml, const KURL& baseURL); |
| 58 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromSharedBuffer(const S
tring& filename, PassRefPtr<SharedBuffer>); | 58 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromSharedBuffer(const S
tring& filename, PassRefPtr<SharedBuffer>); |
| 59 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromPasteboard(const Str
ing& type, uint64_t sequenceNumber); | 59 static PassRefPtrWillBeRawPtr<DataObjectItem> createFromPasteboard(const Str
ing& type, uint64_t sequenceNumber); |
| 60 | 60 |
| 61 Kind kind() const { return m_kind; } | 61 Kind kind() const { return m_kind; } |
| 62 String type() const { return m_type; } | 62 String type() const { return m_type; } |
| 63 String getAsString() const; | 63 String getAsString() const; |
| 64 PassRefPtr<Blob> getAsFile() const; | 64 PassRefPtrWillBeRawPtr<Blob> getAsFile() const; |
| 65 | 65 |
| 66 // Used to support legacy DataTransfer APIs and renderer->browser serializat
ion. | 66 // Used to support legacy DataTransfer APIs and renderer->browser serializat
ion. |
| 67 PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; } | 67 PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; } |
| 68 String title() const { return m_title; } | 68 String title() const { return m_title; } |
| 69 KURL baseURL() const { return m_baseURL; } | 69 KURL baseURL() const { return m_baseURL; } |
| 70 bool isFilename() const; | 70 bool isFilename() const; |
| 71 | 71 |
| 72 void trace(Visitor*) { } | 72 void trace(Visitor*); |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 enum DataSource { | 75 enum DataSource { |
| 76 PasteboardSource, | 76 PasteboardSource, |
| 77 InternalSource, | 77 InternalSource, |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 DataObjectItem(Kind, const String& type); | 80 DataObjectItem(Kind, const String& type); |
| 81 DataObjectItem(Kind, const String& type, uint64_t sequenceNumber); | 81 DataObjectItem(Kind, const String& type, uint64_t sequenceNumber); |
| 82 | 82 |
| 83 DataSource m_source; | 83 DataSource m_source; |
| 84 Kind m_kind; | 84 Kind m_kind; |
| 85 String m_type; | 85 String m_type; |
| 86 | 86 |
| 87 String m_data; | 87 String m_data; |
| 88 RefPtr<File> m_file; | 88 RefPtrWillBeMember<File> m_file; |
| 89 RefPtr<SharedBuffer> m_sharedBuffer; | 89 RefPtr<SharedBuffer> m_sharedBuffer; |
| 90 // Optional metadata. Currently used for URL, HTML, and dragging files in. | 90 // Optional metadata. Currently used for URL, HTML, and dragging files in. |
| 91 String m_title; | 91 String m_title; |
| 92 KURL m_baseURL; | 92 KURL m_baseURL; |
| 93 | 93 |
| 94 uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource | 94 uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace WebCore | 97 } // namespace WebCore |
| 98 | 98 |
| 99 #endif // DataObjectItem_h | 99 #endif // DataObjectItem_h |
| OLD | NEW |