| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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 CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_WIN_H_ | |
| 6 #define CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_WIN_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | |
| 12 #include "ui/base/dragdrop/drop_target.h" | |
| 13 | |
| 14 class InterstitialDropTarget; | |
| 15 | |
| 16 namespace content { | |
| 17 class RenderViewHost; | |
| 18 class WebContents; | |
| 19 class WebDragDestDelegate; | |
| 20 } | |
| 21 | |
| 22 // A helper object that provides drop capabilities to a TabContents. The | |
| 23 // DropTarget handles drags that enter the region of the WebContents by | |
| 24 // passing on the events to the renderer. | |
| 25 class CONTENT_EXPORT WebDragDest : public ui::DropTarget { | |
| 26 public: | |
| 27 // Create a new WebDragDest associating it with the given HWND and | |
| 28 // WebContents. | |
| 29 WebDragDest(HWND source_hwnd, content::WebContents* contents); | |
| 30 virtual ~WebDragDest(); | |
| 31 | |
| 32 void set_drag_cursor(WebKit::WebDragOperation op) { | |
| 33 drag_cursor_ = op; | |
| 34 } | |
| 35 | |
| 36 content::WebDragDestDelegate* delegate() const { return delegate_; } | |
| 37 void set_delegate(content::WebDragDestDelegate* d) { delegate_ = d; } | |
| 38 | |
| 39 protected: | |
| 40 virtual DWORD OnDragEnter(IDataObject* data_object, | |
| 41 DWORD key_state, | |
| 42 POINT cursor_position, | |
| 43 DWORD effect); | |
| 44 | |
| 45 virtual DWORD OnDragOver(IDataObject* data_object, | |
| 46 DWORD key_state, | |
| 47 POINT cursor_position, | |
| 48 DWORD effect); | |
| 49 | |
| 50 virtual void OnDragLeave(IDataObject* data_object); | |
| 51 | |
| 52 virtual DWORD OnDrop(IDataObject* data_object, | |
| 53 DWORD key_state, | |
| 54 POINT cursor_position, | |
| 55 DWORD effect); | |
| 56 | |
| 57 private: | |
| 58 // Our associated WebContents. | |
| 59 content::WebContents* web_contents_; | |
| 60 | |
| 61 // We keep track of the render view host we're dragging over. If it changes | |
| 62 // during a drag, we need to re-send the DragEnter message. WARNING: | |
| 63 // this pointer should never be dereferenced. We only use it for comparing | |
| 64 // pointers. | |
| 65 content::RenderViewHost* current_rvh_; | |
| 66 | |
| 67 // Used to determine what cursor we should display when dragging over web | |
| 68 // content area. This can be updated async during a drag operation. | |
| 69 WebKit::WebDragOperation drag_cursor_; | |
| 70 | |
| 71 // A special drop target handler for when we try to d&d while an interstitial | |
| 72 // page is showing. | |
| 73 scoped_ptr<InterstitialDropTarget> interstitial_drop_target_; | |
| 74 | |
| 75 // A delegate that can receive drag information about drag events. | |
| 76 content::WebDragDestDelegate* delegate_; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(WebDragDest); | |
| 79 }; | |
| 80 | |
| 81 #endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_DRAG_DEST_WIN_H_ | |
| OLD | NEW |