| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gfx/chrome_canvas.h" | 8 #include "app/gfx/canvas.h" |
| 9 #include "base/base_drag_source.h" | 9 #include "base/base_drag_source.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "views/widget/root_view_drop_target.h" | 11 #include "views/widget/root_view_drop_target.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 | 14 |
| 15 void RootView::UpdateCursor(const MouseEvent& e) { | 15 void RootView::UpdateCursor(const MouseEvent& e) { |
| 16 View *v = GetViewForPoint(e.location()); | 16 View *v = GetViewForPoint(e.location()); |
| 17 | 17 |
| 18 if (v && v != this) { | 18 if (v && v != this) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 33 gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize(); | 33 gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize(); |
| 34 if (!original_dirty_region.IsEmpty()) { | 34 if (!original_dirty_region.IsEmpty()) { |
| 35 // Invoke InvalidateRect so that the dirty region of the window includes the | 35 // Invoke InvalidateRect so that the dirty region of the window includes the |
| 36 // region we need to paint. If we didn't do this and the region didn't | 36 // region we need to paint. If we didn't do this and the region didn't |
| 37 // include the dirty region, ProcessPaint would incorrectly mark everything | 37 // include the dirty region, ProcessPaint would incorrectly mark everything |
| 38 // as clean. This can happen if a WM_PAINT is generated by the system before | 38 // as clean. This can happen if a WM_PAINT is generated by the system before |
| 39 // the InvokeLater schedule by RootView is processed. | 39 // the InvokeLater schedule by RootView is processed. |
| 40 RECT win_version = original_dirty_region.ToRECT(); | 40 RECT win_version = original_dirty_region.ToRECT(); |
| 41 InvalidateRect(hwnd, &win_version, FALSE); | 41 InvalidateRect(hwnd, &win_version, FALSE); |
| 42 } | 42 } |
| 43 ChromeCanvasPaint canvas(hwnd); | 43 gfx::CanvasPaint canvas(hwnd); |
| 44 if (!canvas.isEmpty()) { | 44 if (!canvas.isEmpty()) { |
| 45 const PAINTSTRUCT& ps = canvas.paintStruct(); | 45 const PAINTSTRUCT& ps = canvas.paintStruct(); |
| 46 SchedulePaint(gfx::Rect(ps.rcPaint), false); | 46 SchedulePaint(gfx::Rect(ps.rcPaint), false); |
| 47 if (NeedsPainting(false)) | 47 if (NeedsPainting(false)) |
| 48 ProcessPaint(&canvas); | 48 ProcessPaint(&canvas); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 void RootView::StartDragForViewFromMouseEvent( | 52 void RootView::StartDragForViewFromMouseEvent( |
| 53 View* view, | 53 View* view, |
| 54 IDataObject* data, | 54 IDataObject* data, |
| 55 int operation) { | 55 int operation) { |
| 56 drag_view_ = view; | 56 drag_view_ = view; |
| 57 scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); | 57 scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); |
| 58 DWORD effects; | 58 DWORD effects; |
| 59 DoDragDrop(data, drag_source, | 59 DoDragDrop(data, drag_source, |
| 60 DragDropTypes::DragOperationToDropEffect(operation), &effects); | 60 DragDropTypes::DragOperationToDropEffect(operation), &effects); |
| 61 // If the view is removed during the drag operation, drag_view_ is set to | 61 // If the view is removed during the drag operation, drag_view_ is set to |
| 62 // NULL. | 62 // NULL. |
| 63 if (drag_view_ == view) { | 63 if (drag_view_ == view) { |
| 64 View* drag_view = drag_view_; | 64 View* drag_view = drag_view_; |
| 65 drag_view_ = NULL; | 65 drag_view_ = NULL; |
| 66 drag_view->OnDragDone(); | 66 drag_view->OnDragDone(); |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 | 69 |
| 70 } | 70 } |
| OLD | NEW |