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

Side by Side Diff: third_party/WebKit/Source/web/WebFrameWidgetBase.h

Issue 2485693003: Drag-and-drop: DragEnter, DragOver, DragLeave, DragDrop (Closed)
Patch Set: Rebased. More fixes. Created 4 years, 1 month 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 // 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"
9 #include "public/platform/WebDragData.h"
8 #include "public/web/WebFrameWidget.h" 10 #include "public/web/WebFrameWidget.h"
9 #include "wtf/Assertions.h" 11 #include "wtf/Assertions.h"
10 12
11 namespace blink { 13 namespace blink {
12 14
13 class CompositorAnimationTimeline; 15 class CompositorAnimationTimeline;
14 class CompositorProxyClient; 16 class CompositorProxyClient;
17 class DragController;
15 class GraphicsLayer; 18 class GraphicsLayer;
16 class WebLayer; 19 class WebLayer;
20 class WebLocalFrameImpl;
21 class WebViewImpl;
17 class HitTestResult; 22 class HitTestResult;
18 struct WebPoint; 23 struct WebPoint;
19 24
20 class WebFrameWidgetBase : public WebFrameWidget { 25 class WebFrameWidgetBase : public WebFrameWidget {
21 public: 26 public:
22 virtual bool forSubframe() const = 0; 27 virtual bool forSubframe() const = 0;
23 virtual void scheduleAnimation() = 0; 28 virtual void scheduleAnimation() = 0;
24 virtual CompositorProxyClient* createCompositorProxyClient() = 0; 29 virtual CompositorProxyClient* createCompositorProxyClient() = 0;
25 virtual WebWidgetClient* client() const = 0; 30 virtual WebWidgetClient* client() const = 0;
26 31
27 // Sets the root graphics layer. |GraphicsLayer| can be null when detaching 32 // Sets the root graphics layer. |GraphicsLayer| can be null when detaching
28 // the root layer. 33 // the root layer.
29 virtual void setRootGraphicsLayer(GraphicsLayer*) = 0; 34 virtual void setRootGraphicsLayer(GraphicsLayer*) = 0;
30 35
31 // Sets the root layer. |WebLayer| can be null when detaching the root layer. 36 // Sets the root layer. |WebLayer| can be null when detaching the root layer.
32 virtual void setRootLayer(WebLayer*) = 0; 37 virtual void setRootLayer(WebLayer*) = 0;
33 38
34 // Attaches/detaches a CompositorAnimationTimeline to the layer tree. 39 // Attaches/detaches a CompositorAnimationTimeline to the layer tree.
35 virtual void attachCompositorAnimationTimeline( 40 virtual void attachCompositorAnimationTimeline(
36 CompositorAnimationTimeline*) = 0; 41 CompositorAnimationTimeline*) = 0;
37 virtual void detachCompositorAnimationTimeline( 42 virtual void detachCompositorAnimationTimeline(
38 CompositorAnimationTimeline*) = 0; 43 CompositorAnimationTimeline*) = 0;
39 44
40 virtual HitTestResult coreHitTestResultAt(const WebPoint&) = 0; 45 virtual HitTestResult coreHitTestResultAt(const WebPoint&) = 0;
46
47 // WebFrameWidget implementation.
48 WebDragOperation dragTargetDragEnter(const WebDragData&,
49 const WebPoint& pointInViewport,
50 const WebPoint& screenPoint,
51 WebDragOperationsMask operationsAllowed,
52 int modifiers) override;
53 WebDragOperation dragTargetDragOver(const WebPoint& pointInViewport,
54 const WebPoint& screenPoint,
55 WebDragOperationsMask operationsAllowed,
56 int modifiers) override;
57 void dragTargetDragLeave() override;
58 void dragTargetDrop(const WebDragData&,
59 const WebPoint& pointInViewport,
60 const WebPoint& screenPoint,
61 int modifiers) override;
62
63 protected:
64 enum DragAction { DragEnter, DragOver };
65
66 // Consolidate some common code between starting a drag over a target and
67 // updating a drag over a target. If we're starting a drag, |isEntering|
68 // should be true.
69 WebDragOperation dragTargetDragEnterOrOver(const WebPoint& pointInViewport,
70 const WebPoint& screenPoint,
71 DragAction,
72 int modifiers);
73
74 // Helper function to call VisualViewport::viewportToRootFrame().
75 WebPoint viewportToRootFrame(const WebPoint& pointInViewport) const;
76
77 WebViewImpl* view() const;
78
79 // Returns the page object associated with this widget. This may be null when
80 // the page is shutting down, but will be valid at all other times.
81 Page* page() const;
82
83 // A copy of the web drop data object we received from the browser.
84 Persistent<DataObject> m_currentDragData;
85
86 bool m_doingDragAndDrop = false;
87
88 // The available drag operations (copy, move link...) allowed by the source.
89 WebDragOperation m_operationsAllowed = WebDragOperationNone;
90
91 // The current drag operation as negotiated by the source and destination.
92 // When not equal to DragOperationNone, the drag data can be dropped onto the
93 // current drop target in this WebView (the drop target can accept the drop).
94 WebDragOperation m_dragOperation = WebDragOperationNone;
41 }; 95 };
42 96
43 DEFINE_TYPE_CASTS(WebFrameWidgetBase, WebFrameWidget, widget, true, true); 97 DEFINE_TYPE_CASTS(WebFrameWidgetBase, WebFrameWidget, widget, true, true);
44 98
45 } // namespace blink 99 } // namespace blink
46 100
47 #endif 101 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/BUILD.gn ('k') | third_party/WebKit/Source/web/WebFrameWidgetBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698