OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_WIN_H_ | 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_WIN_H_ |
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_WIN_H_ | 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
12 #include "ui/base/dragdrop/drop_target.h" | 12 #include "ui/base/dragdrop/drop_target.h" |
| 13 #include "webkit/glue/webdropdata.h" |
13 | 14 |
14 class InterstitialDropTarget; | 15 class InterstitialDropTarget; |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class RenderViewHost; | 18 class RenderViewHost; |
18 class WebContents; | 19 class WebContents; |
19 class WebDragDestDelegate; | 20 class WebDragDestDelegate; |
20 } | 21 } |
21 | 22 |
22 // A helper object that provides drop capabilities to a WebContentsImpl. The | 23 // A helper object that provides drop capabilities to a WebContentsImpl. The |
23 // DropTarget handles drags that enter the region of the WebContents by | 24 // DropTarget handles drags that enter the region of the WebContents by |
24 // passing on the events to the renderer. | 25 // passing on the events to the renderer. |
25 class CONTENT_EXPORT WebDragDest : public ui::DropTarget { | 26 class CONTENT_EXPORT WebDragDest : public ui::DropTarget { |
26 public: | 27 public: |
27 // Create a new WebDragDest associating it with the given HWND and | 28 // Create a new WebDragDest associating it with the given HWND and |
28 // WebContents. | 29 // WebContents. |
29 WebDragDest(HWND source_hwnd, content::WebContents* contents); | 30 WebDragDest(HWND source_hwnd, content::WebContents* contents); |
30 virtual ~WebDragDest(); | 31 virtual ~WebDragDest(); |
31 | 32 |
| 33 WebDropData* current_drop_data() const { return drop_data_.get(); } |
| 34 |
32 void set_drag_cursor(WebKit::WebDragOperation op) { | 35 void set_drag_cursor(WebKit::WebDragOperation op) { |
33 drag_cursor_ = op; | 36 drag_cursor_ = op; |
34 } | 37 } |
35 | 38 |
36 content::WebDragDestDelegate* delegate() const { return delegate_; } | 39 content::WebDragDestDelegate* delegate() const { return delegate_; } |
37 void set_delegate(content::WebDragDestDelegate* d) { delegate_ = d; } | 40 void set_delegate(content::WebDragDestDelegate* d) { delegate_ = d; } |
38 | 41 |
39 protected: | 42 protected: |
40 virtual DWORD OnDragEnter(IDataObject* data_object, | 43 virtual DWORD OnDragEnter(IDataObject* data_object, |
41 DWORD key_state, | 44 DWORD key_state, |
(...skipping 26 matching lines...) Expand all Loading... |
68 // content area. This can be updated async during a drag operation. | 71 // content area. This can be updated async during a drag operation. |
69 WebKit::WebDragOperation drag_cursor_; | 72 WebKit::WebDragOperation drag_cursor_; |
70 | 73 |
71 // A special drop target handler for when we try to d&d while an interstitial | 74 // A special drop target handler for when we try to d&d while an interstitial |
72 // page is showing. | 75 // page is showing. |
73 scoped_ptr<InterstitialDropTarget> interstitial_drop_target_; | 76 scoped_ptr<InterstitialDropTarget> interstitial_drop_target_; |
74 | 77 |
75 // A delegate that can receive drag information about drag events. | 78 // A delegate that can receive drag information about drag events. |
76 content::WebDragDestDelegate* delegate_; | 79 content::WebDragDestDelegate* delegate_; |
77 | 80 |
| 81 // The data for the current drag, or NULL if |context_| is NULL. |
| 82 scoped_ptr<WebDropData> drop_data_; |
| 83 |
78 DISALLOW_COPY_AND_ASSIGN(WebDragDest); | 84 DISALLOW_COPY_AND_ASSIGN(WebDragDest); |
79 }; | 85 }; |
80 | 86 |
81 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_WIN_H_ | 87 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_DRAG_DEST_WIN_H_ |
OLD | NEW |