| OLD | NEW |
| 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/base/win/shell.h" | 5 #include "ui/base/win/shell.h" |
| 6 | 6 |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 #include <shlobj.h> // Must be before propkey. | 8 #include <shlobj.h> // Must be before propkey. |
| 9 #include <propkey.h> | 9 #include <propkey.h> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/native_library.h" | 12 #include "base/native_library.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/win/metro.h" |
| 14 #include "base/win/scoped_comptr.h" | 15 #include "base/win/scoped_comptr.h" |
| 15 #include "base/win/win_util.h" | 16 #include "base/win/win_util.h" |
| 16 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
| 17 | 18 |
| 18 namespace ui { | 19 namespace ui { |
| 19 namespace win { | 20 namespace win { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 void SetAppIdAndIconForWindow(const string16& app_id, | 24 void SetAppIdAndIconForWindow(const string16& app_id, |
| 24 const string16& app_icon, | 25 const string16& app_icon, |
| 25 HWND hwnd) { | 26 HWND hwnd) { |
| 26 // This functionality is only available on Win7+. | 27 // This functionality is only available on Win7+. It also doesn't make sense |
| 27 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 28 // to do this for Chrome Metro. |
| 29 if (base::win::GetVersion() < base::win::VERSION_WIN7 || |
| 30 base::win::IsMetroProcess()) |
| 28 return; | 31 return; |
| 29 base::win::ScopedComPtr<IPropertyStore> pps; | 32 base::win::ScopedComPtr<IPropertyStore> pps; |
| 30 HRESULT result = SHGetPropertyStoreForWindow( | 33 HRESULT result = SHGetPropertyStoreForWindow( |
| 31 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); | 34 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); |
| 32 if (S_OK == result) { | 35 if (S_OK == result) { |
| 33 if (!app_id.empty()) | 36 if (!app_id.empty()) |
| 34 base::win::SetAppIdForPropertyStore(pps, app_id.c_str()); | 37 base::win::SetAppIdForPropertyStore(pps, app_id.c_str()); |
| 35 if (!app_icon.empty()) { | 38 if (!app_icon.empty()) { |
| 36 base::win::SetStringValueForPropertyStore( | 39 base::win::SetStringValueForPropertyStore( |
| 37 pps, PKEY_AppUserModel_RelaunchIconResource, app_icon.c_str()); | 40 pps, PKEY_AppUserModel_RelaunchIconResource, app_icon.c_str()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void SetAppIdForWindow(const string16& app_id, HWND hwnd) { | 88 void SetAppIdForWindow(const string16& app_id, HWND hwnd) { |
| 86 SetAppIdAndIconForWindow(app_id, string16(), hwnd); | 89 SetAppIdAndIconForWindow(app_id, string16(), hwnd); |
| 87 } | 90 } |
| 88 | 91 |
| 89 void SetAppIconForWindow(const string16& app_icon, HWND hwnd) { | 92 void SetAppIconForWindow(const string16& app_icon, HWND hwnd) { |
| 90 SetAppIdAndIconForWindow(string16(), app_icon, hwnd); | 93 SetAppIdAndIconForWindow(string16(), app_icon, hwnd); |
| 91 } | 94 } |
| 92 | 95 |
| 93 } // namespace win | 96 } // namespace win |
| 94 } // namespace ui | 97 } // namespace ui |
| OLD | NEW |