| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ASSERT_NOT_REACHED(); | 62 ASSERT_NOT_REACHED(); |
| 63 return String(); | 63 return String(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 String DataTransferItem::type() const { | 66 String DataTransferItem::type() const { |
| 67 if (!m_dataTransfer->canReadTypes()) | 67 if (!m_dataTransfer->canReadTypes()) |
| 68 return String(); | 68 return String(); |
| 69 return m_item->type(); | 69 return m_item->type(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void DataTransferItem::getAsString(ExecutionContext* context, | 72 void DataTransferItem::getAsString(ScriptState* scriptState, |
| 73 StringCallback* callback) const { | 73 StringCallback* callback) const { |
| 74 if (!m_dataTransfer->canReadData()) | 74 if (!m_dataTransfer->canReadData()) |
| 75 return; | 75 return; |
| 76 if (!callback || m_item->kind() != DataObjectItem::StringKind) | 76 if (!callback || m_item->kind() != DataObjectItem::StringKind) |
| 77 return; | 77 return; |
| 78 | 78 |
| 79 context->postTask( | 79 scriptState->getExecutionContext()->postTask( |
| 80 TaskType::UserInteraction, BLINK_FROM_HERE, | 80 TaskType::UserInteraction, BLINK_FROM_HERE, |
| 81 createSameThreadTask(&StringCallback::handleEvent, | 81 createSameThreadTask(&StringCallback::handleEvent, |
| 82 wrapPersistent(callback), m_item->getAsString()), | 82 wrapPersistent(callback), m_item->getAsString()), |
| 83 "DataTransferItem.getAsString"); | 83 "DataTransferItem.getAsString"); |
| 84 } | 84 } |
| 85 | 85 |
| 86 Blob* DataTransferItem::getAsFile() const { | 86 Blob* DataTransferItem::getAsFile() const { |
| 87 if (!m_dataTransfer->canReadData()) | 87 if (!m_dataTransfer->canReadData()) |
| 88 return nullptr; | 88 return nullptr; |
| 89 | 89 |
| 90 return m_item->getAsFile(); | 90 return m_item->getAsFile(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 DataTransferItem::DataTransferItem(DataTransfer* dataTransfer, | 93 DataTransferItem::DataTransferItem(DataTransfer* dataTransfer, |
| 94 DataObjectItem* item) | 94 DataObjectItem* item) |
| 95 : m_dataTransfer(dataTransfer), m_item(item) {} | 95 : m_dataTransfer(dataTransfer), m_item(item) {} |
| 96 | 96 |
| 97 DEFINE_TRACE(DataTransferItem) { | 97 DEFINE_TRACE(DataTransferItem) { |
| 98 visitor->trace(m_dataTransfer); | 98 visitor->trace(m_dataTransfer); |
| 99 visitor->trace(m_item); | 99 visitor->trace(m_item); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace blink | 102 } // namespace blink |
| OLD | NEW |