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

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

Issue 2665623002: Fix Jumplist favicons to have high resolution in HDPI Windows displays (Closed)
Patch Set: Update comments and remove redundant .h files. Created 3 years, 10 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
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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 if (!g_screen_win_instance) 344 if (!g_screen_win_instance)
345 return ScreenWinDisplay().display().device_scale_factor(); 345 return ScreenWinDisplay().display().device_scale_factor();
346 346
347 DCHECK(hwnd); 347 DCHECK(hwnd);
348 HWND rootHwnd = g_screen_win_instance->GetRootWindow(hwnd); 348 HWND rootHwnd = g_screen_win_instance->GetRootWindow(hwnd);
349 ScreenWinDisplay screen_win_display = 349 ScreenWinDisplay screen_win_display =
350 g_screen_win_instance->GetScreenWinDisplayNearestHWND(rootHwnd); 350 g_screen_win_instance->GetScreenWinDisplayNearestHWND(rootHwnd);
351 return screen_win_display.display().device_scale_factor(); 351 return screen_win_display.display().device_scale_factor();
352 } 352 }
353 353
354 // static
355 float ScreenWin::GetLargestDeviceScaleFactor() {
sky 2017/02/02 22:41:16 This function is only needed in one place, can you
chengx 2017/02/03 01:51:13 Sure. Will make the code local to jumplist.
356 float scale = 1.0;
357 if (!g_screen_win_instance)
358 return scale;
359 std::vector<Display> displays(g_screen_win_instance->GetAllDisplays());
360 for (size_t i = 0; i < displays.size(); i++) {
sky 2017/02/02 22:41:16 no {}, also, I would use enhanced for loop
chengx 2017/02/03 01:51:13 Done.
361 scale = std::max(scale, displays[i].device_scale_factor());
362 }
363 return scale;
364 }
365
354 HWND ScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { 366 HWND ScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const {
355 NOTREACHED(); 367 NOTREACHED();
356 return nullptr; 368 return nullptr;
357 } 369 }
358 370
359 gfx::NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { 371 gfx::NativeWindow ScreenWin::GetNativeWindowFromHWND(HWND hwnd) const {
360 NOTREACHED(); 372 NOTREACHED();
361 return nullptr; 373 return nullptr;
362 } 374 }
363 375
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 if (std::find(unique_scale_factors.begin(), unique_scale_factors.end(), 599 if (std::find(unique_scale_factors.begin(), unique_scale_factors.end(),
588 reported_scale) == unique_scale_factors.end()) { 600 reported_scale) == unique_scale_factors.end()) {
589 unique_scale_factors.push_back(reported_scale); 601 unique_scale_factors.push_back(reported_scale);
590 UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", reported_scale); 602 UMA_HISTOGRAM_SPARSE_SLOWLY("UI.DeviceScale", reported_scale);
591 } 603 }
592 } 604 }
593 } 605 }
594 606
595 } // namespace win 607 } // namespace win
596 } // namespace display 608 } // namespace display
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698