| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_ |
| 7 | 7 |
| 8 #include "base/base_drop_target.h" | 8 #include "base/base_drop_target.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" |
| 10 | 11 |
| 11 class InterstitialDropTarget; | 12 class InterstitialDropTarget; |
| 12 class RenderViewHost; | 13 class RenderViewHost; |
| 13 class TabContents; | 14 class TabContents; |
| 14 | 15 |
| 15 /////////////////////////////////////////////////////////////////////////////// | 16 /////////////////////////////////////////////////////////////////////////////// |
| 16 // | 17 // |
| 17 // WebDropTarget | 18 // WebDropTarget |
| 18 // | 19 // |
| 19 // A helper object that provides drop capabilities to a TabContents. The | 20 // A helper object that provides drop capabilities to a TabContents. The |
| 20 // DropTarget handles drags that enter the region of the TabContents by | 21 // DropTarget handles drags that enter the region of the TabContents by |
| 21 // passing on the events to the renderer. | 22 // passing on the events to the renderer. |
| 22 // | 23 // |
| 23 class WebDropTarget : public BaseDropTarget { | 24 class WebDropTarget : public BaseDropTarget { |
| 24 public: | 25 public: |
| 25 // Create a new WebDropTarget associating it with the given HWND and | 26 // Create a new WebDropTarget associating it with the given HWND and |
| 26 // TabContents. | 27 // TabContents. |
| 27 WebDropTarget(HWND source_hwnd, TabContents* contents); | 28 WebDropTarget(HWND source_hwnd, TabContents* contents); |
| 28 virtual ~WebDropTarget(); | 29 virtual ~WebDropTarget(); |
| 29 | 30 |
| 30 void set_is_drop_target(bool is_drop_target) { | 31 void set_drag_cursor(WebKit::WebDragOperation op) { |
| 31 is_drop_target_ = is_drop_target; | 32 drag_cursor_ = op; |
| 32 } | 33 } |
| 33 | 34 |
| 34 protected: | 35 protected: |
| 35 virtual DWORD OnDragEnter(IDataObject* data_object, | 36 virtual DWORD OnDragEnter(IDataObject* data_object, |
| 36 DWORD key_state, | 37 DWORD key_state, |
| 37 POINT cursor_position, | 38 POINT cursor_position, |
| 38 DWORD effect); | 39 DWORD effect); |
| 39 | 40 |
| 40 virtual DWORD OnDragOver(IDataObject* data_object, | 41 virtual DWORD OnDragOver(IDataObject* data_object, |
| 41 DWORD key_state, | 42 DWORD key_state, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 54 TabContents* tab_contents_; | 55 TabContents* tab_contents_; |
| 55 | 56 |
| 56 // We keep track of the render view host we're dragging over. If it changes | 57 // We keep track of the render view host we're dragging over. If it changes |
| 57 // during a drag, we need to re-send the DragEnter message. WARNING: | 58 // during a drag, we need to re-send the DragEnter message. WARNING: |
| 58 // this pointer should never be dereferenced. We only use it for comparing | 59 // this pointer should never be dereferenced. We only use it for comparing |
| 59 // pointers. | 60 // pointers. |
| 60 RenderViewHost* current_rvh_; | 61 RenderViewHost* current_rvh_; |
| 61 | 62 |
| 62 // Used to determine what cursor we should display when dragging over web | 63 // Used to determine what cursor we should display when dragging over web |
| 63 // content area. This can be updated async during a drag operation. | 64 // content area. This can be updated async during a drag operation. |
| 64 bool is_drop_target_; | 65 WebKit::WebDragOperation drag_cursor_; |
| 65 | 66 |
| 66 // A special drop target handler for when we try to d&d while an interstitial | 67 // A special drop target handler for when we try to d&d while an interstitial |
| 67 // page is showing. | 68 // page is showing. |
| 68 scoped_ptr<InterstitialDropTarget> interstitial_drop_target_; | 69 scoped_ptr<InterstitialDropTarget> interstitial_drop_target_; |
| 69 | 70 |
| 70 DISALLOW_EVIL_CONSTRUCTORS(WebDropTarget); | 71 DISALLOW_EVIL_CONSTRUCTORS(WebDropTarget); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_ | 74 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_ |
| OLD | NEW |