OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlapp.h> | 8 #include <atlapp.h> |
9 #include <commdlg.h> | 9 #include <commdlg.h> |
10 #include <dwmapi.h> | 10 #include <dwmapi.h> |
11 #include <propvarutil.h> | 11 #include <propvarutil.h> |
12 #include <shellapi.h> | 12 #include <shellapi.h> |
13 #include <shlobj.h> | 13 #include <shlobj.h> |
14 | 14 |
15 #include "app/l10n_util.h" | 15 #include "app/l10n_util.h" |
16 #include "app/l10n_util_win.h" | 16 #include "app/l10n_util_win.h" |
17 #include "base/base_switches.h" | 17 #include "base/base_switches.h" |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "base/file_util.h" | 19 #include "base/file_util.h" |
20 #include "base/gfx/gdi_util.h" | 20 #include "base/gfx/gdi_util.h" |
21 #include "base/gfx/png_encoder.h" | 21 #include "base/gfx/png_encoder.h" |
22 #include "base/logging.h" | 22 #include "base/logging.h" |
23 #include "base/native_library.h" | 23 #include "base/native_library.h" |
24 #include "base/registry.h" | 24 #include "base/registry.h" |
| 25 #include "base/scoped_comptr_win.h" |
25 #include "base/scoped_handle.h" | 26 #include "base/scoped_handle.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 "grit/app_strings.h" | 29 #include "grit/app_strings.h" |
29 #include "net/base/mime_util.h" | 30 #include "net/base/mime_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 { |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 | 862 |
862 if (!function) { | 863 if (!function) { |
863 base::UnloadNativeLibrary(shell32_library); | 864 base::UnloadNativeLibrary(shell32_library); |
864 return; | 865 return; |
865 } | 866 } |
866 | 867 |
867 // Set the application's name. | 868 // Set the application's name. |
868 PROPVARIANT pv; | 869 PROPVARIANT pv; |
869 InitPropVariantFromString(app_id.c_str(), &pv); | 870 InitPropVariantFromString(app_id.c_str(), &pv); |
870 | 871 |
871 IPropertyStore* pps; | 872 ScopedComPtr<IPropertyStore> pps; |
872 SHGPSFW SHGetPropertyStoreForWindow = static_cast<SHGPSFW>(function); | 873 SHGPSFW SHGetPropertyStoreForWindow = static_cast<SHGPSFW>(function); |
873 if (S_OK == SHGetPropertyStoreForWindow(hwnd, IID_PPV_ARGS(&pps)) && | 874 HRESULT result = SHGetPropertyStoreForWindow( |
874 S_OK == pps->SetValue(PKEY_AppUserModel_ID, pv)) { | 875 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); |
875 pps->Commit(); | 876 if (S_OK == result) { |
| 877 if (S_OK == pps->SetValue(PKEY_AppUserModel_ID, pv)) |
| 878 pps->Commit(); |
876 } | 879 } |
877 | 880 |
878 // Cleanup. | 881 // Cleanup. |
| 882 PropVariantClear(&pv); |
879 base::UnloadNativeLibrary(shell32_library); | 883 base::UnloadNativeLibrary(shell32_library); |
880 } | 884 } |
881 | 885 |
882 } // namespace win_util | 886 } // namespace win_util |
OLD | NEW |