Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 DragSession DragController::dragEntered(DragData* dragData) | 209 DragSession DragController::dragEntered(DragData* dragData) |
| 210 { | 210 { |
| 211 return dragEnteredOrUpdated(dragData); | 211 return dragEnteredOrUpdated(dragData); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void DragController::dragExited(DragData* dragData) | 214 void DragController::dragExited(DragData* dragData) |
| 215 { | 215 { |
| 216 ASSERT(dragData); | 216 ASSERT(dragData); |
| 217 LocalFrame* mainFrame = m_page->deprecatedLocalMainFrame(); | 217 LocalFrame* mainFrame = m_page->deprecatedLocalMainFrame(); |
| 218 | 218 |
| 219 if (RefPtr<FrameView> v = mainFrame->view()) { | 219 if (RefPtrWillBeRawPtr<FrameView> v ALLOW_UNUSED = mainFrame->view()) { |
|
haraken
2014/09/29 14:16:36
How about writing like this?
RefPtrWillBeRawPtr<F
sof
2014/10/02 14:03:54
Sure, that will work - I just didn't want to accid
| |
| 220 DataTransferAccessPolicy policy = (!m_documentUnderMouse || m_documentUn derMouse->securityOrigin()->isLocal()) ? DataTransferReadable : DataTransferType sReadable; | 220 DataTransferAccessPolicy policy = (!m_documentUnderMouse || m_documentUn derMouse->securityOrigin()->isLocal()) ? DataTransferReadable : DataTransferType sReadable; |
| 221 RefPtrWillBeRawPtr<DataTransfer> dataTransfer = createDraggingDataTransf er(policy, dragData); | 221 RefPtrWillBeRawPtr<DataTransfer> dataTransfer = createDraggingDataTransf er(policy, dragData); |
| 222 dataTransfer->setSourceOperation(dragData->draggingSourceOperationMask() ); | 222 dataTransfer->setSourceOperation(dragData->draggingSourceOperationMask() ); |
| 223 mainFrame->eventHandler().cancelDragAndDrop(createMouseEvent(dragData), dataTransfer.get()); | 223 mainFrame->eventHandler().cancelDragAndDrop(createMouseEvent(dragData), dataTransfer.get()); |
| 224 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard here for security | 224 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard here for security |
| 225 } | 225 } |
| 226 mouseMovedIntoDocument(0); | 226 mouseMovedIntoDocument(0); |
| 227 if (m_fileInputElementUnderMouse) | 227 if (m_fileInputElementUnderMouse) |
| 228 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); | 228 m_fileInputElementUnderMouse->setCanReceiveDroppedFiles(false); |
| 229 m_fileInputElementUnderMouse = nullptr; | 229 m_fileInputElementUnderMouse = nullptr; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 // tryDHTMLDrag fires dragenter event. The event listener that listens | 346 // tryDHTMLDrag fires dragenter event. The event listener that listens |
| 347 // to this event may create a nested message loop (open a modal dialog), | 347 // to this event may create a nested message loop (open a modal dialog), |
| 348 // which could process dragleave event and reset m_documentUnderMouse in | 348 // which could process dragleave event and reset m_documentUnderMouse in |
| 349 // dragExited. | 349 // dragExited. |
| 350 if (!m_documentUnderMouse) | 350 if (!m_documentUnderMouse) |
| 351 return false; | 351 return false; |
| 352 } | 352 } |
| 353 | 353 |
| 354 // It's unclear why this check is after tryDHTMLDrag. | 354 // It's unclear why this check is after tryDHTMLDrag. |
| 355 // We send drag events in tryDHTMLDrag and that may be the reason. | 355 // We send drag events in tryDHTMLDrag and that may be the reason. |
| 356 RefPtr<FrameView> frameView = m_documentUnderMouse->view(); | 356 RefPtrWillBeRawPtr<FrameView> frameView = m_documentUnderMouse->view(); |
| 357 if (!frameView) | 357 if (!frameView) |
| 358 return false; | 358 return false; |
| 359 | 359 |
| 360 if (isHandlingDrag) { | 360 if (isHandlingDrag) { |
| 361 m_page->dragCaretController().clear(); | 361 m_page->dragCaretController().clear(); |
| 362 return true; | 362 return true; |
| 363 } | 363 } |
| 364 | 364 |
| 365 if ((actionMask & DragDestinationActionEdit) && canProcessDrag(dragData)) { | 365 if ((actionMask & DragDestinationActionEdit) && canProcessDrag(dragData)) { |
| 366 IntPoint point = frameView->windowToContents(dragData->clientPosition()) ; | 366 IntPoint point = frameView->windowToContents(dragData->clientPosition()) ; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 } | 587 } |
| 588 | 588 |
| 589 bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) | 589 bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) |
| 590 { | 590 { |
| 591 ASSERT(dragData); | 591 ASSERT(dragData); |
| 592 ASSERT(m_documentUnderMouse); | 592 ASSERT(m_documentUnderMouse); |
| 593 RefPtrWillBeRawPtr<LocalFrame> mainFrame = m_page->deprecatedLocalMainFrame( ); | 593 RefPtrWillBeRawPtr<LocalFrame> mainFrame = m_page->deprecatedLocalMainFrame( ); |
| 594 if (!mainFrame->view()) | 594 if (!mainFrame->view()) |
| 595 return false; | 595 return false; |
| 596 | 596 |
| 597 RefPtr<FrameView> viewProtector(mainFrame->view()); | 597 RefPtrWillBeRawPtr<FrameView> viewProtector(mainFrame->view()); |
| 598 DataTransferAccessPolicy policy = m_documentUnderMouse->securityOrigin()->is Local() ? DataTransferReadable : DataTransferTypesReadable; | 598 DataTransferAccessPolicy policy = m_documentUnderMouse->securityOrigin()->is Local() ? DataTransferReadable : DataTransferTypesReadable; |
| 599 RefPtrWillBeRawPtr<DataTransfer> dataTransfer = createDraggingDataTransfer(p olicy, dragData); | 599 RefPtrWillBeRawPtr<DataTransfer> dataTransfer = createDraggingDataTransfer(p olicy, dragData); |
| 600 DragOperation srcOpMask = dragData->draggingSourceOperationMask(); | 600 DragOperation srcOpMask = dragData->draggingSourceOperationMask(); |
| 601 dataTransfer->setSourceOperation(srcOpMask); | 601 dataTransfer->setSourceOperation(srcOpMask); |
| 602 | 602 |
| 603 PlatformMouseEvent event = createMouseEvent(dragData); | 603 PlatformMouseEvent event = createMouseEvent(dragData); |
| 604 if (!mainFrame->eventHandler().updateDragAndDrop(event, dataTransfer.get())) { | 604 if (!mainFrame->eventHandler().updateDragAndDrop(event, dataTransfer.get())) { |
| 605 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard here for security | 605 dataTransfer->setAccessPolicy(DataTransferNumb); // invalidate clipboard here for security |
| 606 return false; | 606 return false; |
| 607 } | 607 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 | 922 |
| 923 return true; | 923 return true; |
| 924 } | 924 } |
| 925 | 925 |
| 926 void DragController::doSystemDrag(DragImage* image, const IntPoint& dragLocation , const IntPoint& eventPos, DataTransfer* dataTransfer, LocalFrame* frame, bool forLink) | 926 void DragController::doSystemDrag(DragImage* image, const IntPoint& dragLocation , const IntPoint& eventPos, DataTransfer* dataTransfer, LocalFrame* frame, bool forLink) |
| 927 { | 927 { |
| 928 m_didInitiateDrag = true; | 928 m_didInitiateDrag = true; |
| 929 m_dragInitiator = frame->document(); | 929 m_dragInitiator = frame->document(); |
| 930 // Protect this frame and view, as a load may occur mid drag and attempt to unload this frame | 930 // Protect this frame and view, as a load may occur mid drag and attempt to unload this frame |
| 931 RefPtrWillBeRawPtr<LocalFrame> mainFrame = m_page->deprecatedLocalMainFrame( ); | 931 RefPtrWillBeRawPtr<LocalFrame> mainFrame = m_page->deprecatedLocalMainFrame( ); |
| 932 RefPtr<FrameView> mainFrameView = mainFrame->view(); | 932 RefPtrWillBeRawPtr<FrameView> mainFrameView = mainFrame->view(); |
| 933 | 933 |
| 934 m_client->startDrag(image, mainFrameView->rootViewToContents(frame->view()-> contentsToRootView(dragLocation)), | 934 m_client->startDrag(image, mainFrameView->rootViewToContents(frame->view()-> contentsToRootView(dragLocation)), |
| 935 mainFrameView->rootViewToContents(frame->view()->contentsToRootView(even tPos)), dataTransfer, frame, forLink); | 935 mainFrameView->rootViewToContents(frame->view()->contentsToRootView(even tPos)), dataTransfer, frame, forLink); |
| 936 // DragClient::startDrag can cause our Page to dispear, deallocating |this|. | 936 // DragClient::startDrag can cause our Page to dispear, deallocating |this|. |
| 937 if (!frame->page()) | 937 if (!frame->page()) |
| 938 return; | 938 return; |
| 939 | 939 |
| 940 cleanupAfterSystemDrag(); | 940 cleanupAfterSystemDrag(); |
| 941 } | 941 } |
| 942 | 942 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 967 | 967 |
| 968 void DragController::trace(Visitor* visitor) | 968 void DragController::trace(Visitor* visitor) |
| 969 { | 969 { |
| 970 visitor->trace(m_page); | 970 visitor->trace(m_page); |
| 971 visitor->trace(m_documentUnderMouse); | 971 visitor->trace(m_documentUnderMouse); |
| 972 visitor->trace(m_dragInitiator); | 972 visitor->trace(m_dragInitiator); |
| 973 visitor->trace(m_fileInputElementUnderMouse); | 973 visitor->trace(m_fileInputElementUnderMouse); |
| 974 } | 974 } |
| 975 | 975 |
| 976 } // namespace blink | 976 } // namespace blink |
| OLD | NEW |