| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef WebFrameWidgetBase_h | |
| 6 #define WebFrameWidgetBase_h | |
| 7 | |
| 8 #include "core/clipboard/DataObject.h" | |
| 9 #include "platform/UserGestureIndicator.h" | |
| 10 #include "platform/wtf/Assertions.h" | |
| 11 #include "public/platform/WebDragData.h" | |
| 12 #include "public/web/WebFrameWidget.h" | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 class AnimationWorkletProxyClient; | |
| 17 class CompositorAnimationHost; | |
| 18 class CompositorWorkerProxyClient; | |
| 19 class GraphicsLayer; | |
| 20 class WebImage; | |
| 21 class WebLayer; | |
| 22 class WebLayerTreeView; | |
| 23 class WebViewBase; | |
| 24 class HitTestResult; | |
| 25 struct WebPoint; | |
| 26 | |
| 27 class WebFrameWidgetBase : public WebFrameWidget { | |
| 28 public: | |
| 29 virtual bool ForSubframe() const = 0; | |
| 30 virtual void ScheduleAnimation() = 0; | |
| 31 virtual CompositorWorkerProxyClient* CreateCompositorWorkerProxyClient() = 0; | |
| 32 virtual AnimationWorkletProxyClient* CreateAnimationWorkletProxyClient() = 0; | |
| 33 virtual WebWidgetClient* Client() const = 0; | |
| 34 | |
| 35 // Sets the root graphics layer. |GraphicsLayer| can be null when detaching | |
| 36 // the root layer. | |
| 37 virtual void SetRootGraphicsLayer(GraphicsLayer*) = 0; | |
| 38 | |
| 39 // Sets the root layer. |WebLayer| can be null when detaching the root layer. | |
| 40 virtual void SetRootLayer(WebLayer*) = 0; | |
| 41 | |
| 42 virtual WebLayerTreeView* GetLayerTreeView() const = 0; | |
| 43 virtual CompositorAnimationHost* AnimationHost() const = 0; | |
| 44 | |
| 45 virtual HitTestResult CoreHitTestResultAt(const WebPoint&) = 0; | |
| 46 | |
| 47 // WebFrameWidget implementation. | |
| 48 WebDragOperation DragTargetDragEnter(const WebDragData&, | |
| 49 const WebPoint& point_in_viewport, | |
| 50 const WebPoint& screen_point, | |
| 51 WebDragOperationsMask operations_allowed, | |
| 52 int modifiers) override; | |
| 53 WebDragOperation DragTargetDragOver(const WebPoint& point_in_viewport, | |
| 54 const WebPoint& screen_point, | |
| 55 WebDragOperationsMask operations_allowed, | |
| 56 int modifiers) override; | |
| 57 void DragTargetDragLeave(const WebPoint& point_in_viewport, | |
| 58 const WebPoint& screen_point) override; | |
| 59 void DragTargetDrop(const WebDragData&, | |
| 60 const WebPoint& point_in_viewport, | |
| 61 const WebPoint& screen_point, | |
| 62 int modifiers) override; | |
| 63 void DragSourceEndedAt(const WebPoint& point_in_viewport, | |
| 64 const WebPoint& screen_point, | |
| 65 WebDragOperation) override; | |
| 66 void DragSourceSystemDragEnded() override; | |
| 67 | |
| 68 // Called when a drag-n-drop operation should begin. | |
| 69 void StartDragging(WebReferrerPolicy, | |
| 70 const WebDragData&, | |
| 71 WebDragOperationsMask, | |
| 72 const WebImage& drag_image, | |
| 73 const WebPoint& drag_image_offset); | |
| 74 | |
| 75 bool DoingDragAndDrop() { return doing_drag_and_drop_; } | |
| 76 static void SetIgnoreInputEvents(bool value) { ignore_input_events_ = value; } | |
| 77 static bool IgnoreInputEvents() { return ignore_input_events_; } | |
| 78 | |
| 79 // WebWidget methods. | |
| 80 void DidAcquirePointerLock() override; | |
| 81 void DidNotAcquirePointerLock() override; | |
| 82 void DidLosePointerLock() override; | |
| 83 | |
| 84 protected: | |
| 85 enum DragAction { kDragEnter, kDragOver }; | |
| 86 | |
| 87 // Consolidate some common code between starting a drag over a target and | |
| 88 // updating a drag over a target. If we're starting a drag, |isEntering| | |
| 89 // should be true. | |
| 90 WebDragOperation DragTargetDragEnterOrOver(const WebPoint& point_in_viewport, | |
| 91 const WebPoint& screen_point, | |
| 92 DragAction, | |
| 93 int modifiers); | |
| 94 | |
| 95 // Helper function to call VisualViewport::viewportToRootFrame(). | |
| 96 WebPoint ViewportToRootFrame(const WebPoint& point_in_viewport) const; | |
| 97 | |
| 98 WebViewBase* View() const; | |
| 99 | |
| 100 // Returns the page object associated with this widget. This may be null when | |
| 101 // the page is shutting down, but will be valid at all other times. | |
| 102 Page* GetPage() const; | |
| 103 | |
| 104 // A copy of the web drop data object we received from the browser. | |
| 105 Persistent<DataObject> current_drag_data_; | |
| 106 | |
| 107 bool doing_drag_and_drop_ = false; | |
| 108 | |
| 109 // The available drag operations (copy, move link...) allowed by the source. | |
| 110 WebDragOperation operations_allowed_ = kWebDragOperationNone; | |
| 111 | |
| 112 // The current drag operation as negotiated by the source and destination. | |
| 113 // When not equal to DragOperationNone, the drag data can be dropped onto the | |
| 114 // current drop target in this WebView (the drop target can accept the drop). | |
| 115 WebDragOperation drag_operation_ = kWebDragOperationNone; | |
| 116 | |
| 117 // Helper function to process events while pointer locked. | |
| 118 void PointerLockMouseEvent(const WebInputEvent&); | |
| 119 | |
| 120 private: | |
| 121 void CancelDrag(); | |
| 122 | |
| 123 static bool ignore_input_events_; | |
| 124 RefPtr<UserGestureToken> pointer_lock_gesture_token_; | |
| 125 | |
| 126 friend class WebViewImpl; | |
| 127 }; | |
| 128 | |
| 129 DEFINE_TYPE_CASTS(WebFrameWidgetBase, WebFrameWidget, widget, true, true); | |
| 130 | |
| 131 } // namespace blink | |
| 132 | |
| 133 #endif | |
| OLD | NEW |