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 CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ | 5 #ifndef CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ | 6 #define CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "content/common/content_export.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 16 #include "third_party/skia/include/core/SkBitmap.h" |
15 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 17 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
16 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
17 #include "ui/gfx/point.h" | 19 #include "ui/gfx/point.h" |
18 | 20 |
19 class DragDropThread; | 21 class DragDropThread; |
20 class WebDragDest; | 22 class WebDragDest; |
21 class WebDragSource; | 23 class WebDragSource; |
22 struct WebDropData; | 24 struct WebDropData; |
23 | 25 |
24 namespace content { | 26 namespace content { |
25 class WebContents; | 27 class WebContents; |
26 } | 28 } |
27 | 29 |
28 // Windows-specific drag-and-drop handling in WebContentsView. | 30 // Windows-specific drag-and-drop handling in WebContentsView. |
29 // If we are dragging a virtual file out of the browser, we use a background | 31 // If we are dragging a virtual file out of the browser, we use a background |
30 // thread to do the drag-and-drop because we do not want to run nested | 32 // thread to do the drag-and-drop because we do not want to run nested |
31 // message loop in the UI thread. For all other cases, the drag-and-drop happens | 33 // message loop in the UI thread. For all other cases, the drag-and-drop happens |
32 // in the UI thread. | 34 // in the UI thread. |
33 class TabContentsDragWin | 35 class CONTENT_EXPORT WebContentsDragWin |
34 : public ui::DataObjectImpl::Observer, | 36 : NON_EXPORTED_BASE(public ui::DataObjectImpl::Observer), |
35 public base::RefCountedThreadSafe<TabContentsDragWin> { | 37 public base::RefCountedThreadSafe<WebContentsDragWin> { |
36 public: | 38 public: |
37 TabContentsDragWin(gfx::NativeWindow source_window, | 39 WebContentsDragWin(gfx::NativeWindow source_window, |
38 content::WebContents* web_contents, | 40 content::WebContents* web_contents, |
39 WebDragDest* drag_dest, | 41 WebDragDest* drag_dest, |
40 const base::Callback<void()>& drag_end_callback); | 42 const base::Callback<void()>& drag_end_callback); |
41 virtual ~TabContentsDragWin(); | 43 virtual ~WebContentsDragWin(); |
42 | 44 |
43 // Called on UI thread. | 45 // Called on UI thread. |
44 void StartDragging(const WebDropData& drop_data, | 46 void StartDragging(const WebDropData& drop_data, |
45 WebKit::WebDragOperationsMask ops, | 47 WebKit::WebDragOperationsMask ops, |
46 const SkBitmap& image, | 48 const SkBitmap& image, |
47 const gfx::Point& image_offset); | 49 const gfx::Point& image_offset); |
48 void CancelDrag(); | 50 void CancelDrag(); |
49 | 51 |
50 // DataObjectImpl::Observer implementation. | 52 // DataObjectImpl::Observer implementation. |
51 // Called on drag-and-drop thread. | 53 // Called on drag-and-drop thread. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 scoped_ptr<DragDropThread> drag_drop_thread_; | 101 scoped_ptr<DragDropThread> drag_drop_thread_; |
100 | 102 |
101 // The flag to guard that EndDragging is not called twice. | 103 // The flag to guard that EndDragging is not called twice. |
102 bool drag_ended_; | 104 bool drag_ended_; |
103 | 105 |
104 // Keep track of the old suspended state of the drop target. | 106 // Keep track of the old suspended state of the drop target. |
105 bool old_drop_target_suspended_state_; | 107 bool old_drop_target_suspended_state_; |
106 | 108 |
107 base::Callback<void()> drag_end_callback_; | 109 base::Callback<void()> drag_end_callback_; |
108 | 110 |
109 DISALLOW_COPY_AND_ASSIGN(TabContentsDragWin); | 111 DISALLOW_COPY_AND_ASSIGN(WebContentsDragWin); |
110 }; | 112 }; |
111 | 113 |
112 | 114 #endif // CONTENT_BROWSER_TAB_CONTENTS_WEB_CONTENTS_DRAG_WIN_H_ |
113 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ | |
OLD | NEW |