OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/os_exchange_data_provider_win.h" | |
10 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
11 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
12 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
13 #include "gfx/point.h" | 12 #include "gfx/point.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
15 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" |
| 15 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
16 | 16 |
17 class DragDropThread; | 17 class DragDropThread; |
18 class TabContentsViewWin; | 18 class TabContentsViewWin; |
19 class WebDragSource; | 19 class WebDragSource; |
20 struct WebDropData; | 20 struct WebDropData; |
21 | 21 |
22 // Windows-specific drag-and-drop handling in TabContentsView. | 22 // Windows-specific drag-and-drop handling in TabContentsView. |
23 // If we are dragging a virtual file out of the browser, we use a background | 23 // If we are dragging a virtual file out of the browser, we use a background |
24 // thread to do the drag-and-drop because we do not want to run nested | 24 // thread to do the drag-and-drop because we do not want to run nested |
25 // message loop in the UI thread. For all other cases, the drag-and-drop happens | 25 // message loop in the UI thread. For all other cases, the drag-and-drop happens |
26 // in the UI thread. | 26 // in the UI thread. |
27 class TabContentsDragWin | 27 class TabContentsDragWin |
28 : public DataObjectImpl::Observer, | 28 : public ui::DataObjectImpl::Observer, |
29 public base::RefCountedThreadSafe<TabContentsDragWin> { | 29 public base::RefCountedThreadSafe<TabContentsDragWin> { |
30 public: | 30 public: |
31 explicit TabContentsDragWin(TabContentsViewWin* view); | 31 explicit TabContentsDragWin(TabContentsViewWin* view); |
32 virtual ~TabContentsDragWin(); | 32 virtual ~TabContentsDragWin(); |
33 | 33 |
34 // Called on UI thread. | 34 // Called on UI thread. |
35 void StartDragging(const WebDropData& drop_data, | 35 void StartDragging(const WebDropData& drop_data, |
36 WebKit::WebDragOperationsMask ops, | 36 WebKit::WebDragOperationsMask ops, |
37 const SkBitmap& image, | 37 const SkBitmap& image, |
38 const gfx::Point& image_offset); | 38 const gfx::Point& image_offset); |
39 void CancelDrag(); | 39 void CancelDrag(); |
40 | 40 |
41 // DataObjectImpl::Observer implementation. | 41 // DataObjectImpl::Observer implementation. |
42 // Called on drag-and-drop thread. | 42 // Called on drag-and-drop thread. |
43 virtual void OnWaitForData(); | 43 virtual void OnWaitForData(); |
44 virtual void OnDataObjectDisposed(); | 44 virtual void OnDataObjectDisposed(); |
45 | 45 |
46 private: | 46 private: |
47 // Called on either UI thread or drag-and-drop thread. | 47 // Called on either UI thread or drag-and-drop thread. |
48 void PrepareDragForDownload(const WebDropData& drop_data, | 48 void PrepareDragForDownload(const WebDropData& drop_data, |
49 OSExchangeData* data, | 49 ui::OSExchangeData* data, |
50 const GURL& page_url, | 50 const GURL& page_url, |
51 const std::string& page_encoding); | 51 const std::string& page_encoding); |
52 void PrepareDragForFileContents(const WebDropData& drop_data, | 52 void PrepareDragForFileContents(const WebDropData& drop_data, |
53 OSExchangeData* data); | 53 ui::OSExchangeData* data); |
54 void PrepareDragForUrl(const WebDropData& drop_data, OSExchangeData* data); | 54 void PrepareDragForUrl(const WebDropData& drop_data, |
| 55 ui::OSExchangeData* data); |
55 void DoDragging(const WebDropData& drop_data, | 56 void DoDragging(const WebDropData& drop_data, |
56 WebKit::WebDragOperationsMask ops, | 57 WebKit::WebDragOperationsMask ops, |
57 const GURL& page_url, | 58 const GURL& page_url, |
58 const std::string& page_encoding, | 59 const std::string& page_encoding, |
59 const SkBitmap& image, | 60 const SkBitmap& image, |
60 const gfx::Point& image_offset); | 61 const gfx::Point& image_offset); |
61 | 62 |
62 // Called on drag-and-drop thread. | 63 // Called on drag-and-drop thread. |
63 void StartBackgroundDragging(const WebDropData& drop_data, | 64 void StartBackgroundDragging(const WebDropData& drop_data, |
64 WebKit::WebDragOperationsMask ops, | 65 WebKit::WebDragOperationsMask ops, |
(...skipping 26 matching lines...) Expand all Loading... |
91 bool drag_ended_; | 92 bool drag_ended_; |
92 | 93 |
93 // Keep track of the old suspended state of the drop target. | 94 // Keep track of the old suspended state of the drop target. |
94 bool old_drop_target_suspended_state_; | 95 bool old_drop_target_suspended_state_; |
95 | 96 |
96 DISALLOW_COPY_AND_ASSIGN(TabContentsDragWin); | 97 DISALLOW_COPY_AND_ASSIGN(TabContentsDragWin); |
97 }; | 98 }; |
98 | 99 |
99 | 100 |
100 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ | 101 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ |
OLD | NEW |