summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 22:59:05 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 22:59:05 +0000
commitc06ecf7ce927d1c4646a5c3c318dd454f223affb (patch)
tree9f44cc4af8236df0d3148c99f94cfc9df42f2d55
parent19bb672d814c1927874efd9a17c3e24cccb169b5 (diff)
downloadchromium_src-c06ecf7ce927d1c4646a5c3c318dd454f223affb.zip
chromium_src-c06ecf7ce927d1c4646a5c3c318dd454f223affb.tar.gz
chromium_src-c06ecf7ce927d1c4646a5c3c318dd454f223affb.tar.bz2
Cleanup shell.cc
- We now delayload shell32 so manual function bind is just cruft - We now include the win7 sdk BUG=none TEST=chrome runs on xp Review URL: http://codereview.chromium.org/9088021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116396 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/base/win/shell.cc39
1 files changed, 2 insertions, 37 deletions
diff --git a/ui/base/win/shell.cc b/ui/base/win/shell.cc
index 29efce8..3081d77 100644
--- a/ui/base/win/shell.cc
+++ b/ui/base/win/shell.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,44 +20,13 @@ namespace win {
namespace {
-const wchar_t kShell32[] = L"shell32.dll";
-const char kSHGetPropertyStoreForWindow[] = "SHGetPropertyStoreForWindow";
-
-// Define the type of SHGetPropertyStoreForWindow is SHGPSFW.
-typedef DECLSPEC_IMPORT HRESULT (STDAPICALLTYPE *SHGPSFW)(HWND hwnd,
- REFIID riid,
- void** ppv);
-
void SetAppIdAndIconForWindow(const string16& app_id,
const string16& app_icon,
HWND hwnd) {
// This functionality is only available on Win7+.
if (base::win::GetVersion() < base::win::VERSION_WIN7)
return;
-
- // Load Shell32.dll into memory.
- // TODO(brg): Remove this mechanism when the Win7 SDK is available in trunk.
- std::wstring shell32_filename(kShell32);
- FilePath shell32_filepath(shell32_filename);
- base::NativeLibrary shell32_library = base::LoadNativeLibrary(
- shell32_filepath, NULL);
-
- if (!shell32_library)
- return;
-
- // Get the function pointer for SHGetPropertyStoreForWindow.
- void* function = base::GetFunctionPointerFromNativeLibrary(
- shell32_library,
- kSHGetPropertyStoreForWindow);
-
- if (!function) {
- base::UnloadNativeLibrary(shell32_library);
- return;
- }
-
- // Set the application's name.
base::win::ScopedComPtr<IPropertyStore> pps;
- SHGPSFW SHGetPropertyStoreForWindow = static_cast<SHGPSFW>(function);
HRESULT result = SHGetPropertyStoreForWindow(
hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive()));
if (S_OK == result) {
@@ -68,9 +37,6 @@ void SetAppIdAndIconForWindow(const string16& app_id,
pps, PKEY_AppUserModel_RelaunchIconResource, app_icon.c_str());
}
}
-
- // Cleanup.
- base::UnloadNativeLibrary(shell32_library);
}
} // namespace
@@ -88,7 +54,6 @@ bool OpenItemViaShell(const FilePath& full_path) {
if ((error == SE_ERR_NOASSOC))
return OpenItemWithExternalApp(full_path.value());
-
return false;
}
@@ -101,7 +66,7 @@ bool OpenItemViaShellNoZoneCheck(const FilePath& full_path) {
if (::ShellExecuteExW(&sei))
return true;
LONG_PTR error = reinterpret_cast<LONG_PTR>(sei.hInstApp);
- if ((error == SE_ERR_NOASSOC))
+ if (error == SE_ERR_NOASSOC)
return OpenItemWithExternalApp(full_path.value());
return false;
}