Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: app/win/shell.cc

Issue 6864020: linux: don't always print dlopen errors from LoadNativeLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: owners Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/memory/scoped_native_library.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/shell.h" 5 #include "app/win/shell.h"
6 6
7 #include <shellapi.h> 7 #include <shellapi.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void SetAppIdForWindow(const string16& app_id, HWND hwnd) { 74 void SetAppIdForWindow(const string16& app_id, HWND hwnd) {
75 // This functionality is only available on Win7+. 75 // This functionality is only available on Win7+.
76 if (base::win::GetVersion() < base::win::VERSION_WIN7) 76 if (base::win::GetVersion() < base::win::VERSION_WIN7)
77 return; 77 return;
78 78
79 // Load Shell32.dll into memory. 79 // Load Shell32.dll into memory.
80 // TODO(brg): Remove this mechanism when the Win7 SDK is available in trunk. 80 // TODO(brg): Remove this mechanism when the Win7 SDK is available in trunk.
81 std::wstring shell32_filename(kShell32); 81 std::wstring shell32_filename(kShell32);
82 FilePath shell32_filepath(shell32_filename); 82 FilePath shell32_filepath(shell32_filename);
83 base::NativeLibrary shell32_library = base::LoadNativeLibrary( 83 base::NativeLibrary shell32_library = base::LoadNativeLibrary(
84 shell32_filepath); 84 shell32_filepath, NULL);
85 85
86 if (!shell32_library) 86 if (!shell32_library)
87 return; 87 return;
88 88
89 // Get the function pointer for SHGetPropertyStoreForWindow. 89 // Get the function pointer for SHGetPropertyStoreForWindow.
90 void* function = base::GetFunctionPointerFromNativeLibrary( 90 void* function = base::GetFunctionPointerFromNativeLibrary(
91 shell32_library, 91 shell32_library,
92 kSHGetPropertyStoreForWindow); 92 kSHGetPropertyStoreForWindow);
93 93
94 if (!function) { 94 if (!function) {
95 base::UnloadNativeLibrary(shell32_library); 95 base::UnloadNativeLibrary(shell32_library);
96 return; 96 return;
97 } 97 }
98 98
99 // Set the application's name. 99 // Set the application's name.
100 base::win::ScopedComPtr<IPropertyStore> pps; 100 base::win::ScopedComPtr<IPropertyStore> pps;
101 SHGPSFW SHGetPropertyStoreForWindow = static_cast<SHGPSFW>(function); 101 SHGPSFW SHGetPropertyStoreForWindow = static_cast<SHGPSFW>(function);
102 HRESULT result = SHGetPropertyStoreForWindow( 102 HRESULT result = SHGetPropertyStoreForWindow(
103 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive())); 103 hwnd, __uuidof(*pps), reinterpret_cast<void**>(pps.Receive()));
104 if (S_OK == result) 104 if (S_OK == result)
105 base::win::SetAppIdForPropertyStore(pps, app_id.c_str()); 105 base::win::SetAppIdForPropertyStore(pps, app_id.c_str());
106 106
107 // Cleanup. 107 // Cleanup.
108 base::UnloadNativeLibrary(shell32_library); 108 base::UnloadNativeLibrary(shell32_library);
109 } 109 }
110 110
111 } // namespace win 111 } // namespace win
112 } // namespace app 112 } // namespace app
OLDNEW
« no previous file with comments | « no previous file | base/memory/scoped_native_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698