| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const String& data); | 49 const String& data); |
| 50 static DataObjectItem* createFromFile(File*); | 50 static DataObjectItem* createFromFile(File*); |
| 51 // File with non-empty filesystem ID can be converted into FileEntry by using | 51 // File with non-empty filesystem ID can be converted into FileEntry by using |
| 52 // webkitGetAsEntry. | 52 // webkitGetAsEntry. |
| 53 static DataObjectItem* createFromFileWithFileSystemId( | 53 static DataObjectItem* createFromFileWithFileSystemId( |
| 54 File*, | 54 File*, |
| 55 const String& fileSystemId); | 55 const String& fileSystemId); |
| 56 static DataObjectItem* createFromURL(const String& url, const String& title); | 56 static DataObjectItem* createFromURL(const String& url, const String& title); |
| 57 static DataObjectItem* createFromHTML(const String& html, | 57 static DataObjectItem* createFromHTML(const String& html, |
| 58 const KURL& baseURL); | 58 const KURL& baseURL); |
| 59 static DataObjectItem* createFromSharedBuffer(const String& filename, | 59 static DataObjectItem* createFromSharedBuffer( |
| 60 PassRefPtr<SharedBuffer>); | 60 PassRefPtr<SharedBuffer>, |
| 61 const KURL&, |
| 62 const String& fileExtension, |
| 63 const AtomicString& contentDisposition); |
| 61 static DataObjectItem* createFromPasteboard(const String& type, | 64 static DataObjectItem* createFromPasteboard(const String& type, |
| 62 uint64_t sequenceNumber); | 65 uint64_t sequenceNumber); |
| 63 | 66 |
| 64 ItemKind kind() const { return m_kind; } | 67 ItemKind kind() const { return m_kind; } |
| 65 String type() const { return m_type; } | 68 String type() const { return m_type; } |
| 66 String getAsString() const; | 69 String getAsString() const; |
| 67 File* getAsFile() const; | 70 File* getAsFile() const; |
| 68 | 71 |
| 69 // Used to support legacy DataTransfer APIs and renderer->browser | 72 // Used to support legacy DataTransfer APIs and renderer->browser |
| 70 // serialization. | 73 // serialization. |
| 71 PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; } | 74 PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; } |
| 75 String filenameExtension() const { return m_filenameExtension; } |
| 72 String title() const { return m_title; } | 76 String title() const { return m_title; } |
| 73 KURL baseURL() const { return m_baseURL; } | 77 KURL baseURL() const { return m_baseURL; } |
| 74 bool isFilename() const; | 78 bool isFilename() const; |
| 75 | 79 |
| 76 bool hasFileSystemId() const; | 80 bool hasFileSystemId() const; |
| 77 String fileSystemId() const; | 81 String fileSystemId() const; |
| 78 | 82 |
| 79 DECLARE_TRACE(); | 83 DECLARE_TRACE(); |
| 80 | 84 |
| 81 private: | 85 private: |
| 82 enum DataSource { | 86 enum DataSource { |
| 83 PasteboardSource, | 87 PasteboardSource, |
| 84 InternalSource, | 88 InternalSource, |
| 85 }; | 89 }; |
| 86 | 90 |
| 87 DataObjectItem(ItemKind, const String& type); | 91 DataObjectItem(ItemKind, const String& type); |
| 88 DataObjectItem(ItemKind, const String& type, uint64_t sequenceNumber); | 92 DataObjectItem(ItemKind, const String& type, uint64_t sequenceNumber); |
| 89 | 93 |
| 90 DataSource m_source; | 94 DataSource m_source; |
| 91 ItemKind m_kind; | 95 ItemKind m_kind; |
| 92 String m_type; | 96 String m_type; |
| 93 | 97 |
| 94 String m_data; | 98 String m_data; |
| 95 Member<File> m_file; | 99 Member<File> m_file; |
| 96 RefPtr<SharedBuffer> m_sharedBuffer; | 100 RefPtr<SharedBuffer> m_sharedBuffer; |
| 97 // Optional metadata. Currently used for URL, HTML, and dragging files in. | 101 // Optional metadata. Currently used for URL, HTML, and dragging files in. |
| 102 String m_filenameExtension; |
| 98 String m_title; | 103 String m_title; |
| 99 KURL m_baseURL; | 104 KURL m_baseURL; |
| 100 | 105 |
| 101 uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource | 106 uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource |
| 102 String m_fileSystemId; // Only valid when m_file is backed by FileEntry. | 107 String m_fileSystemId; // Only valid when m_file is backed by FileEntry. |
| 103 }; | 108 }; |
| 104 | 109 |
| 105 } // namespace blink | 110 } // namespace blink |
| 106 | 111 |
| 107 #endif // DataObjectItem_h | 112 #endif // DataObjectItem_h |
| OLD | NEW |