| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebFrameWidgetBase_h | 5 #ifndef WebFrameWidgetBase_h |
| 6 #define WebFrameWidgetBase_h | 6 #define WebFrameWidgetBase_h |
| 7 | 7 |
| 8 #include "core/clipboard/DataObject.h" | 8 #include "core/clipboard/DataObject.h" |
| 9 #include "public/platform/WebDragData.h" | 9 #include "public/platform/WebDragData.h" |
| 10 #include "public/web/WebFrameWidget.h" | 10 #include "public/web/WebFrameWidget.h" |
| 11 #include "wtf/Assertions.h" | 11 #include "wtf/Assertions.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 class CompositorAnimationTimeline; | 15 class CompositorAnimationTimeline; |
| 16 class CompositorProxyClient; | 16 class CompositorProxyClient; |
| 17 class DragController; | 17 class DragController; |
| 18 class GraphicsLayer; | 18 class GraphicsLayer; |
| 19 class WebImage; |
| 19 class WebLayer; | 20 class WebLayer; |
| 20 class WebLocalFrameImpl; | 21 class WebLocalFrameImpl; |
| 21 class WebViewImpl; | 22 class WebViewImpl; |
| 22 class HitTestResult; | 23 class HitTestResult; |
| 23 struct WebPoint; | 24 struct WebPoint; |
| 24 | 25 |
| 25 class WebFrameWidgetBase : public WebFrameWidget { | 26 class WebFrameWidgetBase : public WebFrameWidget { |
| 26 public: | 27 public: |
| 27 virtual bool forSubframe() const = 0; | 28 virtual bool forSubframe() const = 0; |
| 28 virtual void scheduleAnimation() = 0; | 29 virtual void scheduleAnimation() = 0; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 57 void dragTargetDragLeave() override; | 58 void dragTargetDragLeave() override; |
| 58 void dragTargetDrop(const WebDragData&, | 59 void dragTargetDrop(const WebDragData&, |
| 59 const WebPoint& pointInViewport, | 60 const WebPoint& pointInViewport, |
| 60 const WebPoint& screenPoint, | 61 const WebPoint& screenPoint, |
| 61 int modifiers) override; | 62 int modifiers) override; |
| 62 void dragSourceEndedAt(const WebPoint& pointInViewport, | 63 void dragSourceEndedAt(const WebPoint& pointInViewport, |
| 63 const WebPoint& screenPoint, | 64 const WebPoint& screenPoint, |
| 64 WebDragOperation) override; | 65 WebDragOperation) override; |
| 65 void dragSourceSystemDragEnded() override; | 66 void dragSourceSystemDragEnded() override; |
| 66 | 67 |
| 68 // Called when a drag-n-drop operation should begin. |
| 69 void startDragging(WebReferrerPolicy, |
| 70 const WebDragData&, |
| 71 WebDragOperationsMask, |
| 72 const WebImage& dragImage, |
| 73 const WebPoint& dragImageOffset); |
| 74 |
| 75 bool doingDragAndDrop() { return m_doingDragAndDrop; } |
| 76 |
| 67 protected: | 77 protected: |
| 68 enum DragAction { DragEnter, DragOver }; | 78 enum DragAction { DragEnter, DragOver }; |
| 69 | 79 |
| 70 // Consolidate some common code between starting a drag over a target and | 80 // Consolidate some common code between starting a drag over a target and |
| 71 // updating a drag over a target. If we're starting a drag, |isEntering| | 81 // updating a drag over a target. If we're starting a drag, |isEntering| |
| 72 // should be true. | 82 // should be true. |
| 73 WebDragOperation dragTargetDragEnterOrOver(const WebPoint& pointInViewport, | 83 WebDragOperation dragTargetDragEnterOrOver(const WebPoint& pointInViewport, |
| 74 const WebPoint& screenPoint, | 84 const WebPoint& screenPoint, |
| 75 DragAction, | 85 DragAction, |
| 76 int modifiers); | 86 int modifiers); |
| 77 | 87 |
| 78 // Helper function to call VisualViewport::viewportToRootFrame(). | 88 // Helper function to call VisualViewport::viewportToRootFrame(). |
| 79 WebPoint viewportToRootFrame(const WebPoint& pointInViewport) const; | 89 WebPoint viewportToRootFrame(const WebPoint& pointInViewport) const; |
| 80 | 90 |
| 91 // Returns the local root as a LocalFrame*. |
| 92 LocalFrame* localFrameRoot() const; |
| 93 |
| 81 WebViewImpl* view() const; | 94 WebViewImpl* view() const; |
| 82 | 95 |
| 83 // Returns the page object associated with this widget. This may be null when | 96 // Returns the page object associated with this widget. This may be null when |
| 84 // the page is shutting down, but will be valid at all other times. | 97 // the page is shutting down, but will be valid at all other times. |
| 85 Page* page() const; | 98 Page* page() const; |
| 86 | 99 |
| 87 // A copy of the web drop data object we received from the browser. | 100 // A copy of the web drop data object we received from the browser. |
| 88 Persistent<DataObject> m_currentDragData; | 101 Persistent<DataObject> m_currentDragData; |
| 89 | 102 |
| 90 bool m_doingDragAndDrop = false; | 103 bool m_doingDragAndDrop = false; |
| 91 | 104 |
| 92 // The available drag operations (copy, move link...) allowed by the source. | 105 // The available drag operations (copy, move link...) allowed by the source. |
| 93 WebDragOperation m_operationsAllowed = WebDragOperationNone; | 106 WebDragOperation m_operationsAllowed = WebDragOperationNone; |
| 94 | 107 |
| 95 // The current drag operation as negotiated by the source and destination. | 108 // The current drag operation as negotiated by the source and destination. |
| 96 // When not equal to DragOperationNone, the drag data can be dropped onto the | 109 // When not equal to DragOperationNone, the drag data can be dropped onto the |
| 97 // current drop target in this WebView (the drop target can accept the drop). | 110 // current drop target in this WebView (the drop target can accept the drop). |
| 98 WebDragOperation m_dragOperation = WebDragOperationNone; | 111 WebDragOperation m_dragOperation = WebDragOperationNone; |
| 99 }; | 112 }; |
| 100 | 113 |
| 101 DEFINE_TYPE_CASTS(WebFrameWidgetBase, WebFrameWidget, widget, true, true); | 114 DEFINE_TYPE_CASTS(WebFrameWidgetBase, WebFrameWidget, widget, true, true); |
| 102 | 115 |
| 103 } // namespace blink | 116 } // namespace blink |
| 104 | 117 |
| 105 #endif | 118 #endif |
| OLD | NEW |