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

Side by Side Diff: ui/display/win/screen_win.cc

Issue 2751833004: Reland "Add display::GetDisplayNearestView" (Closed)
Patch Set: Created 3 years, 9 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/display/win/screen_win.h ('k') | ui/message_center/views/toast_contents_view.cc » ('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/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
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
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
OLDNEW
« no previous file with comments | « ui/display/win/screen_win.h ('k') | ui/message_center/views/toast_contents_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698