OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/plugins/plugin_lib.h" | 5 #include "webkit/glue/plugins/plugin_lib.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/metrics/stats_counters.h" | 9 #include "base/metrics/stats_counters.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 158 } |
159 | 159 |
160 bool PluginLib::Load() { | 160 bool PluginLib::Load() { |
161 if (library_) | 161 if (library_) |
162 return true; | 162 return true; |
163 | 163 |
164 bool rv = false; | 164 bool rv = false; |
165 base::NativeLibrary library = 0; | 165 base::NativeLibrary library = 0; |
166 | 166 |
167 if (!internal_) { | 167 if (!internal_) { |
| 168 #if defined(OS_WIN) |
| 169 // This is to work around a bug in the Real player recorder plugin which |
| 170 // intercepts LoadLibrary calls from chrome.dll and wraps NPAPI functions |
| 171 // provided by the plugin. It crashes if the media player plugin is being |
| 172 // loaded. Workaround is to load the dll dynamically by getting the |
| 173 // LoadLibrary API address from kernel32.dll which bypasses the recorder |
| 174 // plugin. |
| 175 if (web_plugin_info_.name.find(L"Windows Media Player") != |
| 176 std::wstring::npos) { |
| 177 library = base::LoadNativeLibraryDynamically(web_plugin_info_.path); |
| 178 } else { |
| 179 library = base::LoadNativeLibrary(web_plugin_info_.path); |
| 180 } |
| 181 #else // OS_WIN |
168 library = base::LoadNativeLibrary(web_plugin_info_.path); | 182 library = base::LoadNativeLibrary(web_plugin_info_.path); |
| 183 #endif // OS_WIN |
169 if (library == 0) { | 184 if (library == 0) { |
170 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 185 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
171 << "Couldn't load plugin " << web_plugin_info_.path.value(); | 186 << "Couldn't load plugin " << web_plugin_info_.path.value(); |
172 return rv; | 187 return rv; |
173 } | 188 } |
174 | 189 |
175 #if defined(OS_MACOSX) | 190 #if defined(OS_MACOSX) |
176 // According to the WebKit source, QuickTime at least requires us to call | 191 // According to the WebKit source, QuickTime at least requires us to call |
177 // UseResFile on the plugin resources before loading. | 192 // UseResFile on the plugin resources before loading. |
178 if (library->bundle_resource_ref != -1) | 193 if (library->bundle_resource_ref != -1) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 340 } |
326 | 341 |
327 void PluginLib::Shutdown() { | 342 void PluginLib::Shutdown() { |
328 if (initialized_ && !internal_) { | 343 if (initialized_ && !internal_) { |
329 NP_Shutdown(); | 344 NP_Shutdown(); |
330 initialized_ = false; | 345 initialized_ = false; |
331 } | 346 } |
332 } | 347 } |
333 | 348 |
334 } // namespace NPAPI | 349 } // namespace NPAPI |
OLD | NEW |