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

Side by Side Diff: ui/views/drag_utils.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 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 #include "ui/views/drag_utils.h" 5 #include "ui/views/drag_utils.h"
6 6
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/gfx/size.h" 8 #include "ui/gfx/size.h"
9 9
10 #if defined(USE_AURA) 10 #if defined(USE_AURA)
(...skipping 11 matching lines...) Expand all
22 #error 22 #error
23 #endif 23 #endif
24 24
25 ui::ScaleFactor GetDeviceScaleFactorForNativeView(views::Widget* widget) { 25 ui::ScaleFactor GetDeviceScaleFactorForNativeView(views::Widget* widget) {
26 ui::ScaleFactor device_scale_factor = ui::SCALE_FACTOR_100P; 26 ui::ScaleFactor device_scale_factor = ui::SCALE_FACTOR_100P;
27 #if defined(USE_AURA) 27 #if defined(USE_AURA)
28 // The following code should work on other platforms as well. But we do not 28 // The following code should work on other platforms as well. But we do not
29 // yet care about device scale factor on other platforms. So to keep drag and 29 // yet care about device scale factor on other platforms. So to keep drag and
30 // drop behavior on other platforms un-touched, we wrap this in the #if guard. 30 // drop behavior on other platforms un-touched, we wrap this in the #if guard.
31 if (widget && widget->GetNativeView()) { 31 if (widget && widget->GetNativeView()) {
32 gfx::Display display = gfx::Screen::GetDisplayNearestWindow( 32 gfx::NativeView view = widget->GetNativeView();
33 widget->GetNativeView()); 33 gfx::Display display = gfx::Screen::GetScreenFor(view)->
34 GetDisplayNearestWindow(view);
34 device_scale_factor = ui::GetScaleFactorFromScale( 35 device_scale_factor = ui::GetScaleFactorFromScale(
35 display.device_scale_factor()); 36 display.device_scale_factor());
36 } 37 }
37 #endif 38 #endif
38 return device_scale_factor; 39 return device_scale_factor;
39 } 40 }
40 41
41 namespace views { 42 namespace views {
42 43
43 void RunShellDrag(gfx::NativeView view, 44 void RunShellDrag(gfx::NativeView view,
(...skipping 19 matching lines...) Expand all
63 } 64 }
64 65
65 gfx::Canvas* GetCanvasForDragImage(views::Widget* widget, 66 gfx::Canvas* GetCanvasForDragImage(views::Widget* widget,
66 const gfx::Size& canvas_size) { 67 const gfx::Size& canvas_size) {
67 ui::ScaleFactor device_scale_factor = 68 ui::ScaleFactor device_scale_factor =
68 GetDeviceScaleFactorForNativeView(widget); 69 GetDeviceScaleFactorForNativeView(widget);
69 return new gfx::Canvas(canvas_size, device_scale_factor, false); 70 return new gfx::Canvas(canvas_size, device_scale_factor, false);
70 } 71 }
71 72
72 } // namespace views 73 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698