Revert of Create a new AccountTrackerService (patchset #8 of https://codereview.chrom...
[chromium-blink-merge.git] / win8 / metro_driver / display_properties.cc
blobe1b7ed5e7e03764dfcaa51fd19fe68f1ae6fbfdd
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "stdafx.h"
7 #include <windows.h>
8 #include <wrl\implements.h>
9 #include <wrl\wrappers\corewrappers.h>
10 #include <windows.foundation.h>
11 #include <windows.graphics.display.h>
12 #include "base/win/windows_version.h"
13 #include "ui/gfx/win/dpi.h"
14 #include "winrt_utils.h"
16 float GetModernUIScale() {
17 if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
18 Microsoft::WRL::ComPtr<
19 ABI::Windows::Graphics::Display::IDisplayPropertiesStatics>
20 display_properties;
21 if (SUCCEEDED(winrt_utils::CreateActivationFactory(
22 RuntimeClass_Windows_Graphics_Display_DisplayProperties,
23 display_properties.GetAddressOf()))) {
24 ABI::Windows::Graphics::Display::ResolutionScale resolution_scale;
25 if (SUCCEEDED(display_properties->get_ResolutionScale(&resolution_scale)))
26 return static_cast<float>(resolution_scale) / 100.0f;
29 return gfx::GetDPIScale();