| 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 11 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |