OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/win_util.h" | 5 #include "app/win_util.h" |
6 | 6 |
7 #include <commdlg.h> | 7 #include <commdlg.h> |
8 #include <dwmapi.h> | 8 #include <dwmapi.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #include <shlobj.h> | 10 #include <shlobj.h> |
11 | 11 |
12 #include <algorithm> | 12 #include <algorithm> |
13 | 13 |
14 #include "app/l10n_util.h" | 14 #include "app/l10n_util.h" |
15 #include "app/l10n_util_win.h" | 15 #include "app/l10n_util_win.h" |
16 #include "base/base_switches.h" | 16 #include "base/base_switches.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/file_util.h" | 18 #include "base/file_util.h" |
19 #include "base/i18n/rtl.h" | 19 #include "base/i18n/rtl.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "base/native_library.h" | 21 #include "base/native_library.h" |
22 #include "base/registry.h" | 22 #include "base/registry.h" |
23 #include "base/scoped_comptr_win.h" | 23 #include "base/scoped_comptr_win.h" |
24 #include "base/scoped_handle.h" | 24 #include "base/scoped_handle.h" |
25 #include "base/scoped_handle_win.h" | 25 #include "base/scoped_handle_win.h" |
| 26 #include "base/scoped_native_library.h" |
26 #include "base/string_util.h" | 27 #include "base/string_util.h" |
27 #include "base/win_util.h" | 28 #include "base/win_util.h" |
28 #include "gfx/codec/png_codec.h" | 29 #include "gfx/codec/png_codec.h" |
29 #include "gfx/gdi_util.h" | 30 #include "gfx/gdi_util.h" |
30 | 31 |
31 // Ensure that we pick up this link library. | 32 // Ensure that we pick up this link library. |
32 #pragma comment(lib, "dwmapi.lib") | 33 #pragma comment(lib, "dwmapi.lib") |
33 | 34 |
34 namespace win_util { | 35 namespace win_util { |
35 | 36 |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 HRESULT result = SHGetPropertyStoreForWindow( | 576 HRESULT result = SHGetPropertyStoreForWindow( |
576 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); | 577 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); |
577 if (S_OK == result) { | 578 if (S_OK == result) { |
578 SetAppIdForPropertyStore(pps, app_id.c_str()); | 579 SetAppIdForPropertyStore(pps, app_id.c_str()); |
579 } | 580 } |
580 | 581 |
581 // Cleanup. | 582 // Cleanup. |
582 base::UnloadNativeLibrary(shell32_library); | 583 base::UnloadNativeLibrary(shell32_library); |
583 } | 584 } |
584 | 585 |
| 586 void CallSetProcessDPIAware() { |
| 587 // This functionality is only available on Vista or later. |
| 588 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) |
| 589 return; |
| 590 |
| 591 base::ScopedNativeLibrary user32( |
| 592 FilePath(base::GetNativeLibraryName(L"user32"))); |
| 593 typedef BOOL (*SetProcessDPIAwareFunc)(); |
| 594 SetProcessDPIAwareFunc set_process_dpi_aware = |
| 595 (SetProcessDPIAwareFunc)user32.GetFunctionPointer("SetProcessDPIAware"); |
| 596 if (set_process_dpi_aware) |
| 597 set_process_dpi_aware(); |
| 598 } |
| 599 |
585 } // namespace win_util | 600 } // namespace win_util |
OLD | NEW |