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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.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 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 : WTF_NON_EXPORTED_BASE(public WebView), 100 : WTF_NON_EXPORTED_BASE(public WebView),
101 public RefCounted<WebViewImpl>, 101 public RefCounted<WebViewImpl>,
102 WTF_NON_EXPORTED_BASE(public WebGestureCurveTarget), 102 WTF_NON_EXPORTED_BASE(public WebGestureCurveTarget),
103 public PageWidgetEventHandler, 103 public PageWidgetEventHandler,
104 public WebScheduler::InterventionReporter, 104 public WebScheduler::InterventionReporter,
105 public WebViewScheduler::WebViewSchedulerSettings { 105 public WebViewScheduler::WebViewSchedulerSettings {
106 public: 106 public:
107 static WebViewImpl* create(WebViewClient*, WebPageVisibilityState); 107 static WebViewImpl* create(WebViewClient*, WebPageVisibilityState);
108 static HashSet<WebViewImpl*>& allInstances(); 108 static HashSet<WebViewImpl*>& allInstances();
109 109
110 class UserGestureNotifier {
111 public:
112 // If a UserGestureIndicator is created for a user gesture since the last
113 // page load and the WebViewImpl's |m_userGestureObserved| is false, the
114 // UserGestureNotifier will notify the client and set
115 // |m_userGestureObserved| to true.
116 UserGestureNotifier(WebViewImpl*);
117 ~UserGestureNotifier();
118
119 private:
120 Persistent<WebLocalFrameImpl> m_frame;
121 bool* const m_userGestureObserved;
122 };
123
110 // WebWidget methods: 124 // WebWidget methods:
111 void close() override; 125 void close() override;
112 WebSize size() override; 126 WebSize size() override;
113 void resize(const WebSize&) override; 127 void resize(const WebSize&) override;
114 void resizeVisualViewport(const WebSize&) override; 128 void resizeVisualViewport(const WebSize&) override;
115 void didEnterFullscreen() override; 129 void didEnterFullscreen() override;
116 void didExitFullscreen() override; 130 void didExitFullscreen() override;
117 131
118 void beginFrame(double lastFrameTimeMonotonic) override; 132 void beginFrame(double lastFrameTimeMonotonic) override;
119 133
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 const WebPoint& location) override; 236 const WebPoint& location) override;
223 void performPluginAction(const WebPluginAction&, const WebPoint&) override; 237 void performPluginAction(const WebPluginAction&, const WebPoint&) override;
224 void audioStateChanged(bool isAudioPlaying) override; 238 void audioStateChanged(bool isAudioPlaying) override;
225 WebHitTestResult hitTestResultAt(const WebPoint&) override; 239 WebHitTestResult hitTestResultAt(const WebPoint&) override;
226 WebHitTestResult hitTestResultForTap(const WebPoint&, 240 WebHitTestResult hitTestResultForTap(const WebPoint&,
227 const WebSize&) override; 241 const WebSize&) override;
228 void dragSourceEndedAt(const WebPoint& pointInViewport, 242 void dragSourceEndedAt(const WebPoint& pointInViewport,
229 const WebPoint& screenPoint, 243 const WebPoint& screenPoint,
230 WebDragOperation) override; 244 WebDragOperation) override;
231 void dragSourceSystemDragEnded() override; 245 void dragSourceSystemDragEnded() override;
232 WebDragOperation dragTargetDragEnter(const WebDragData&,
233 const WebPoint& pointInViewport,
234 const WebPoint& screenPoint,
235 WebDragOperationsMask operationsAllowed,
236 int modifiers) override;
237 WebDragOperation dragTargetDragOver(const WebPoint& pointInViewport,
238 const WebPoint& screenPoint,
239 WebDragOperationsMask operationsAllowed,
240 int modifiers) override;
241 void dragTargetDragLeave() override;
242 void dragTargetDrop(const WebDragData&,
243 const WebPoint& pointInViewport,
244 const WebPoint& screenPoint,
245 int modifiers) override;
246 void spellingMarkers(WebVector<uint32_t>* markers) override; 246 void spellingMarkers(WebVector<uint32_t>* markers) override;
247 void removeSpellingMarkersUnderWords( 247 void removeSpellingMarkersUnderWords(
248 const WebVector<WebString>& words) override; 248 const WebVector<WebString>& words) override;
249 unsigned long createUniqueIdentifierForRequest() override; 249 unsigned long createUniqueIdentifierForRequest() override;
250 void enableDeviceEmulation(const WebDeviceEmulationParams&) override; 250 void enableDeviceEmulation(const WebDeviceEmulationParams&) override;
251 void disableDeviceEmulation() override; 251 void disableDeviceEmulation() override;
252 WebAXObject accessibilityObject() override; 252 WebAXObject accessibilityObject() override;
253 void setSelectionColors(unsigned activeBackgroundColor, 253 void setSelectionColors(unsigned activeBackgroundColor,
254 unsigned activeForegroundColor, 254 unsigned activeForegroundColor,
255 unsigned inactiveBackgroundColor, 255 unsigned inactiveBackgroundColor,
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 // TODO(lfg): Remove once WebViewFrameWidget is deleted. 538 // TODO(lfg): Remove once WebViewFrameWidget is deleted.
539 void scheduleAnimationForWidget(); 539 void scheduleAnimationForWidget();
540 bool getCompositionCharacterBounds(WebVector<WebRect>&) override; 540 bool getCompositionCharacterBounds(WebVector<WebRect>&) override;
541 void applyReplacementRange(const WebRange&) override; 541 void applyReplacementRange(const WebRange&) override;
542 542
543 friend class WebView; // So WebView::Create can call our constructor 543 friend class WebView; // So WebView::Create can call our constructor
544 friend class WebViewFrameWidget; 544 friend class WebViewFrameWidget;
545 friend class WTF::RefCounted<WebViewImpl>; 545 friend class WTF::RefCounted<WebViewImpl>;
546 friend void setCurrentInputEventForTest(const WebInputEvent*); 546 friend void setCurrentInputEventForTest(const WebInputEvent*);
547 547
548 enum DragAction { DragEnter, DragOver };
549
550 explicit WebViewImpl(WebViewClient*, WebPageVisibilityState); 548 explicit WebViewImpl(WebViewClient*, WebPageVisibilityState);
551 ~WebViewImpl() override; 549 ~WebViewImpl() override;
552 550
553 void hideSelectPopup(); 551 void hideSelectPopup();
554 552
555 HitTestResult hitTestResultForRootFramePos(const IntPoint&); 553 HitTestResult hitTestResultForRootFramePos(const IntPoint&);
556 HitTestResult hitTestResultForViewportPos(const IntPoint&); 554 HitTestResult hitTestResultForViewportPos(const IntPoint&);
557 555
558 // Consolidate some common code between starting a drag over a target and
559 // updating a drag over a target. If we're starting a drag, |isEntering|
560 // should be true.
561 WebDragOperation dragTargetDragEnterOrOver(const WebPoint& pointInViewport,
562 const WebPoint& screenPoint,
563 DragAction,
564 int modifiers);
565
566 void configureAutoResizeMode(); 556 void configureAutoResizeMode();
567 557
568 void initializeLayerTreeView(); 558 void initializeLayerTreeView();
569 559
570 void setIsAcceleratedCompositingActive(bool); 560 void setIsAcceleratedCompositingActive(bool);
571 void doComposite(); 561 void doComposite();
572 void reallocateRenderer(); 562 void reallocateRenderer();
573 void updateLayerTreeViewport(); 563 void updateLayerTreeViewport();
574 void updateLayerTreeBackgroundColor(); 564 void updateLayerTreeBackgroundColor();
575 void updateDeviceEmulationTransform(); 565 void updateDeviceEmulationTransform();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 // The upper bound on the size when auto-resizing. 624 // The upper bound on the size when auto-resizing.
635 IntSize m_maxAutoSize; 625 IntSize m_maxAutoSize;
636 626
637 Persistent<Page> m_page; 627 Persistent<Page> m_page;
638 628
639 // An object that can be used to manipulate m_page->settings() without linking 629 // An object that can be used to manipulate m_page->settings() without linking
640 // against WebCore. This is lazily allocated the first time GetWebSettings() 630 // against WebCore. This is lazily allocated the first time GetWebSettings()
641 // is called. 631 // is called.
642 std::unique_ptr<WebSettingsImpl> m_webSettings; 632 std::unique_ptr<WebSettingsImpl> m_webSettings;
643 633
644 // A copy of the web drop data object we received from the browser.
645 Persistent<DataObject> m_currentDragData;
646
647 // Keeps track of the current zoom level. 0 means no zoom, positive numbers 634 // Keeps track of the current zoom level. 0 means no zoom, positive numbers
648 // mean zoom in, negative numbers mean zoom out. 635 // mean zoom in, negative numbers mean zoom out.
649 double m_zoomLevel; 636 double m_zoomLevel;
650 637
651 double m_minimumZoomLevel; 638 double m_minimumZoomLevel;
652 639
653 double m_maximumZoomLevel; 640 double m_maximumZoomLevel;
654 641
655 // Additional zoom factor used to scale the content by device scale factor. 642 // Additional zoom factor used to scale the content by device scale factor.
656 double m_zoomFactorForDeviceScaleFactor; 643 double m_zoomFactorForDeviceScaleFactor;
(...skipping 24 matching lines...) Expand all
681 668
682 // Webkit expects keyPress events to be suppressed if the associated keyDown 669 // Webkit expects keyPress events to be suppressed if the associated keyDown
683 // event was handled. Safari implements this behavior by peeking out the 670 // event was handled. Safari implements this behavior by peeking out the
684 // associated WM_CHAR event if the keydown was handled. We emulate 671 // associated WM_CHAR event if the keydown was handled. We emulate
685 // this behavior by setting this flag if the keyDown was handled. 672 // this behavior by setting this flag if the keyDown was handled.
686 bool m_suppressNextKeypressEvent; 673 bool m_suppressNextKeypressEvent;
687 674
688 // Represents whether or not this object should process incoming IME events. 675 // Represents whether or not this object should process incoming IME events.
689 bool m_imeAcceptEvents; 676 bool m_imeAcceptEvents;
690 677
691 // The available drag operations (copy, move link...) allowed by the source.
692 WebDragOperation m_operationsAllowed;
693
694 // The current drag operation as negotiated by the source and destination.
695 // When not equal to DragOperationNone, the drag data can be dropped onto the
696 // current drop target in this WebView (the drop target can accept the drop).
697 WebDragOperation m_dragOperation;
698
699 // The popup associated with an input/select element. 678 // The popup associated with an input/select element.
700 RefPtr<WebPagePopupImpl> m_pagePopup; 679 RefPtr<WebPagePopupImpl> m_pagePopup;
701 680
702 Persistent<DevToolsEmulator> m_devToolsEmulator; 681 Persistent<DevToolsEmulator> m_devToolsEmulator;
703 std::unique_ptr<PageOverlay> m_pageColorOverlay; 682 std::unique_ptr<PageOverlay> m_pageColorOverlay;
704 683
705 // Whether the webview is rendering transparently. 684 // Whether the webview is rendering transparently.
706 bool m_isTransparent; 685 bool m_isTransparent;
707 686
708 // Whether the user can press tab to focus links. 687 // Whether the user can press tab to focus links.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 Persistent<ResizeViewportAnchor> m_resizeViewportAnchor; 744 Persistent<ResizeViewportAnchor> m_resizeViewportAnchor;
766 }; 745 };
767 746
768 // We have no ways to check if the specified WebView is an instance of 747 // We have no ways to check if the specified WebView is an instance of
769 // WebViewImpl because WebViewImpl is the only implementation of WebView. 748 // WebViewImpl because WebViewImpl is the only implementation of WebView.
770 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true); 749 DEFINE_TYPE_CASTS(WebViewImpl, WebView, webView, true, true);
771 750
772 } // namespace blink 751 } // namespace blink
773 752
774 #endif 753 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewFrameWidget.cpp ('k') | third_party/WebKit/Source/web/WebViewImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698