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

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

Issue 1633793003: [MD] fix bookmark bar/URL bar drag image color for OTR mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « ui/views/button_drag_utils.cc ('k') | ui/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) 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/display.h" 8 #include "ui/gfx/display.h"
9 #include "ui/gfx/geometry/size.h" 9 #include "ui/gfx/geometry/size.h"
10 #include "ui/gfx/screen.h" 10 #include "ui/gfx/screen.h"
11 #include "ui/views/widget/widget.h" 11 #include "ui/views/widget/widget.h"
12 12
13 namespace { 13 namespace {
14 14
15 float GetDeviceScaleForNativeView(views::Widget* widget) { 15 float GetDeviceScaleForNativeView(views::Widget* widget) {
16 float device_scale = 1.0f; 16 float device_scale = 1.0f;
17 // The following code should work on other platforms as well. But we do not
18 // yet care about device scale factor on other platforms. So to keep drag and
19 // drop behavior on other platforms un-touched, we wrap this in the #if guard.
20 if (widget && widget->GetNativeView()) { 17 if (widget && widget->GetNativeView()) {
21 gfx::NativeView view = widget->GetNativeView(); 18 gfx::NativeView view = widget->GetNativeView();
22 gfx::Display display = gfx::Screen::GetScreenFor(view)-> 19 gfx::Display display = gfx::Screen::GetScreenFor(view)->
23 GetDisplayNearestWindow(view); 20 GetDisplayNearestWindow(view);
24 device_scale = display.device_scale_factor(); 21 device_scale = display.device_scale_factor();
25 } 22 }
26 return device_scale; 23 return device_scale;
27 } 24 }
28 25
29 } // namespace 26 } // namespace
30 27
31 namespace views { 28 namespace views {
32 29
33 gfx::Canvas* GetCanvasForDragImage(views::Widget* widget, 30 gfx::Canvas* GetCanvasForDragImage(views::Widget* widget,
34 const gfx::Size& canvas_size) { 31 const gfx::Size& canvas_size) {
35 float device_scale = GetDeviceScaleForNativeView(widget); 32 float device_scale = GetDeviceScaleForNativeView(widget);
36 return new gfx::Canvas(canvas_size, device_scale, false); 33 return new gfx::Canvas(canvas_size, device_scale, false);
37 } 34 }
38 35
39 } // namespace views 36 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/button_drag_utils.cc ('k') | ui/views/widget/widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698