OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, 2012 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 internalAddFileItem(DataObjectItem::createFromFile(File::createForUserProvid
edFile(filename, displayName))); | 210 internalAddFileItem(DataObjectItem::createFromFile(File::createForUserProvid
edFile(filename, displayName))); |
211 } | 211 } |
212 | 212 |
213 void DataObject::addSharedBuffer(const String& name, PassRefPtr<SharedBuffer> bu
ffer) | 213 void DataObject::addSharedBuffer(const String& name, PassRefPtr<SharedBuffer> bu
ffer) |
214 { | 214 { |
215 internalAddFileItem(DataObjectItem::createFromSharedBuffer(name, buffer)); | 215 internalAddFileItem(DataObjectItem::createFromSharedBuffer(name, buffer)); |
216 } | 216 } |
217 | 217 |
218 DataObject::DataObject() | 218 DataObject::DataObject() |
219 : m_modifiers(0) | 219 : m_modifiers(0) |
| 220 , m_canReadContent(true) |
220 { | 221 { |
221 } | 222 } |
222 | 223 |
223 DataObjectItem* DataObject::findStringItem(const String& type) const | 224 DataObjectItem* DataObject::findStringItem(const String& type) const |
224 { | 225 { |
225 for (size_t i = 0; i < m_itemList.size(); ++i) { | 226 for (size_t i = 0; i < m_itemList.size(); ++i) { |
226 if (m_itemList[i]->kind() == DataObjectItem::StringKind && m_itemList[i]
->type() == type) | 227 if (m_itemList[i]->kind() == DataObjectItem::StringKind && m_itemList[i]
->type() == type) |
227 return m_itemList[i]; | 228 return m_itemList[i]; |
228 } | 229 } |
229 return nullptr; | 230 return nullptr; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 FileMetadata fileMetadata; | 283 FileMetadata fileMetadata; |
283 fileMetadata.length = item.fileSystemFileSize; | 284 fileMetadata.length = item.fileSystemFileSize; |
284 dataObject->add(File::createForFileSystemFile(item.fileSystemURL
, fileMetadata, File::IsNotUserVisible)); | 285 dataObject->add(File::createForFileSystemFile(item.fileSystemURL
, fileMetadata, File::IsNotUserVisible)); |
285 } | 286 } |
286 break; | 287 break; |
287 } | 288 } |
288 } | 289 } |
289 | 290 |
290 if (!data.filesystemId().isNull()) | 291 if (!data.filesystemId().isNull()) |
291 DraggedIsolatedFileSystem::prepareForDataObject(dataObject, data.filesys
temId()); | 292 DraggedIsolatedFileSystem::prepareForDataObject(dataObject, data.filesys
temId()); |
| 293 |
| 294 dataObject->m_canReadContent = data.canReadContent(); |
292 return dataObject; | 295 return dataObject; |
293 } | 296 } |
294 | 297 |
295 WebDragData DataObject::toWebDragData() | 298 WebDragData DataObject::toWebDragData() |
296 { | 299 { |
297 WebDragData data; | 300 WebDragData data; |
298 data.initialize(); | 301 data.initialize(); |
299 WebVector<WebDragData::Item> itemList(length()); | 302 WebVector<WebDragData::Item> itemList(length()); |
300 | 303 |
301 for (size_t i = 0; i < length(); ++i) { | 304 for (size_t i = 0; i < length(); ++i) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 ASSERT_NOT_REACHED(); | 337 ASSERT_NOT_REACHED(); |
335 } | 338 } |
336 } else { | 339 } else { |
337 ASSERT_NOT_REACHED(); | 340 ASSERT_NOT_REACHED(); |
338 } | 341 } |
339 item.title = originalItem->title(); | 342 item.title = originalItem->title(); |
340 item.baseURL = originalItem->baseURL(); | 343 item.baseURL = originalItem->baseURL(); |
341 itemList[i] = item; | 344 itemList[i] = item; |
342 } | 345 } |
343 data.swapItems(itemList); | 346 data.swapItems(itemList); |
| 347 data.setCanReadContent(m_canReadContent); |
344 return data; | 348 return data; |
345 } | 349 } |
346 | 350 |
347 } // namespace blink | 351 } // namespace blink |
OLD | NEW |