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

Side by Side Diff: chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h

Issue 9581003: Get rid of chrome dependencies from tab_contents_drag_win.cc. After this I'll move it to content\br… (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) 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 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 "base/callback.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/threading/platform_thread.h" 12 #include "base/threading/platform_thread.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 14 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" 15 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
16 #include "ui/gfx/native_widget_types.h"
15 #include "ui/gfx/point.h" 17 #include "ui/gfx/point.h"
16 18
17 class DragDropThread; 19 class DragDropThread;
18 class NativeTabContentsViewWin; 20 class WebDragDest;
19 class WebDragSource; 21 class WebDragSource;
20 struct WebDropData; 22 struct WebDropData;
21 23
24 namespace content {
25 class WebContents;
26 }
27
22 // Windows-specific drag-and-drop handling in WebContentsView. 28 // Windows-specific drag-and-drop handling in WebContentsView.
23 // If we are dragging a virtual file out of the browser, we use a background 29 // 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 30 // 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 31 // message loop in the UI thread. For all other cases, the drag-and-drop happens
26 // in the UI thread. 32 // in the UI thread.
27 class TabContentsDragWin 33 class TabContentsDragWin
28 : public ui::DataObjectImpl::Observer, 34 : public ui::DataObjectImpl::Observer,
29 public base::RefCountedThreadSafe<TabContentsDragWin> { 35 public base::RefCountedThreadSafe<TabContentsDragWin> {
30 public: 36 public:
31 explicit TabContentsDragWin(NativeTabContentsViewWin* view); 37 TabContentsDragWin(gfx::NativeWindow source_wnd,
38 content::WebContents* web_contents,
39 WebDragDest* drag_dest,
40 const base::Callback<void()>& drag_end_callback);
32 virtual ~TabContentsDragWin(); 41 virtual ~TabContentsDragWin();
33 42
34 // Called on UI thread. 43 // Called on UI thread.
35 void StartDragging(const WebDropData& drop_data, 44 void StartDragging(const WebDropData& drop_data,
36 WebKit::WebDragOperationsMask ops, 45 WebKit::WebDragOperationsMask ops,
37 const SkBitmap& image, 46 const SkBitmap& image,
38 const gfx::Point& image_offset); 47 const gfx::Point& image_offset);
39 void CancelDrag(); 48 void CancelDrag();
40 49
41 // DataObjectImpl::Observer implementation. 50 // DataObjectImpl::Observer implementation.
(...skipping 27 matching lines...) Expand all
69 const gfx::Point& image_offset); 78 const gfx::Point& image_offset);
70 // Called on UI thread. 79 // Called on UI thread.
71 void EndDragging(bool restore_suspended_state); 80 void EndDragging(bool restore_suspended_state);
72 void CloseThread(); 81 void CloseThread();
73 82
74 // For debug check only. Access only on drag-and-drop thread. 83 // For debug check only. Access only on drag-and-drop thread.
75 base::PlatformThreadId drag_drop_thread_id_; 84 base::PlatformThreadId drag_drop_thread_id_;
76 85
77 // All the member variables below are accessed on UI thread. 86 // All the member variables below are accessed on UI thread.
78 87
79 // Keep track of the TabContentsViewViews it is associated with. 88 gfx::NativeWindow source_wnd_;
dcheng 2012/03/02 18:54:47 Seems a little unfortunate that we turn 1 pointer
jam 2012/03/02 18:56:37 I prefer not adding a new interface just to carry
dcheng 2012/03/02 19:04:17 OK, I'm not too thrilled with this part of the cha
dcheng 2012/03/02 19:04:17 Minor nit: window_ instead of wnd_. Similar for ot
jam 2012/03/02 19:09:59 Done.
jam 2012/03/02 19:09:59 I think this may be a personal style difference :)
80 NativeTabContentsViewWin* view_; 89 content::WebContents* web_contents_;
90 WebDragDest* drag_dest_;
81 91
82 // |drag_source_| is our callback interface passed to the system when we 92 // |drag_source_| is our callback interface passed to the system when we
83 // want to initiate a drag and drop operation. We use it to tell if a 93 // want to initiate a drag and drop operation. We use it to tell if a
84 // drag operation is happening. 94 // drag operation is happening.
85 scoped_refptr<WebDragSource> drag_source_; 95 scoped_refptr<WebDragSource> drag_source_;
86 96
87 // The thread used by the drag-out download. This is because we want to avoid 97 // The thread used by the drag-out download. This is because we want to avoid
88 // running nested message loop in main UI thread. 98 // running nested message loop in main UI thread.
89 scoped_ptr<DragDropThread> drag_drop_thread_; 99 scoped_ptr<DragDropThread> drag_drop_thread_;
90 100
91 // The flag to guard that EndDragging is not called twice. 101 // The flag to guard that EndDragging is not called twice.
92 bool drag_ended_; 102 bool drag_ended_;
93 103
94 // Keep track of the old suspended state of the drop target. 104 // Keep track of the old suspended state of the drop target.
95 bool old_drop_target_suspended_state_; 105 bool old_drop_target_suspended_state_;
96 106
107 base::Callback<void()> drag_end_callback_;
108
97 DISALLOW_COPY_AND_ASSIGN(TabContentsDragWin); 109 DISALLOW_COPY_AND_ASSIGN(TabContentsDragWin);
98 }; 110 };
99 111
100 112
101 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_ 113 #endif // CHROME_BROWSER_UI_VIEWS_TAB_CONTENTS_TAB_CONTENTS_DRAG_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698