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

Side by Side Diff: third_party/WebKit/Source/core/page/DragController.cpp

Issue 2572023002: Remove special DataTransfer permissions for file: origins. (Closed)
Patch Set: jsbell feedback, round 2. Created 4 years 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dnd/resources/dragged-file.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Google Inc. 3 * Copyright (C) 2008 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 m_dragInitiator = nullptr; 206 m_dragInitiator = nullptr;
207 m_didInitiateDrag = false; 207 m_didInitiateDrag = false;
208 m_page->dragCaretController().clear(); 208 m_page->dragCaretController().clear();
209 } 209 }
210 210
211 void DragController::dragExited(DragData* dragData, LocalFrame& localRoot) { 211 void DragController::dragExited(DragData* dragData, LocalFrame& localRoot) {
212 DCHECK(dragData); 212 DCHECK(dragData);
213 213
214 FrameView* frameView(localRoot.view()); 214 FrameView* frameView(localRoot.view());
215 if (frameView) { 215 if (frameView) {
216 DataTransferAccessPolicy policy = 216 DataTransferAccessPolicy policy = DataTransferTypesReadable;
217 (!m_documentUnderMouse ||
218 m_documentUnderMouse->getSecurityOrigin()->isLocal())
219 ? DataTransferReadable
220 : DataTransferTypesReadable;
221 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData); 217 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData);
222 dataTransfer->setSourceOperation(dragData->draggingSourceOperationMask()); 218 dataTransfer->setSourceOperation(dragData->draggingSourceOperationMask());
223 localRoot.eventHandler().cancelDragAndDrop(createMouseEvent(dragData), 219 localRoot.eventHandler().cancelDragAndDrop(createMouseEvent(dragData),
224 dataTransfer); 220 dataTransfer);
225 dataTransfer->setAccessPolicy( 221 dataTransfer->setAccessPolicy(
226 DataTransferNumb); // invalidate clipboard here for security 222 DataTransferNumb); // invalidate clipboard here for security
227 } 223 }
228 mouseMovedIntoDocument(nullptr); 224 mouseMovedIntoDocument(nullptr);
229 if (m_fileInputElementUnderMouse) 225 if (m_fileInputElementUnderMouse)
230 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); 226 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false);
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 } 707 }
712 708
713 bool DragController::tryDHTMLDrag(DragData* dragData, 709 bool DragController::tryDHTMLDrag(DragData* dragData,
714 DragOperation& operation, 710 DragOperation& operation,
715 LocalFrame& localRoot) { 711 LocalFrame& localRoot) {
716 DCHECK(dragData); 712 DCHECK(dragData);
717 DCHECK(m_documentUnderMouse); 713 DCHECK(m_documentUnderMouse);
718 if (!localRoot.view()) 714 if (!localRoot.view())
719 return false; 715 return false;
720 716
721 DataTransferAccessPolicy policy = 717 DataTransferAccessPolicy policy = DataTransferTypesReadable;
722 m_documentUnderMouse->getSecurityOrigin()->isLocal()
723 ? DataTransferReadable
724 : DataTransferTypesReadable;
725 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData); 718 DataTransfer* dataTransfer = createDraggingDataTransfer(policy, dragData);
726 DragOperation srcOpMask = dragData->draggingSourceOperationMask(); 719 DragOperation srcOpMask = dragData->draggingSourceOperationMask();
727 dataTransfer->setSourceOperation(srcOpMask); 720 dataTransfer->setSourceOperation(srcOpMask);
728 721
729 PlatformMouseEvent event = createMouseEvent(dragData); 722 PlatformMouseEvent event = createMouseEvent(dragData);
730 if (localRoot.eventHandler().updateDragAndDrop(event, dataTransfer) == 723 if (localRoot.eventHandler().updateDragAndDrop(event, dataTransfer) ==
731 WebInputEventResult::NotHandled) { 724 WebInputEventResult::NotHandled) {
732 dataTransfer->setAccessPolicy( 725 dataTransfer->setAccessPolicy(
733 DataTransferNumb); // invalidate clipboard here for security 726 DataTransferNumb); // invalidate clipboard here for security
734 return false; 727 return false;
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 } 1224 }
1232 1225
1233 DEFINE_TRACE(DragController) { 1226 DEFINE_TRACE(DragController) {
1234 visitor->trace(m_page); 1227 visitor->trace(m_page);
1235 visitor->trace(m_documentUnderMouse); 1228 visitor->trace(m_documentUnderMouse);
1236 visitor->trace(m_dragInitiator); 1229 visitor->trace(m_dragInitiator);
1237 visitor->trace(m_fileInputElementUnderMouse); 1230 visitor->trace(m_fileInputElementUnderMouse);
1238 } 1231 }
1239 1232
1240 } // namespace blink 1233 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dnd/resources/dragged-file.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698