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_DRAG_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_SOURCE_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_SOURCE_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_SOURCE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/gfx/native_widget_types.h" | 9 #include "base/gfx/native_widget_types.h" |
10 #include "base/gfx/point.h" | 10 #include "base/gfx/point.h" |
| 11 #include "chrome/common/notification_observer.h" |
| 12 #include "chrome/common/notification_registrar.h" |
11 | 13 |
12 // TODO(port): Port this file. | 14 // TODO(port): Port this file. |
13 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
14 #include "base/base_drag_source.h" | 16 #include "base/base_drag_source.h" |
15 #else | 17 #else |
16 #include "chrome/common/temp_scaffolding_stubs.h" | 18 #include "chrome/common/temp_scaffolding_stubs.h" |
17 #endif | 19 #endif |
18 | 20 |
19 class RenderViewHost; | 21 class RenderViewHost; |
| 22 class TabContents; |
20 | 23 |
21 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
22 // | 25 // |
23 // WebDragSource | 26 // WebDragSource |
24 // | 27 // |
25 // An IDropSource implementation for a TabContents. Handles notifications sent | 28 // An IDropSource implementation for a TabContents. Handles notifications sent |
26 // by an active drag-drop operation as the user mouses over other drop targets | 29 // by an active drag-drop operation as the user mouses over other drop targets |
27 // on their system. This object tells Windows whether or not the drag should | 30 // on their system. This object tells Windows whether or not the drag should |
28 // continue, and supplies the appropriate cursors. | 31 // continue, and supplies the appropriate cursors. |
29 // | 32 // |
30 class WebDragSource : public BaseDragSource { | 33 class WebDragSource : public BaseDragSource, |
| 34 public NotificationObserver { |
31 public: | 35 public: |
32 // Create a new DragSource for a given HWND and RenderViewHost. | 36 // Create a new DragSource for a given HWND and TabContents. |
33 WebDragSource(gfx::NativeWindow source_wnd, RenderViewHost* render_view_host); | 37 WebDragSource(gfx::NativeWindow source_wnd, TabContents* tab_contents); |
34 virtual ~WebDragSource() { } | 38 virtual ~WebDragSource() { } |
35 | 39 |
| 40 // NotificationObserver implementation. |
| 41 virtual void Observe(NotificationType type, |
| 42 const NotificationSource& source, |
| 43 const NotificationDetails& details); |
| 44 |
36 protected: | 45 protected: |
37 // BaseDragSource | 46 // BaseDragSource |
38 virtual void OnDragSourceCancel(); | 47 virtual void OnDragSourceCancel(); |
39 virtual void OnDragSourceDrop(); | 48 virtual void OnDragSourceDrop(); |
40 virtual void OnDragSourceMove(); | 49 virtual void OnDragSourceMove(); |
41 | 50 |
42 private: | 51 private: |
43 // Cannot construct thusly. | 52 // Cannot construct thusly. |
44 WebDragSource(); | 53 WebDragSource(); |
45 | 54 |
46 // Keep a reference to the window so we can translate the cursor position. | 55 // Keep a reference to the window so we can translate the cursor position. |
47 gfx::NativeWindow source_wnd_; | 56 gfx::NativeWindow source_wnd_; |
48 | 57 |
49 // We use this as a channel to the renderer to tell it about various drag | 58 // We use this as a channel to the renderer to tell it about various drag |
50 // drop events that it needs to know about (such as when a drag operation it | 59 // drop events that it needs to know about (such as when a drag operation it |
51 // initiated terminates). | 60 // initiated terminates). |
52 RenderViewHost* render_view_host_; | 61 RenderViewHost* render_view_host_; |
53 | 62 |
| 63 NotificationRegistrar registrar_; |
| 64 |
54 DISALLOW_COPY_AND_ASSIGN(WebDragSource); | 65 DISALLOW_COPY_AND_ASSIGN(WebDragSource); |
55 }; | 66 }; |
56 | 67 |
57 #endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_SOURCE_H_ | 68 #endif // #ifndef CHROME_BROWSER_TAB_CONTENTS_WEB_DRAG_SOURCE_H_ |
OLD | NEW |