| 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/clipboard/DataObjectItem.h" | 32 #include "core/clipboard/DataObjectItem.h" |
| 33 | 33 |
| 34 #include "core/clipboard/Pasteboard.h" | 34 #include "core/clipboard/Pasteboard.h" |
| 35 #include "core/fileapi/Blob.h" | 35 #include "core/fileapi/Blob.h" |
| 36 #include "platform/clipboard/ClipboardMimeTypes.h" | 36 #include "platform/clipboard/ClipboardMimeTypes.h" |
| 37 #include "public/platform/Platform.h" | 37 #include "public/platform/Platform.h" |
| 38 #include "public/platform/WebClipboard.h" | 38 #include "public/platform/WebClipboard.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 PassRefPtr<DataObjectItem> DataObjectItem::createFromString(const String& type,
const String& data) | 42 DEFINE_GC_INFO(DataObjectItem); |
| 43 |
| 44 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromString(const St
ring& type, const String& data) |
| 43 { | 45 { |
| 44 RefPtr<DataObjectItem> item = adoptRef(new DataObjectItem(StringKind, type))
; | 46 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI
tem(StringKind, type)); |
| 45 item->m_data = data; | 47 item->m_data = data; |
| 46 return item.release(); | 48 return item.release(); |
| 47 } | 49 } |
| 48 | 50 |
| 49 PassRefPtr<DataObjectItem> DataObjectItem::createFromFile(PassRefPtr<File> file) | 51 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromFile(PassRefPtr
<File> file) |
| 50 { | 52 { |
| 51 RefPtr<DataObjectItem> item = adoptRef(new DataObjectItem(FileKind, file->ty
pe())); | 53 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI
tem(FileKind, file->type())); |
| 52 item->m_file = file; | 54 item->m_file = file; |
| 53 return item.release(); | 55 return item.release(); |
| 54 } | 56 } |
| 55 | 57 |
| 56 PassRefPtr<DataObjectItem> DataObjectItem::createFromURL(const String& url, cons
t String& title) | 58 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromURL(const Strin
g& url, const String& title) |
| 57 { | 59 { |
| 58 RefPtr<DataObjectItem> item = adoptRef(new DataObjectItem(StringKind, mimeTy
peTextURIList)); | 60 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI
tem(StringKind, mimeTypeTextURIList)); |
| 59 item->m_data = url; | 61 item->m_data = url; |
| 60 item->m_title = title; | 62 item->m_title = title; |
| 61 return item.release(); | 63 return item.release(); |
| 62 } | 64 } |
| 63 | 65 |
| 64 PassRefPtr<DataObjectItem> DataObjectItem::createFromHTML(const String& html, co
nst KURL& baseURL) | 66 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromHTML(const Stri
ng& html, const KURL& baseURL) |
| 65 { | 67 { |
| 66 RefPtr<DataObjectItem> item = adoptRef(new DataObjectItem(StringKind, mimeTy
peTextHTML)); | 68 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI
tem(StringKind, mimeTypeTextHTML)); |
| 67 item->m_data = html; | 69 item->m_data = html; |
| 68 item->m_baseURL = baseURL; | 70 item->m_baseURL = baseURL; |
| 69 return item.release(); | 71 return item.release(); |
| 70 } | 72 } |
| 71 | 73 |
| 72 PassRefPtr<DataObjectItem> DataObjectItem::createFromSharedBuffer(const String&
name, PassRefPtr<SharedBuffer> buffer) | 74 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromSharedBuffer(co
nst String& name, PassRefPtr<SharedBuffer> buffer) |
| 73 { | 75 { |
| 74 RefPtr<DataObjectItem> item = adoptRef(new DataObjectItem(FileKind, String()
)); | 76 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI
tem(FileKind, String())); |
| 75 item->m_sharedBuffer = buffer; | 77 item->m_sharedBuffer = buffer; |
| 76 item->m_title = name; | 78 item->m_title = name; |
| 77 return item.release(); | 79 return item.release(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 PassRefPtr<DataObjectItem> DataObjectItem::createFromPasteboard(const String& ty
pe, uint64_t sequenceNumber) | 82 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromPasteboard(cons
t String& type, uint64_t sequenceNumber) |
| 81 { | 83 { |
| 82 if (type == mimeTypeImagePng) | 84 if (type == mimeTypeImagePng) |
| 83 return adoptRef(new DataObjectItem(FileKind, type, sequenceNumber)); | 85 return adoptRefWillBeNoop(new DataObjectItem(FileKind, type, sequenceNum
ber)); |
| 84 return adoptRef(new DataObjectItem(StringKind, type, sequenceNumber)); | 86 return adoptRefWillBeNoop(new DataObjectItem(StringKind, type, sequenceNumbe
r)); |
| 85 } | 87 } |
| 86 | 88 |
| 87 DataObjectItem::DataObjectItem(Kind kind, const String& type) | 89 DataObjectItem::DataObjectItem(Kind kind, const String& type) |
| 88 : m_source(InternalSource) | 90 : m_source(InternalSource) |
| 89 , m_kind(kind) | 91 , m_kind(kind) |
| 90 , m_type(type) | 92 , m_type(type) |
| 91 , m_sequenceNumber(0) | 93 , m_sequenceNumber(0) |
| 92 { | 94 { |
| 93 } | 95 } |
| 94 | 96 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 | 167 |
| 166 bool DataObjectItem::isFilename() const | 168 bool DataObjectItem::isFilename() const |
| 167 { | 169 { |
| 168 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su
pport File dragout, | 170 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su
pport File dragout, |
| 169 // we'll need to make sure this works as expected for DragDataChromium. | 171 // we'll need to make sure this works as expected for DragDataChromium. |
| 170 return m_kind == FileKind && m_file; | 172 return m_kind == FileKind && m_file; |
| 171 } | 173 } |
| 172 | 174 |
| 173 } // namespace WebCore | 175 } // namespace WebCore |
| 174 | 176 |
| OLD | NEW |