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

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

Issue 2750253002: Reland 4e4eae4cbe6136b538a: Make download item drags look like bookmark (Closed)
Patch Set: with fix Created 3 years, 9 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
« ui/views/button_drag_utils.h ('K') | « ui/views/drag_utils.h ('k') | no next file » | 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) 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/base/layout.h" 7 #include "ui/base/layout.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/gfx/geometry/size.h" 9 #include "ui/gfx/geometry/size.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
11 11
12 namespace views { 12 namespace views {
13 13
14 float ScaleFactorForDragFromWidget(Widget* widget) { 14 float ScaleFactorForDragFromWidget(const Widget* widget) {
15 float device_scale = 1.0f; 15 float device_scale = 1.0f;
16 if (widget && widget->GetNativeView()) { 16 if (widget && widget->GetNativeView()) {
17 gfx::NativeView view = widget->GetNativeView(); 17 gfx::NativeView view = widget->GetNativeView();
18 device_scale = ui::GetScaleFactorForNativeView(view); 18 device_scale = ui::GetScaleFactorForNativeView(view);
19 } 19 }
20 return device_scale; 20 return device_scale;
21 } 21 }
22 22
23 gfx::Canvas* GetCanvasForDragImage(Widget* widget, 23 gfx::Canvas* GetCanvasForDragImage(const Widget* widget,
24 const gfx::Size& canvas_size) { 24 const gfx::Size& canvas_size) {
25 float device_scale = ScaleFactorForDragFromWidget(widget); 25 float device_scale = ScaleFactorForDragFromWidget(widget);
26 return new gfx::Canvas(canvas_size, device_scale, false); 26 return new gfx::Canvas(canvas_size, device_scale, false);
27 } 27 }
28 28
29 } // namespace views 29 } // namespace views
OLDNEW
« ui/views/button_drag_utils.h ('K') | « ui/views/drag_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698