Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: third_party/WebKit/Source/core/clipboard/DataObject.cpp

Issue 1723763002: Add WebDragData to blink::WebView::dragtargetDrop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 internalAddFileItem(DataObjectItem::createFromFile(File::createForUserProvid edFile(filename, displayName))); 219 internalAddFileItem(DataObjectItem::createFromFile(File::createForUserProvid edFile(filename, displayName)));
220 } 220 }
221 221
222 void DataObject::addSharedBuffer(const String& name, PassRefPtr<SharedBuffer> bu ffer) 222 void DataObject::addSharedBuffer(const String& name, PassRefPtr<SharedBuffer> bu ffer)
223 { 223 {
224 internalAddFileItem(DataObjectItem::createFromSharedBuffer(name, buffer)); 224 internalAddFileItem(DataObjectItem::createFromSharedBuffer(name, buffer));
225 } 225 }
226 226
227 DataObject::DataObject() 227 DataObject::DataObject()
228 : m_modifiers(0) 228 : m_modifiers(0)
229 , m_canReadContent(true)
229 { 230 {
230 } 231 }
231 232
232 DataObjectItem* DataObject::findStringItem(const String& type) const 233 DataObjectItem* DataObject::findStringItem(const String& type) const
233 { 234 {
234 for (size_t i = 0; i < m_itemList.size(); ++i) { 235 for (size_t i = 0; i < m_itemList.size(); ++i) {
235 if (m_itemList[i]->kind() == DataObjectItem::StringKind && m_itemList[i] ->type() == type) 236 if (m_itemList[i]->kind() == DataObjectItem::StringKind && m_itemList[i] ->type() == type)
236 return m_itemList[i]; 237 return m_itemList[i];
237 } 238 }
238 return nullptr; 239 return nullptr;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 FileMetadata fileMetadata; 292 FileMetadata fileMetadata;
292 fileMetadata.length = item.fileSystemFileSize; 293 fileMetadata.length = item.fileSystemFileSize;
293 dataObject->add(File::createForFileSystemFile(item.fileSystemURL , fileMetadata, File::IsNotUserVisible)); 294 dataObject->add(File::createForFileSystemFile(item.fileSystemURL , fileMetadata, File::IsNotUserVisible));
294 } 295 }
295 break; 296 break;
296 } 297 }
297 } 298 }
298 299
299 if (!data.filesystemId().isNull()) 300 if (!data.filesystemId().isNull())
300 DraggedIsolatedFileSystem::prepareForDataObject(dataObject, data.filesys temId()); 301 DraggedIsolatedFileSystem::prepareForDataObject(dataObject, data.filesys temId());
302
303 dataObject->m_canReadContent = data.canReadContent();
301 return dataObject; 304 return dataObject;
302 } 305 }
303 306
304 WebDragData DataObject::toWebDragData() 307 WebDragData DataObject::toWebDragData()
305 { 308 {
306 WebDragData data; 309 WebDragData data;
307 data.initialize(); 310 data.initialize();
308 WebVector<WebDragData::Item> itemList(length()); 311 WebVector<WebDragData::Item> itemList(length());
309 312
310 for (size_t i = 0; i < length(); ++i) { 313 for (size_t i = 0; i < length(); ++i) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 ASSERT_NOT_REACHED(); 346 ASSERT_NOT_REACHED();
344 } 347 }
345 } else { 348 } else {
346 ASSERT_NOT_REACHED(); 349 ASSERT_NOT_REACHED();
347 } 350 }
348 item.title = originalItem->title(); 351 item.title = originalItem->title();
349 item.baseURL = originalItem->baseURL(); 352 item.baseURL = originalItem->baseURL();
350 itemList[i] = item; 353 itemList[i] = item;
351 } 354 }
352 data.swapItems(itemList); 355 data.swapItems(itemList);
356 data.setCanReadContent(m_canReadContent);
353 return data; 357 return data;
354 } 358 }
355 359
356 } // namespace blink 360 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698