| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 } | 386 } |
| 387 | 387 |
| 388 int ScreenWin::GetNumDisplays() const { | 388 int ScreenWin::GetNumDisplays() const { |
| 389 return static_cast<int>(screen_win_displays_.size()); | 389 return static_cast<int>(screen_win_displays_.size()); |
| 390 } | 390 } |
| 391 | 391 |
| 392 const std::vector<Display>& ScreenWin::GetAllDisplays() const { | 392 const std::vector<Display>& ScreenWin::GetAllDisplays() const { |
| 393 return displays_; | 393 return displays_; |
| 394 } | 394 } |
| 395 | 395 |
| 396 Display ScreenWin::GetDisplayNearestWindow(gfx::NativeView window) const { | 396 Display ScreenWin::GetDisplayNearestWindow(gfx::NativeWindow window) const { |
| 397 HWND window_hwnd = GetHWNDFromNativeView(window); | 397 HWND window_hwnd = GetHWNDFromNativeView(window); |
| 398 if (!window_hwnd) { | 398 if (!window_hwnd) { |
| 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(); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 if (std::find(unique_scale_factors.begin(), unique_scale_factors.end(), | 592 if (std::find(unique_scale_factors.begin(), unique_scale_factors.end(), |
| 593 reported_scale) == unique_scale_factors.end()) { | 593 reported_scale) == unique_scale_factors.end()) { |
| 594 unique_scale_factors.push_back(reported_scale); | 594 unique_scale_factors.push_back(reported_scale); |
| 595 UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", reported_scale); | 595 UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", reported_scale); |
| 596 } | 596 } |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| 600 } // namespace win | 600 } // namespace win |
| 601 } // namespace display | 601 } // namespace display |
| OLD | NEW |