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

Side by Side Diff: webkit/glue/plugins/plugin_host.cc

Issue 2885004: Linux: Blind fix for npwrapper crashes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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/glue/plugins/plugin_host.h" 5 #include "webkit/glue/plugins/plugin_host.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 // default to the Mozilla user agent if we don't have an NPP instance or 562 // default to the Mozilla user agent if we don't have an NPP instance or
563 // else Flash won't request windowless mode. 563 // else Flash won't request windowless mode.
564 bool use_mozilla_user_agent = true; 564 bool use_mozilla_user_agent = true;
565 if (id) { 565 if (id) {
566 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 566 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
567 if (plugin.get() && !plugin->use_mozilla_user_agent()) 567 if (plugin.get() && !plugin->use_mozilla_user_agent())
568 use_mozilla_user_agent = false; 568 use_mozilla_user_agent = false;
569 } 569 }
570 570
571 if (use_mozilla_user_agent) 571 if (use_mozilla_user_agent)
572 return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/2006 1103 Firefox/2.0a1"; 572 return "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) "
573 "Gecko/20061103 Firefox/2.0a1";
573 #elif defined(OS_MACOSX) 574 #elif defined(OS_MACOSX)
574 // Silverlight 4 doesn't handle events correctly unless we claim to be Safari. 575 // Silverlight 4 doesn't handle events correctly unless we claim to be Safari.
575 scoped_refptr<NPAPI::PluginInstance> plugin; 576 scoped_refptr<NPAPI::PluginInstance> plugin;
576 if (id) 577 if (id)
577 plugin = FindInstance(id); 578 plugin = FindInstance(id);
578 if (plugin.get()) { 579 if (plugin.get()) {
579 WebPluginInfo plugin_info = plugin->plugin_lib()->plugin_info(); 580 WebPluginInfo plugin_info = plugin->plugin_lib()->plugin_info();
580 if (plugin_info.name == ASCIIToUTF16("Silverlight Plug-In") && 581 if (plugin_info.name == ASCIIToUTF16("Silverlight Plug-In") &&
581 StartsWith(plugin_info.version, ASCIIToUTF16("4."), false)) { 582 StartsWith(plugin_info.version, ASCIIToUTF16("4."), false)) {
582 return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) " 583 return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) "
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 *v = np_object; 699 *v = np_object;
699 rv = NPERR_NO_ERROR; 700 rv = NPERR_NO_ERROR;
700 } else { 701 } else {
701 NOTREACHED(); 702 NOTREACHED();
702 } 703 }
703 break; 704 break;
704 } 705 }
705 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins. 706 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins.
706 case NPNVnetscapeWindow: { 707 case NPNVnetscapeWindow: {
707 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 708 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
709 if (!plugin.get()) {
710 NOTREACHED();
711 return NPERR_GENERIC_ERROR;
712 }
708 gfx::PluginWindowHandle handle = plugin->window_handle(); 713 gfx::PluginWindowHandle handle = plugin->window_handle();
709 *((void**)value) = (void*)handle; 714 *((void**)value) = (void*)handle;
710 rv = NPERR_NO_ERROR; 715 rv = NPERR_NO_ERROR;
711 break; 716 break;
712 } 717 }
713 #endif 718 #endif
714 case NPNVjavascriptEnabledBool: { 719 case NPNVjavascriptEnabledBool: {
715 // yes, JS is enabled. 720 // yes, JS is enabled.
716 *((void**)value) = (void*)1; 721 *((void**)value) = (void*)1;
717 rv = NPERR_NO_ERROR; 722 rv = NPERR_NO_ERROR;
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 1079 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
1075 if (plugin.get()) { 1080 if (plugin.get()) {
1076 return plugin->ConvertPoint(sourceX, sourceY, sourceSpace, 1081 return plugin->ConvertPoint(sourceX, sourceY, sourceSpace,
1077 destX, destY, destSpace); 1082 destX, destY, destSpace);
1078 } 1083 }
1079 NOTREACHED(); 1084 NOTREACHED();
1080 return false; 1085 return false;
1081 } 1086 }
1082 1087
1083 } // extern "C" 1088 } // extern "C"
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