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/core/v8/V8Binding.h" | 34 #include "bindings/core/v8/V8Binding.h" |
35 #include "core/clipboard/DataObjectItem.h" | 35 #include "core/clipboard/DataObjectItem.h" |
36 #include "core/clipboard/DataTransfer.h" | 36 #include "core/clipboard/DataTransfer.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 blink { | 40 namespace blink { |
41 | 41 |
42 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DataTransferItem); | 42 DataTransferItem* DataTransferItem::create(DataTransfer* dataTransfer, DataObjec
tItem* item) |
43 | |
44 PassRefPtrWillBeRawPtr<DataTransferItem> DataTransferItem::create(PassRefPtrWill
BeRawPtr<DataTransfer> dataTransfer, PassRefPtrWillBeRawPtr<DataObjectItem> item
) | |
45 { | 43 { |
46 return adoptRefWillBeNoop(new DataTransferItem(dataTransfer, item)); | 44 return new DataTransferItem(dataTransfer, item); |
47 } | 45 } |
48 | 46 |
49 String DataTransferItem::kind() const | 47 String DataTransferItem::kind() const |
50 { | 48 { |
51 DEFINE_STATIC_LOCAL(const String, kindString, ("string")); | 49 DEFINE_STATIC_LOCAL(const String, kindString, ("string")); |
52 DEFINE_STATIC_LOCAL(const String, kindFile, ("file")); | 50 DEFINE_STATIC_LOCAL(const String, kindFile, ("file")); |
53 if (!m_dataTransfer->canReadTypes()) | 51 if (!m_dataTransfer->canReadTypes()) |
54 return String(); | 52 return String(); |
55 switch (m_item->kind()) { | 53 switch (m_item->kind()) { |
56 case DataObjectItem::StringKind: | 54 case DataObjectItem::StringKind: |
(...skipping 23 matching lines...) Expand all Loading... |
80 } | 78 } |
81 | 79 |
82 Blob* DataTransferItem::getAsFile() const | 80 Blob* DataTransferItem::getAsFile() const |
83 { | 81 { |
84 if (!m_dataTransfer->canReadData()) | 82 if (!m_dataTransfer->canReadData()) |
85 return nullptr; | 83 return nullptr; |
86 | 84 |
87 return m_item->getAsFile(); | 85 return m_item->getAsFile(); |
88 } | 86 } |
89 | 87 |
90 DataTransferItem::DataTransferItem(PassRefPtrWillBeRawPtr<DataTransfer> dataTran
sfer, PassRefPtrWillBeRawPtr<DataObjectItem> item) | 88 DataTransferItem::DataTransferItem(DataTransfer* dataTransfer, DataObjectItem* i
tem) |
91 : m_dataTransfer(dataTransfer) | 89 : m_dataTransfer(dataTransfer) |
92 , m_item(item) | 90 , m_item(item) |
93 { | 91 { |
94 } | 92 } |
95 | 93 |
96 DEFINE_TRACE(DataTransferItem) | 94 DEFINE_TRACE(DataTransferItem) |
97 { | 95 { |
98 visitor->trace(m_dataTransfer); | 96 visitor->trace(m_dataTransfer); |
99 visitor->trace(m_item); | 97 visitor->trace(m_item); |
100 } | 98 } |
101 | 99 |
102 } // namespace blink | 100 } // namespace blink |
103 | |
OLD | NEW |