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

Side by Side Diff: views/widget/root_view_win.cc

Issue 6507028: Remove usages of RootView from View by moving relevant RootView API methods t... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
« no previous file with comments | « views/widget/root_view_gtk.cc ('k') | views/widget/widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 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/root_view.h" 5 #include "views/widget/root_view.h"
6 6
7 #include "ui/base/dragdrop/drag_drop_types.h"
8 #include "ui/base/dragdrop/drag_source.h"
9 #include "ui/base/dragdrop/os_exchange_data.h"
10 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
11 #include "ui/gfx/canvas_skia.h" 7 #include "ui/gfx/canvas_skia.h"
12 8
13 using ui::OSExchangeData;
14 using ui::OSExchangeDataProviderWin;
15
16 namespace views { 9 namespace views {
17 10
18 void RootView::OnPaint(HWND hwnd) { 11 void RootView::OnPaint(HWND hwnd) {
19 gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize(); 12 gfx::Rect original_dirty_region = GetScheduledPaintRectConstrainedToSize();
20 if (!original_dirty_region.IsEmpty()) { 13 if (!original_dirty_region.IsEmpty()) {
21 // Invoke InvalidateRect so that the dirty region of the window includes the 14 // Invoke InvalidateRect so that the dirty region of the window includes the
22 // region we need to paint. If we didn't do this and the region didn't 15 // region we need to paint. If we didn't do this and the region didn't
23 // include the dirty region, Paint() would incorrectly mark everything as 16 // include the dirty region, Paint() would incorrectly mark everything as
24 // clean. This can happen if a WM_PAINT is generated by the system before 17 // clean. This can happen if a WM_PAINT is generated by the system before
25 // the InvokeLater schedule by RootView is processed. 18 // the InvokeLater schedule by RootView is processed.
26 RECT win_version = original_dirty_region.ToRECT(); 19 RECT win_version = original_dirty_region.ToRECT();
27 InvalidateRect(hwnd, &win_version, FALSE); 20 InvalidateRect(hwnd, &win_version, FALSE);
28 } 21 }
29 scoped_ptr<gfx::CanvasPaint> canvas( 22 scoped_ptr<gfx::CanvasPaint> canvas(
30 gfx::CanvasPaint::CreateCanvasPaint(hwnd)); 23 gfx::CanvasPaint::CreateCanvasPaint(hwnd));
31 if (!canvas->IsValid()) { 24 if (!canvas->IsValid()) {
32 SchedulePaintInRect(canvas->GetInvalidRect(), false); 25 SchedulePaintInRect(canvas->GetInvalidRect(), false);
33 if (NeedsPainting(false)) 26 if (NeedsPainting(false))
34 Paint(canvas->AsCanvas()); 27 Paint(canvas->AsCanvas());
35 } 28 }
36 } 29 }
37 30
38 void RootView::StartDragForViewFromMouseEvent(
39 View* view,
40 const OSExchangeData& data,
41 int operation) {
42 // NOTE: view may be null.
43 drag_view_ = view;
44 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource);
45 DWORD effects;
46 DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source,
47 ui::DragDropTypes::DragOperationToDropEffect(operation), &effects);
48 // If the view is removed during the drag operation, drag_view_ is set to
49 // NULL.
50 if (view && drag_view_ == view) {
51 View* drag_view = drag_view_;
52 drag_view_ = NULL;
53 drag_view->OnDragDone();
54 }
55 }
56
57 } 31 }
OLDNEW
« no previous file with comments | « views/widget/root_view_gtk.cc ('k') | views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698