OLD | NEW |
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 17 matching lines...) Expand all Loading... |
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::NativeView view = widget->GetNativeView(); | 32 gfx::NativeView view = widget->GetNativeView(); |
33 gfx::Display display = gfx::Screen::GetScreenFor(view)-> | 33 gfx::Display display = gfx::Screen::GetScreenFor(view)-> |
34 GetDisplayNearestWindow(view); | 34 GetDisplayNearestWindow(view); |
35 device_scale_factor = ui::GetScaleFactorFromScale( | 35 device_scale_factor = ui::GetScaleFactorFromScale( |
36 display.device_scale_factor()); | 36 display.device_scale_factor()); |
37 } | 37 } |
| 38 #elif defined(ENABLE_HIDPI) |
| 39 device_scale_factor = ui::GetMaxScaleFactor(); |
38 #endif | 40 #endif |
39 return device_scale_factor; | 41 return device_scale_factor; |
40 } | 42 } |
41 | 43 |
42 namespace views { | 44 namespace views { |
43 | 45 |
44 void RunShellDrag(gfx::NativeView view, | 46 void RunShellDrag(gfx::NativeView view, |
45 const ui::OSExchangeData& data, | 47 const ui::OSExchangeData& data, |
46 const gfx::Point& location, | 48 const gfx::Point& location, |
47 int operation, | 49 int operation, |
(...skipping 17 matching lines...) Expand all Loading... |
65 } | 67 } |
66 | 68 |
67 gfx::Canvas* GetCanvasForDragImage(views::Widget* widget, | 69 gfx::Canvas* GetCanvasForDragImage(views::Widget* widget, |
68 const gfx::Size& canvas_size) { | 70 const gfx::Size& canvas_size) { |
69 ui::ScaleFactor device_scale_factor = | 71 ui::ScaleFactor device_scale_factor = |
70 GetDeviceScaleFactorForNativeView(widget); | 72 GetDeviceScaleFactorForNativeView(widget); |
71 return new gfx::Canvas(canvas_size, device_scale_factor, false); | 73 return new gfx::Canvas(canvas_size, device_scale_factor, false); |
72 } | 74 } |
73 | 75 |
74 } // namespace views | 76 } // namespace views |
OLD | NEW |