OLD | NEW |
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 #include "views/widget/native_widget_win.h" | 5 #include "views/widget/native_widget_win.h" |
6 | 6 |
7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "ui/base/dragdrop/drag_drop_types.h" |
| 9 #include "ui/base/dragdrop/drag_source.h" |
| 10 #include "ui/base/dragdrop/os_exchange_data.h" |
| 11 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
8 #include "ui/base/system_monitor/system_monitor.h" | 12 #include "ui/base/system_monitor/system_monitor.h" |
9 #include "ui/base/view_prop.h" | 13 #include "ui/base/view_prop.h" |
10 #include "ui/base/win/hwnd_util.h" | 14 #include "ui/base/win/hwnd_util.h" |
11 #include "ui/gfx/canvas_skia.h" | 15 #include "ui/gfx/canvas_skia.h" |
12 #include "ui/gfx/native_theme_win.h" | 16 #include "ui/gfx/native_theme_win.h" |
13 #include "ui/gfx/path.h" | 17 #include "ui/gfx/path.h" |
14 #include "views/view.h" | 18 #include "views/view.h" |
15 #include "views/widget/widget_impl.h" | 19 #include "views/widget/widget_impl.h" |
16 | 20 |
17 namespace views { | 21 namespace views { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 if (GetFocus() != native_view) | 215 if (GetFocus() != native_view) |
212 SetFocus(native_view); | 216 SetFocus(native_view); |
213 } else { | 217 } else { |
214 // NULL or invalid |native_view| passed, we consider this to be clearing | 218 // NULL or invalid |native_view| passed, we consider this to be clearing |
215 // focus. Keep the top level window focused so we continue to receive | 219 // focus. Keep the top level window focused so we continue to receive |
216 // key events. | 220 // key events. |
217 SetFocus(hwnd()); | 221 SetFocus(hwnd()); |
218 } | 222 } |
219 } | 223 } |
220 | 224 |
| 225 void NativeWidgetWin::RunShellDrag(const ui::OSExchangeData& data, |
| 226 int operation) { |
| 227 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); |
| 228 DWORD effects; |
| 229 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), drag_source, |
| 230 ui::DragDropTypes::DragOperationToDropEffect(operation), &effects); |
| 231 } |
| 232 |
221 WidgetImpl* NativeWidgetWin::GetWidgetImpl() { | 233 WidgetImpl* NativeWidgetWin::GetWidgetImpl() { |
222 return listener_->GetWidgetImpl(); | 234 return listener_->GetWidgetImpl(); |
223 } | 235 } |
224 | 236 |
225 const WidgetImpl* NativeWidgetWin::GetWidgetImpl() const { | 237 const WidgetImpl* NativeWidgetWin::GetWidgetImpl() const { |
226 return listener_->GetWidgetImpl(); | 238 return listener_->GetWidgetImpl(); |
227 } | 239 } |
228 | 240 |
229 //////////////////////////////////////////////////////////////////////////////// | 241 //////////////////////////////////////////////////////////////////////////////// |
230 // NativeWidetWin, MessageLoopForUI::Observer implementation | 242 // NativeWidetWin, MessageLoopForUI::Observer implementation |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 if (parent_widget) { | 684 if (parent_widget) { |
673 widget = parent_widget; | 685 widget = parent_widget; |
674 parent_hwnd = ::GetAncestor(parent_hwnd, GA_PARENT); | 686 parent_hwnd = ::GetAncestor(parent_hwnd, GA_PARENT); |
675 } | 687 } |
676 } while (parent_hwnd != NULL && parent_widget != NULL); | 688 } while (parent_hwnd != NULL && parent_widget != NULL); |
677 | 689 |
678 return widget; | 690 return widget; |
679 } | 691 } |
680 | 692 |
681 } // namespace views | 693 } // namespace views |
OLD | NEW |