| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/root_view.h" | 5 #include "views/widget/root_view.h" |
| 6 | 6 |
| 7 #include "app/drag_drop_types.h" | 7 #include "app/drag_drop_types.h" |
| 8 #include "app/os_exchange_data.h" | 8 #include "app/os_exchange_data.h" |
| 9 #include "app/os_exchange_data_provider_win.h" | 9 #include "app/os_exchange_data_provider_win.h" |
| 10 #include "base/base_drag_source.h" | 10 #include "app/win/drag_source.h" |
| 11 #include "gfx/canvas_skia.h" | 11 #include "gfx/canvas_skia.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 void RootView::OnPaint(HWND hwnd) { | 15 void RootView::OnPaint(HWND hwnd) { |
| 16 gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize(); | 16 gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize(); |
| 17 if (!original_dirty_region.IsEmpty()) { | 17 if (!original_dirty_region.IsEmpty()) { |
| 18 // Invoke InvalidateRect so that the dirty region of the window includes the | 18 // Invoke InvalidateRect so that the dirty region of the window includes the |
| 19 // region we need to paint. If we didn't do this and the region didn't | 19 // region we need to paint. If we didn't do this and the region didn't |
| 20 // include the dirty region, ProcessPaint would incorrectly mark everything | 20 // include the dirty region, ProcessPaint would incorrectly mark everything |
| (...skipping 10 matching lines...) Expand all Loading... |
| 31 ProcessPaint(canvas->AsCanvas()); | 31 ProcessPaint(canvas->AsCanvas()); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 void RootView::StartDragForViewFromMouseEvent( | 35 void RootView::StartDragForViewFromMouseEvent( |
| 36 View* view, | 36 View* view, |
| 37 const OSExchangeData& data, | 37 const OSExchangeData& data, |
| 38 int operation) { | 38 int operation) { |
| 39 // NOTE: view may be null. | 39 // NOTE: view may be null. |
| 40 drag_view_ = view; | 40 drag_view_ = view; |
| 41 scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); | 41 scoped_refptr<app::win::DragSource> drag_source(new app::win::DragSource); |
| 42 DWORD effects; | 42 DWORD effects; |
| 43 DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source, | 43 DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source, |
| 44 DragDropTypes::DragOperationToDropEffect(operation), &effects); | 44 DragDropTypes::DragOperationToDropEffect(operation), &effects); |
| 45 // If the view is removed during the drag operation, drag_view_ is set to | 45 // If the view is removed during the drag operation, drag_view_ is set to |
| 46 // NULL. | 46 // NULL. |
| 47 if (view && drag_view_ == view) { | 47 if (view && drag_view_ == view) { |
| 48 View* drag_view = drag_view_; | 48 View* drag_view = drag_view_; |
| 49 drag_view_ = NULL; | 49 drag_view_ = NULL; |
| 50 drag_view->OnDragDone(); | 50 drag_view->OnDragDone(); |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 } | 54 } |
| OLD | NEW |