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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void DataTransferItem::getAsString(ScriptState* scriptState, | 79 void DataTransferItem::getAsString(ScriptState* scriptState, |
80 StringCallback* callback) const { | 80 StringCallback* callback) const { |
81 if (!m_dataTransfer->canReadData()) | 81 if (!m_dataTransfer->canReadData()) |
82 return; | 82 return; |
83 if (!callback || m_item->kind() != DataObjectItem::StringKind) | 83 if (!callback || m_item->kind() != DataObjectItem::StringKind) |
84 return; | 84 return; |
85 | 85 |
86 ExecutionContext* context = scriptState->getExecutionContext(); | 86 ExecutionContext* context = scriptState->getExecutionContext(); |
87 InspectorInstrumentation::asyncTaskScheduled( | 87 InspectorInstrumentation::asyncTaskScheduled( |
88 context, "DataTransferItem.getAsString", callback); | 88 context, "DataTransferItem.getAsString", callback); |
89 TaskRunnerHelper::get(TaskType::UserInteraction, context) | 89 TaskRunnerHelper::get(TaskType::UserInteraction, scriptState) |
90 ->postTask(BLINK_FROM_HERE, | 90 ->postTask(BLINK_FROM_HERE, |
91 WTF::bind(&runGetAsStringTask, wrapWeakPersistent(context), | 91 WTF::bind(&runGetAsStringTask, wrapWeakPersistent(context), |
92 wrapPersistent(callback), m_item->getAsString())); | 92 wrapPersistent(callback), m_item->getAsString())); |
93 } | 93 } |
94 | 94 |
95 File* DataTransferItem::getAsFile() const { | 95 File* DataTransferItem::getAsFile() const { |
96 if (!m_dataTransfer->canReadData()) | 96 if (!m_dataTransfer->canReadData()) |
97 return nullptr; | 97 return nullptr; |
98 | 98 |
99 return m_item->getAsFile(); | 99 return m_item->getAsFile(); |
100 } | 100 } |
101 | 101 |
102 DataTransferItem::DataTransferItem(DataTransfer* dataTransfer, | 102 DataTransferItem::DataTransferItem(DataTransfer* dataTransfer, |
103 DataObjectItem* item) | 103 DataObjectItem* item) |
104 : m_dataTransfer(dataTransfer), m_item(item) {} | 104 : m_dataTransfer(dataTransfer), m_item(item) {} |
105 | 105 |
106 DEFINE_TRACE(DataTransferItem) { | 106 DEFINE_TRACE(DataTransferItem) { |
107 visitor->trace(m_dataTransfer); | 107 visitor->trace(m_dataTransfer); |
108 visitor->trace(m_item); | 108 visitor->trace(m_item); |
109 } | 109 } |
110 | 110 |
111 } // namespace blink | 111 } // namespace blink |
OLD | NEW |