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 #include "ui/display/win/screen_win.h" | 5 #include "ui/display/win/screen_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellscalingapi.h> | 8 #include <shellscalingapi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 // When |window| isn't rooted to a display, we should just return the | 399 // When |window| isn't rooted to a display, we should just return the |
| 400 // default display so we get some correct display information like the | 400 // default display so we get some correct display information like the |
| 401 // scaling factor. | 401 // scaling factor. |
| 402 return GetPrimaryDisplay(); | 402 return GetPrimaryDisplay(); |
| 403 } | 403 } |
| 404 ScreenWinDisplay screen_win_display = | 404 ScreenWinDisplay screen_win_display = |
| 405 GetScreenWinDisplayNearestHWND(window_hwnd); | 405 GetScreenWinDisplayNearestHWND(window_hwnd); |
| 406 return screen_win_display.display(); | 406 return screen_win_display.display(); |
| 407 } | 407 } |
| 408 | 408 |
| 409 Display GetDisplayNearestView(gfx::NativeView view) const { | |
| 410 HWND window_hwnd = GetHWNDFromNativeView(view); | |
| 411 if (!window_hwnd) { | |
| 412 return GetPrimaryDisplay(); | |
| 413 } | |
| 414 ScreenWinDisplay screen_win_display = | |
| 415 GetScreenWinDisplayNearestHWND(window_hwnd); | |
| 416 return screen_win_display.display(); | |
| 417 } | |
|
tapted
2017/03/09 00:47:42
This is identical to GetDisplayNearestWindow. Is t
Jinsuk Kim
2017/03/09 01:56:17
Right this is not necessary since Windows always u
| |
| 418 | |
| 409 Display ScreenWin::GetDisplayNearestPoint(const gfx::Point& point) const { | 419 Display ScreenWin::GetDisplayNearestPoint(const gfx::Point& point) const { |
| 410 gfx::Point screen_point(DIPToScreenPoint(point)); | 420 gfx::Point screen_point(DIPToScreenPoint(point)); |
| 411 ScreenWinDisplay screen_win_display = | 421 ScreenWinDisplay screen_win_display = |
| 412 GetScreenWinDisplayNearestScreenPoint(screen_point); | 422 GetScreenWinDisplayNearestScreenPoint(screen_point); |
| 413 return screen_win_display.display(); | 423 return screen_win_display.display(); |
| 414 } | 424 } |
| 415 | 425 |
| 416 Display ScreenWin::GetDisplayMatching(const gfx::Rect& match_rect) const { | 426 Display ScreenWin::GetDisplayMatching(const gfx::Rect& match_rect) const { |
| 417 ScreenWinDisplay screen_win_display = | 427 ScreenWinDisplay screen_win_display = |
| 418 GetScreenWinDisplayNearestScreenRect(match_rect); | 428 GetScreenWinDisplayNearestScreenRect(match_rect); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 if (std::find(unique_scale_factors.begin(), unique_scale_factors.end(), | 602 if (std::find(unique_scale_factors.begin(), unique_scale_factors.end(), |
| 593 reported_scale) == unique_scale_factors.end()) { | 603 reported_scale) == unique_scale_factors.end()) { |
| 594 unique_scale_factors.push_back(reported_scale); | 604 unique_scale_factors.push_back(reported_scale); |
| 595 UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", reported_scale); | 605 UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", reported_scale); |
| 596 } | 606 } |
| 597 } | 607 } |
| 598 } | 608 } |
| 599 | 609 |
| 600 } // namespace win | 610 } // namespace win |
| 601 } // namespace display | 611 } // namespace display |
| OLD | NEW |