Chromium Code Reviews| 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 #ifndef UI_DISPLAY_WIN_SCREEN_WIN_H_ | 5 #ifndef UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| 6 #define UI_DISPLAY_WIN_SCREEN_WIN_H_ | 6 #define UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 // The DPI scale is performed relative to the display nearest to |hwnd|. | 85 // The DPI scale is performed relative to the display nearest to |hwnd|. |
| 86 static gfx::Size ScreenToDIPSize(HWND hwnd, const gfx::Size& size_in_pixels); | 86 static gfx::Size ScreenToDIPSize(HWND hwnd, const gfx::Size& size_in_pixels); |
| 87 | 87 |
| 88 // Converts a DIP size to a physical size. | 88 // Converts a DIP size to a physical size. |
| 89 // The DPI scale is performed relative to the display nearest to |hwnd|. | 89 // The DPI scale is performed relative to the display nearest to |hwnd|. |
| 90 static gfx::Size DIPToScreenSize(HWND hwnd, const gfx::Size& dip_size); | 90 static gfx::Size DIPToScreenSize(HWND hwnd, const gfx::Size& dip_size); |
| 91 | 91 |
| 92 // Returns the result of GetSystemMetrics for |metric| scaled to |hwnd|'s DPI. | 92 // Returns the result of GetSystemMetrics for |metric| scaled to |hwnd|'s DPI. |
| 93 static int GetSystemMetricsForHwnd(HWND hwnd, int metric); | 93 static int GetSystemMetricsForHwnd(HWND hwnd, int metric); |
| 94 | 94 |
| 95 // Returns the result of GetSystemMetrics for |metric| in DIP. | |
|
sky
2016/07/27 21:44:11
When would you use this rather than supplying an H
robliao
2016/07/27 22:04:01
You'd use this when you actually want to just do t
| |
| 96 static int GetSystemMetricsInDIP(int metric); | |
| 97 | |
| 95 // Returns |hwnd|'s scale factor. | 98 // Returns |hwnd|'s scale factor. |
| 96 static float GetScaleFactorForHWND(HWND hwnd); | 99 static float GetScaleFactorForHWND(HWND hwnd); |
| 97 | 100 |
| 98 // Returns the HWND associated with the NativeView. | 101 // Returns the HWND associated with the NativeView. |
| 99 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; | 102 virtual HWND GetHWNDFromNativeView(gfx::NativeView window) const; |
| 100 | 103 |
| 101 // Returns the NativeView associated with the HWND. | 104 // Returns the NativeView associated with the HWND. |
| 102 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; | 105 virtual gfx::NativeWindow GetNativeWindowFromHWND(HWND hwnd) const; |
| 103 | 106 |
| 104 protected: | 107 protected: |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 // Current list of ScreenWinDisplays. | 181 // Current list of ScreenWinDisplays. |
| 179 std::vector<ScreenWinDisplay> screen_win_displays_; | 182 std::vector<ScreenWinDisplay> screen_win_displays_; |
| 180 | 183 |
| 181 DISALLOW_COPY_AND_ASSIGN(ScreenWin); | 184 DISALLOW_COPY_AND_ASSIGN(ScreenWin); |
| 182 }; | 185 }; |
| 183 | 186 |
| 184 } // namespace win | 187 } // namespace win |
| 185 } // namespace display | 188 } // namespace display |
| 186 | 189 |
| 187 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ | 190 #endif // UI_DISPLAY_WIN_SCREEN_WIN_H_ |
| OLD | NEW |