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

Side by Side Diff: chrome/browser/tab_contents/web_drop_target_win.h

Issue 9564034: Separate out the Windows bookmark handling code out of the core drag & drop target class. This matc… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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 #pragma once 7 #pragma once
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
11 #include "ui/base/dragdrop/drop_target.h" 11 #include "ui/base/dragdrop/drop_target.h"
12 12
13 class InterstitialDropTarget; 13 class InterstitialDropTarget;
14 class RenderViewHost; 14 class RenderViewHost;
15 class TabContentsWrapper;
16 15
17 namespace content { 16 namespace content {
18 class WebContents; 17 class WebContents;
18 class WebDragDestDelegate;
19 } 19 }
20 20
21 // A helper object that provides drop capabilities to a TabContents. The 21 // A helper object that provides drop capabilities to a TabContents. The
22 // DropTarget handles drags that enter the region of the WebContents by 22 // DropTarget handles drags that enter the region of the WebContents by
23 // passing on the events to the renderer. 23 // passing on the events to the renderer.
24 class WebDropTarget : public ui::DropTarget { 24 class WebDropTarget : public ui::DropTarget {
25 public: 25 public:
26 // Create a new WebDropTarget associating it with the given HWND and 26 // Create a new WebDropTarget associating it with the given HWND and
27 // WebContents. 27 // WebContents.
28 WebDropTarget(HWND source_hwnd, content::WebContents* contents); 28 WebDropTarget(HWND source_hwnd, content::WebContents* contents);
29 virtual ~WebDropTarget(); 29 virtual ~WebDropTarget();
30 30
31 void set_drag_cursor(WebKit::WebDragOperation op) { 31 void set_drag_cursor(WebKit::WebDragOperation op) {
32 drag_cursor_ = op; 32 drag_cursor_ = op;
33 } 33 }
34 34
35 content::WebDragDestDelegate* delegate() const { return delegate_; }
36 void set_delegate(content::WebDragDestDelegate* d) { delegate_ = d; }
37
35 protected: 38 protected:
36 virtual DWORD OnDragEnter(IDataObject* data_object, 39 virtual DWORD OnDragEnter(IDataObject* data_object,
37 DWORD key_state, 40 DWORD key_state,
38 POINT cursor_position, 41 POINT cursor_position,
39 DWORD effect); 42 DWORD effect);
40 43
41 virtual DWORD OnDragOver(IDataObject* data_object, 44 virtual DWORD OnDragOver(IDataObject* data_object,
42 DWORD key_state, 45 DWORD key_state,
43 POINT cursor_position, 46 POINT cursor_position,
44 DWORD effect); 47 DWORD effect);
45 48
46 virtual void OnDragLeave(IDataObject* data_object); 49 virtual void OnDragLeave(IDataObject* data_object);
47 50
48 virtual DWORD OnDrop(IDataObject* data_object, 51 virtual DWORD OnDrop(IDataObject* data_object,
49 DWORD key_state, 52 DWORD key_state,
50 POINT cursor_position, 53 POINT cursor_position,
51 DWORD effect); 54 DWORD effect);
52 55
53 private: 56 private:
54 // Our associated WebContents. 57 // Our associated WebContents.
55 content::WebContents* web_contents_; 58 content::WebContents* web_contents_;
56 59
57 // The TabContentsWrapper for |tab_contents_|.
58 // Weak reference; may be NULL if the contents aren't contained in a wrapper
59 // (e.g. WebUI dialogs).
60 TabContentsWrapper* tab_;
61
62 // We keep track of the render view host we're dragging over. If it changes 60 // We keep track of the render view host we're dragging over. If it changes
63 // during a drag, we need to re-send the DragEnter message. WARNING: 61 // during a drag, we need to re-send the DragEnter message. WARNING:
64 // this pointer should never be dereferenced. We only use it for comparing 62 // this pointer should never be dereferenced. We only use it for comparing
65 // pointers. 63 // pointers.
66 RenderViewHost* current_rvh_; 64 RenderViewHost* current_rvh_;
67 65
68 // Used to determine what cursor we should display when dragging over web 66 // Used to determine what cursor we should display when dragging over web
69 // content area. This can be updated async during a drag operation. 67 // content area. This can be updated async during a drag operation.
70 WebKit::WebDragOperation drag_cursor_; 68 WebKit::WebDragOperation drag_cursor_;
71 69
72 // A special drop target handler for when we try to d&d while an interstitial 70 // A special drop target handler for when we try to d&d while an interstitial
73 // page is showing. 71 // page is showing.
74 scoped_ptr<InterstitialDropTarget> interstitial_drop_target_; 72 scoped_ptr<InterstitialDropTarget> interstitial_drop_target_;
75 73
74 // A delegate that can receive drag information about drag events.
75 content::WebDragDestDelegate* delegate_;
76
76 DISALLOW_COPY_AND_ASSIGN(WebDropTarget); 77 DISALLOW_COPY_AND_ASSIGN(WebDropTarget);
77 }; 78 };
78 79
79 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_ 80 #endif // CHROME_BROWSER_TAB_CONTENTS_WEB_DROP_TARGET_WIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/web_drag_bookmark_handler_win.cc ('k') | chrome/browser/tab_contents/web_drop_target_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698