| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/webplugin_delegate_impl.h" | 5 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 dummy_window_for_activation_(NULL), | 243 dummy_window_for_activation_(NULL), |
| 244 handle_event_message_filter_hook_(NULL), | 244 handle_event_message_filter_hook_(NULL), |
| 245 handle_event_pump_messages_event_(NULL), | 245 handle_event_pump_messages_event_(NULL), |
| 246 handle_event_depth_(0), | 246 handle_event_depth_(0), |
| 247 user_gesture_message_posted_(false), | 247 user_gesture_message_posted_(false), |
| 248 #pragma warning(suppress: 4355) // can use this | 248 #pragma warning(suppress: 4355) // can use this |
| 249 user_gesture_msg_factory_(this) { | 249 user_gesture_msg_factory_(this) { |
| 250 memset(&window_, 0, sizeof(window_)); | 250 memset(&window_, 0, sizeof(window_)); |
| 251 | 251 |
| 252 const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); | 252 const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); |
| 253 std::string filename = | 253 std::wstring filename = StringToLowerASCII(plugin_info.path.BaseName().value()
); |
| 254 WideToUTF8(StringToLowerASCII(plugin_info.path.BaseName().value())); | |
| 255 | 254 |
| 256 if (instance_->mime_type() == "application/x-shockwave-flash" || | 255 if (instance_->mime_type() == "application/x-shockwave-flash" || |
| 257 filename == "npswf32.dll") { | 256 filename == kFlashPlugin) { |
| 258 // Flash only requests windowless plugins if we return a Mozilla user | 257 // Flash only requests windowless plugins if we return a Mozilla user |
| 259 // agent. | 258 // agent. |
| 260 instance_->set_use_mozilla_user_agent(); | 259 instance_->set_use_mozilla_user_agent(); |
| 261 quirks_ |= PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE; | 260 quirks_ |= PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE; |
| 262 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; | 261 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; |
| 263 } else if (filename == "nppdf32.dll") { | 262 } else if (filename == kAcrobatReaderPlugin) { |
| 264 // Check for the version number above or equal 9. | 263 // Check for the version number above or equal 9. |
| 265 std::vector<std::wstring> version; | 264 std::vector<std::wstring> version; |
| 266 SplitString(plugin_info.version, L'.', &version); | 265 SplitString(plugin_info.version, L'.', &version); |
| 267 if (version.size() > 0) { | 266 if (version.size() > 0) { |
| 268 int major = static_cast<int>(StringToInt64(version[0])); | 267 int major = static_cast<int>(StringToInt64(version[0])); |
| 269 if (major >= 9) { | 268 if (major >= 9) { |
| 270 quirks_ |= PLUGIN_QUIRK_DIE_AFTER_UNLOAD; | 269 quirks_ |= PLUGIN_QUIRK_DIE_AFTER_UNLOAD; |
| 271 } | 270 } |
| 272 } | 271 } |
| 273 quirks_ |= PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS; | 272 quirks_ |= PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS; |
| 274 } else if (plugin_info.name.find(L"Windows Media Player") != | 273 } else if (plugin_info.name.find(L"Windows Media Player") != |
| 275 std::wstring::npos) { | 274 std::wstring::npos) { |
| 276 // Windows Media Player needs two NPP_SetWindow calls. | 275 // Windows Media Player needs two NPP_SetWindow calls. |
| 277 quirks_ |= PLUGIN_QUIRK_SETWINDOW_TWICE; | 276 quirks_ |= PLUGIN_QUIRK_SETWINDOW_TWICE; |
| 278 | 277 |
| 279 // Windowless mode doesn't work in the WMP NPAPI plugin. | 278 // Windowless mode doesn't work in the WMP NPAPI plugin. |
| 280 quirks_ |= PLUGIN_QUIRK_NO_WINDOWLESS; | 279 quirks_ |= PLUGIN_QUIRK_NO_WINDOWLESS; |
| 281 | 280 |
| 282 // Non-admin users on XP couldn't modify the key to force the new UI. | 281 if (filename == kOldWMPPlugin) { |
| 283 quirks_ |= PLUGIN_QUIRK_PATCH_REGENUMKEYEXW; | 282 // Non-admin users on XP couldn't modify the key to force the new UI. |
| 283 quirks_ |= PLUGIN_QUIRK_PATCH_REGENUMKEYEXW; |
| 284 } |
| 284 } else if (instance_->mime_type() == "audio/x-pn-realaudio-plugin" || | 285 } else if (instance_->mime_type() == "audio/x-pn-realaudio-plugin" || |
| 285 filename == "nppl3260.dll") { | 286 filename == kRealPlayerPlugin) { |
| 286 quirks_ |= PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY; | 287 quirks_ |= PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY; |
| 287 } else if (plugin_info.name.find(L"VLC Multimedia Plugin") != | 288 } else if (plugin_info.name.find(L"VLC Multimedia Plugin") != |
| 288 std::wstring::npos || | 289 std::wstring::npos || |
| 289 plugin_info.name.find(L"VLC Multimedia Plug-in") != | 290 plugin_info.name.find(L"VLC Multimedia Plug-in") != |
| 290 std::wstring::npos) { | 291 std::wstring::npos) { |
| 291 // VLC hangs on NPP_Destroy if we call NPP_SetWindow with a null window | 292 // VLC hangs on NPP_Destroy if we call NPP_SetWindow with a null window |
| 292 // handle | 293 // handle |
| 293 quirks_ |= PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY; | 294 quirks_ |= PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY; |
| 294 // VLC 0.8.6d and 0.8.6e crash if multiple instances are created. | 295 // VLC 0.8.6d and 0.8.6e crash if multiple instances are created. |
| 295 quirks_ |= PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES; | 296 quirks_ |= PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES; |
| 296 } else if (filename == "npctrl.dll") { // Silverlight | 297 } else if (filename == kSilverlightPlugin) { |
| 297 // Explanation for this quirk can be found in | 298 // Explanation for this quirk can be found in |
| 298 // WebPluginDelegateImpl::Initialize. | 299 // WebPluginDelegateImpl::Initialize. |
| 299 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; | 300 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; |
| 300 } | 301 } |
| 301 } | 302 } |
| 302 | 303 |
| 303 WebPluginDelegateImpl::~WebPluginDelegateImpl() { | 304 WebPluginDelegateImpl::~WebPluginDelegateImpl() { |
| 304 if (::IsWindow(dummy_window_for_activation_)) { | 305 if (::IsWindow(dummy_window_for_activation_)) { |
| 305 ::DestroyWindow(dummy_window_for_activation_); | 306 ::DestroyWindow(dummy_window_for_activation_); |
| 306 } | 307 } |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 GetKeyPath(key).find(L"Microsoft\\MediaPlayer\\ShimInclusionList") != | 1257 GetKeyPath(key).find(L"Microsoft\\MediaPlayer\\ShimInclusionList") != |
| 1257 std::wstring::npos) { | 1258 std::wstring::npos) { |
| 1258 static const wchar_t kChromeExeName[] = L"chrome.exe"; | 1259 static const wchar_t kChromeExeName[] = L"chrome.exe"; |
| 1259 wcsncpy_s(name, orig_size, kChromeExeName, arraysize(kChromeExeName)); | 1260 wcsncpy_s(name, orig_size, kChromeExeName, arraysize(kChromeExeName)); |
| 1260 *name_size = | 1261 *name_size = |
| 1261 std::min(orig_size, static_cast<DWORD>(arraysize(kChromeExeName))); | 1262 std::min(orig_size, static_cast<DWORD>(arraysize(kChromeExeName))); |
| 1262 } | 1263 } |
| 1263 | 1264 |
| 1264 return rv; | 1265 return rv; |
| 1265 } | 1266 } |
| OLD | NEW |