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

Side by Side Diff: chrome/browser/ui/views/frame/minimize_button_metrics_win.cc

Issue 674763002: remove ui::gfx::GetDeviceScaleFactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dpi-cleanup-3
Patch Set: rebase-4 Created 6 years, 1 month 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
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 "chrome/browser/ui/views/frame/minimize_button_metrics_win.h" 5 #include "chrome/browser/ui/views/frame/minimize_button_metrics_win.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
9 #include "ui/base/win/shell.h" 9 #include "ui/base/win/shell.h"
10 #include "ui/gfx/win/dpi.h" 10 #include "ui/gfx/win/dpi.h"
(...skipping 14 matching lines...) Expand all
25 STATE_SYSTEM_OFFSCREEN | 25 STATE_SYSTEM_OFFSCREEN |
26 STATE_SYSTEM_UNAVAILABLE))) { 26 STATE_SYSTEM_UNAVAILABLE))) {
27 return 0; 27 return 0;
28 } 28 }
29 29
30 // WM_GETTITLEBARINFOEX returns rects in screen coordinates in pixels. 30 // WM_GETTITLEBARINFOEX returns rects in screen coordinates in pixels.
31 // We need to convert the minimize button corner offset to DIP before 31 // We need to convert the minimize button corner offset to DIP before
32 // returning it. 32 // returning it.
33 POINT minimize_button_corner = { titlebar_info.rgrect[2].left, 0 }; 33 POINT minimize_button_corner = { titlebar_info.rgrect[2].left, 0 };
34 MapWindowPoints(HWND_DESKTOP, hwnd, &minimize_button_corner, 1); 34 MapWindowPoints(HWND_DESKTOP, hwnd, &minimize_button_corner, 1);
35 return minimize_button_corner.x / gfx::win::GetDeviceScaleFactor(); 35 return minimize_button_corner.x / gfx::GetDPIScale();
36 } 36 }
37 37
38 } // namespace 38 } // namespace
39 39
40 // static 40 // static
41 int MinimizeButtonMetrics::last_cached_minimize_button_x_delta_ = 0; 41 int MinimizeButtonMetrics::last_cached_minimize_button_x_delta_ = 0;
42 42
43 MinimizeButtonMetrics::MinimizeButtonMetrics() 43 MinimizeButtonMetrics::MinimizeButtonMetrics()
44 : hwnd_(NULL), 44 : hwnd_(NULL),
45 cached_minimize_button_x_delta_(last_cached_minimize_button_x_delta_), 45 cached_minimize_button_x_delta_(last_cached_minimize_button_x_delta_),
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 cached_minimize_button_x_delta_ = minimize_button_offset; 95 cached_minimize_button_x_delta_ = minimize_button_offset;
96 } else { 96 } else {
97 RECT client_rect = {0}; 97 RECT client_rect = {0};
98 GetClientRect(hwnd_, &client_rect); 98 GetClientRect(hwnd_, &client_rect);
99 cached_minimize_button_x_delta_ = 99 cached_minimize_button_x_delta_ =
100 client_rect.right - minimize_button_offset; 100 client_rect.right - minimize_button_offset;
101 } 101 }
102 last_cached_minimize_button_x_delta_ = cached_minimize_button_x_delta_; 102 last_cached_minimize_button_x_delta_ = cached_minimize_button_x_delta_;
103 return minimize_button_offset; 103 return minimize_button_offset;
104 } 104 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/apps/app_window_desktop_window_tree_host_win.cc ('k') | ui/base/layout.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698