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

Side by Side Diff: webkit/plugins/npapi/webplugin_delegate_impl_win.cc

Issue 6373010: Allow multiple instances of the newer VLC plugins to load. The older versions... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 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 | no next file » | 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) 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/plugins/npapi/webplugin_delegate_impl.h" 5 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 result = func(key, KeyNameInformation, buffer.get(), size, &size); 175 result = func(key, KeyNameInformation, buffer.get(), size, &size);
176 if (result != STATUS_SUCCESS) 176 if (result != STATUS_SUCCESS)
177 return L""; 177 return L"";
178 178
179 KEY_NAME_INFORMATION* info = 179 KEY_NAME_INFORMATION* info =
180 reinterpret_cast<KEY_NAME_INFORMATION*>(buffer.get()); 180 reinterpret_cast<KEY_NAME_INFORMATION*>(buffer.get());
181 return std::wstring(info->Name, info->NameLength / sizeof(wchar_t)); 181 return std::wstring(info->Name, info->NameLength / sizeof(wchar_t));
182 } 182 }
183 183
184 int GetPluginMajorVersion(const WebPluginInfo& plugin_info) {
185 int major_version = 0;
jam 2011/01/24 22:38:35 i think we want to use PluginGroup::CreateVersionF
186 std::vector<std::wstring> version;
187 base::SplitString(plugin_info.version, L'.', &version);
188 if (version.size() > 0) {
189 base::StringToInt(version[0], &major_version);
190 }
191 return major_version;
192 }
193
184 } // namespace 194 } // namespace
185 195
186 bool WebPluginDelegateImpl::IsPluginDelegateWindow(HWND window) { 196 bool WebPluginDelegateImpl::IsPluginDelegateWindow(HWND window) {
187 static const int kBufLen = 64; 197 static const int kBufLen = 64;
188 wchar_t class_name[kBufLen]; 198 wchar_t class_name[kBufLen];
189 if (!GetClassNameW(window, class_name, kBufLen)) 199 if (!GetClassNameW(window, class_name, kBufLen))
190 return false; 200 return false;
191 return wcscmp(class_name, kNativeWindowClassName) == 0; 201 return wcscmp(class_name, kNativeWindowClassName) == 0;
192 } 202 }
193 203
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 filename == kFlashPlugin) { 293 filename == kFlashPlugin) {
284 // Flash only requests windowless plugins if we return a Mozilla user 294 // Flash only requests windowless plugins if we return a Mozilla user
285 // agent. 295 // agent.
286 instance_->set_use_mozilla_user_agent(); 296 instance_->set_use_mozilla_user_agent();
287 quirks_ |= PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE; 297 quirks_ |= PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE;
288 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; 298 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR;
289 quirks_ |= PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS; 299 quirks_ |= PLUGIN_QUIRK_ALWAYS_NOTIFY_SUCCESS;
290 quirks_ |= PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE; 300 quirks_ |= PLUGIN_QUIRK_HANDLE_MOUSE_CAPTURE;
291 } else if (filename == kAcrobatReaderPlugin) { 301 } else if (filename == kAcrobatReaderPlugin) {
292 // Check for the version number above or equal 9. 302 // Check for the version number above or equal 9.
293 std::vector<std::wstring> version; 303 int major_version = GetPluginMajorVersion(plugin_info);
294 base::SplitString(plugin_info.version, L'.', &version); 304 if (major_version >= 9) {
295 if (version.size() > 0) { 305 quirks_ |= PLUGIN_QUIRK_DIE_AFTER_UNLOAD;
296 int major; 306 // 9.2 needs this.
297 base::StringToInt(version[0], &major); 307 quirks_ |= PLUGIN_QUIRK_SETWINDOW_TWICE;
298 if (major >= 9) {
299 quirks_ |= PLUGIN_QUIRK_DIE_AFTER_UNLOAD;
300
301 // 9.2 needs this.
302 quirks_ |= PLUGIN_QUIRK_SETWINDOW_TWICE;
303 }
304 } 308 }
305 quirks_ |= PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS; 309 quirks_ |= PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS;
306 } else if (plugin_info.name.find(L"Windows Media Player") != 310 } else if (plugin_info.name.find(L"Windows Media Player") !=
307 std::wstring::npos) { 311 std::wstring::npos) {
308 // Windows Media Player needs two NPP_SetWindow calls. 312 // Windows Media Player needs two NPP_SetWindow calls.
309 quirks_ |= PLUGIN_QUIRK_SETWINDOW_TWICE; 313 quirks_ |= PLUGIN_QUIRK_SETWINDOW_TWICE;
310 314
311 // Windowless mode doesn't work in the WMP NPAPI plugin. 315 // Windowless mode doesn't work in the WMP NPAPI plugin.
312 quirks_ |= PLUGIN_QUIRK_NO_WINDOWLESS; 316 quirks_ |= PLUGIN_QUIRK_NO_WINDOWLESS;
313 317
314 // The media player plugin sets its size on the first NPP_SetWindow call 318 // The media player plugin sets its size on the first NPP_SetWindow call
315 // and never updates its size. We should call the underlying NPP_SetWindow 319 // and never updates its size. We should call the underlying NPP_SetWindow
316 // only when we have the correct size. 320 // only when we have the correct size.
317 quirks_ |= PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL; 321 quirks_ |= PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL;
318 322
319 if (filename == kOldWMPPlugin) { 323 if (filename == kOldWMPPlugin) {
320 // Non-admin users on XP couldn't modify the key to force the new UI. 324 // Non-admin users on XP couldn't modify the key to force the new UI.
321 quirks_ |= PLUGIN_QUIRK_PATCH_REGENUMKEYEXW; 325 quirks_ |= PLUGIN_QUIRK_PATCH_REGENUMKEYEXW;
322 } 326 }
323 } else if (instance_->mime_type() == "audio/x-pn-realaudio-plugin" || 327 } else if (instance_->mime_type() == "audio/x-pn-realaudio-plugin" ||
324 filename == kRealPlayerPlugin) { 328 filename == kRealPlayerPlugin) {
325 quirks_ |= PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY; 329 quirks_ |= PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY;
326 } else if (plugin_info.name.find(L"VLC Multimedia Plugin") != 330 } else if (plugin_info.name.find(L"VLC Multimedia Plugin") !=
327 std::wstring::npos || 331 std::wstring::npos ||
328 plugin_info.name.find(L"VLC Multimedia Plug-in") != 332 plugin_info.name.find(L"VLC Multimedia Plug-in") !=
329 std::wstring::npos) { 333 std::wstring::npos) {
330 // VLC hangs on NPP_Destroy if we call NPP_SetWindow with a null window 334 // VLC hangs on NPP_Destroy if we call NPP_SetWindow with a null window
331 // handle 335 // handle
332 quirks_ |= PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY; 336 quirks_ |= PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY;
333 // VLC 0.8.6d and 0.8.6e crash if multiple instances are created. 337 int major_version = GetPluginMajorVersion(plugin_info);
334 quirks_ |= PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES; 338 if (major_version == 0) {
339 // VLC 0.8.6d and 0.8.6e crash if multiple instances are created.
340 quirks_ |= PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES;
341 }
335 } else if (filename == kSilverlightPlugin) { 342 } else if (filename == kSilverlightPlugin) {
336 // Explanation for this quirk can be found in 343 // Explanation for this quirk can be found in
337 // WebPluginDelegateImpl::Initialize. 344 // WebPluginDelegateImpl::Initialize.
338 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR; 345 quirks_ |= PLUGIN_QUIRK_PATCH_SETCURSOR;
339 } else if (plugin_info.name.find(L"DivX Web Player") != 346 } else if (plugin_info.name.find(L"DivX Web Player") !=
340 std::wstring::npos) { 347 std::wstring::npos) {
341 // The divx plugin sets its size on the first NPP_SetWindow call and never 348 // The divx plugin sets its size on the first NPP_SetWindow call and never
342 // updates its size. We should call the underlying NPP_SetWindow only when 349 // updates its size. We should call the underlying NPP_SetWindow only when
343 // we have the correct size. 350 // we have the correct size.
344 quirks_ |= PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL; 351 quirks_ |= PLUGIN_QUIRK_IGNORE_FIRST_SETWINDOW_CALL;
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 ::ReleaseCapture(); 1412 ::ReleaseCapture();
1406 break; 1413 break;
1407 1414
1408 default: 1415 default:
1409 break; 1416 break;
1410 } 1417 }
1411 } 1418 }
1412 1419
1413 } // namespace npapi 1420 } // namespace npapi
1414 } // namespace webkit 1421 } // namespace webkit
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698