| 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/DataTransferItem.h" | 32 #include "core/clipboard/DataTransferItem.h" |
| 33 | 33 |
| 34 #include "bindings/v8/V8Binding.h" | 34 #include "bindings/v8/V8Binding.h" |
| 35 #include "core/clipboard/Clipboard.h" | 35 #include "core/clipboard/Clipboard.h" |
| 36 #include "core/clipboard/DataObjectItem.h" | 36 #include "core/clipboard/DataObjectItem.h" |
| 37 #include "core/dom/StringCallback.h" | 37 #include "core/dom/StringCallback.h" |
| 38 #include "wtf/StdLibExtras.h" | 38 #include "wtf/StdLibExtras.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 PassRefPtr<DataTransferItem> DataTransferItem::create(PassRefPtr<Clipboard> clip
board, PassRefPtr<DataObjectItem> item) | 42 DEFINE_GC_INFO(DataTransferItem); |
| 43 |
| 44 PassRefPtrWillBeRawPtr<DataTransferItem> DataTransferItem::create(PassRefPtrWill
BeRawPtr<Clipboard> clipboard, PassRefPtrWillBeRawPtr<DataObjectItem> item) |
| 43 { | 45 { |
| 44 return adoptRef(new DataTransferItem(clipboard, item)); | 46 return adoptRefWillBeNoop(new DataTransferItem(clipboard, item)); |
| 45 } | 47 } |
| 46 | 48 |
| 47 DataTransferItem::~DataTransferItem() | 49 DataTransferItem::~DataTransferItem() |
| 48 { | 50 { |
| 49 } | 51 } |
| 50 | 52 |
| 51 String DataTransferItem::kind() const | 53 String DataTransferItem::kind() const |
| 52 { | 54 { |
| 53 DEFINE_STATIC_LOCAL(const String, kindString, ("string")); | 55 DEFINE_STATIC_LOCAL(const String, kindString, ("string")); |
| 54 DEFINE_STATIC_LOCAL(const String, kindFile, ("file")); | 56 DEFINE_STATIC_LOCAL(const String, kindFile, ("file")); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 82 } | 84 } |
| 83 | 85 |
| 84 PassRefPtr<Blob> DataTransferItem::getAsFile() const | 86 PassRefPtr<Blob> DataTransferItem::getAsFile() const |
| 85 { | 87 { |
| 86 if (!m_clipboard->canReadData()) | 88 if (!m_clipboard->canReadData()) |
| 87 return nullptr; | 89 return nullptr; |
| 88 | 90 |
| 89 return m_item->getAsFile(); | 91 return m_item->getAsFile(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 DataTransferItem::DataTransferItem(PassRefPtr<Clipboard> clipboard, PassRefPtr<D
ataObjectItem> item) | 94 DataTransferItem::DataTransferItem(PassRefPtrWillBeRawPtr<Clipboard> clipboard,
PassRefPtrWillBeRawPtr<DataObjectItem> item) |
| 93 : m_clipboard(clipboard) | 95 : m_clipboard(clipboard) |
| 94 , m_item(item) | 96 , m_item(item) |
| 95 { | 97 { |
| 96 ScriptWrappable::init(this); | 98 ScriptWrappable::init(this); |
| 97 } | 99 } |
| 98 | 100 |
| 101 void DataTransferItem::trace(Visitor* visitor) |
| 102 { |
| 103 visitor->trace(m_clipboard); |
| 104 visitor->trace(m_item); |
| 105 } |
| 99 | 106 |
| 100 } // namespace WebCore | 107 } // namespace WebCore |
| 101 | 108 |
| OLD | NEW |