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

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

Issue 16155009: Update webkit/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « webkit/glue/weburlloader_impl.cc ('k') | webkit/plugins/npapi/plugin_instance.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/plugin_host.h" 5 #include "webkit/plugins/npapi/plugin_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 PluginHost::~PluginHost() { 83 PluginHost::~PluginHost() {
84 } 84 }
85 85
86 PluginHost *PluginHost::Singleton() { 86 PluginHost *PluginHost::Singleton() {
87 CR_DEFINE_STATIC_LOCAL(scoped_refptr<PluginHost>, singleton, ()); 87 CR_DEFINE_STATIC_LOCAL(scoped_refptr<PluginHost>, singleton, ());
88 if (singleton.get() == NULL) { 88 if (singleton.get() == NULL) {
89 singleton = new PluginHost(); 89 singleton = new PluginHost();
90 } 90 }
91 91
92 DCHECK(singleton.get() != NULL); 92 DCHECK(singleton.get() != NULL);
93 return singleton; 93 return singleton.get();
94 } 94 }
95 95
96 void PluginHost::InitializeHostFuncs() { 96 void PluginHost::InitializeHostFuncs() {
97 memset(&host_funcs_, 0, sizeof(host_funcs_)); 97 memset(&host_funcs_, 0, sizeof(host_funcs_));
98 host_funcs_.size = sizeof(host_funcs_); 98 host_funcs_.size = sizeof(host_funcs_);
99 host_funcs_.version = (NP_VERSION_MAJOR << 8) | (NP_VERSION_MINOR); 99 host_funcs_.version = (NP_VERSION_MAJOR << 8) | (NP_VERSION_MINOR);
100 100
101 // The "basic" functions 101 // The "basic" functions
102 host_funcs_.geturl = &NPN_GetURL; 102 host_funcs_.geturl = &NPN_GetURL;
103 host_funcs_.posturl = &NPN_PostURL; 103 host_funcs_.posturl = &NPN_PostURL;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 WebKit::resetPluginCache(reload_pages ? true : false); 337 WebKit::resetPluginCache(reload_pages ? true : false);
338 } 338 }
339 339
340 // Requests a range of bytes for a seekable stream. 340 // Requests a range of bytes for a seekable stream.
341 NPError NPN_RequestRead(NPStream* stream, NPByteRange* range_list) { 341 NPError NPN_RequestRead(NPStream* stream, NPByteRange* range_list) {
342 if (!stream || !range_list) 342 if (!stream || !range_list)
343 return NPERR_GENERIC_ERROR; 343 return NPERR_GENERIC_ERROR;
344 344
345 scoped_refptr<PluginInstance> plugin( 345 scoped_refptr<PluginInstance> plugin(
346 reinterpret_cast<PluginInstance*>(stream->ndata)); 346 reinterpret_cast<PluginInstance*>(stream->ndata));
347 if (!plugin) 347 if (!plugin.get())
348 return NPERR_GENERIC_ERROR; 348 return NPERR_GENERIC_ERROR;
349 349
350 plugin->RequestRead(stream, range_list); 350 plugin->RequestRead(stream, range_list);
351 return NPERR_NO_ERROR; 351 return NPERR_NO_ERROR;
352 } 352 }
353 353
354 // Generic form of GetURL for common code between GetURL and GetURLNotify. 354 // Generic form of GetURL for common code between GetURL and GetURLNotify.
355 static NPError GetURLNotify(NPP id, 355 static NPError GetURLNotify(NPP id,
356 const char* url, 356 const char* url,
357 const char* target, 357 const char* target,
358 bool notify, 358 bool notify,
359 void* notify_data) { 359 void* notify_data) {
360 if (!url) 360 if (!url)
361 return NPERR_INVALID_URL; 361 return NPERR_INVALID_URL;
362 362
363 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 363 scoped_refptr<PluginInstance> plugin(FindInstance(id));
364 if (!plugin) { 364 if (!plugin.get()) {
365 return NPERR_GENERIC_ERROR; 365 return NPERR_GENERIC_ERROR;
366 } 366 }
367 367
368 plugin->RequestURL(url, "GET", target, NULL, 0, notify, notify_data); 368 plugin->RequestURL(url, "GET", target, NULL, 0, notify, notify_data);
369 return NPERR_NO_ERROR; 369 return NPERR_NO_ERROR;
370 } 370 }
371 371
372 // Requests creation of a new stream with the contents of the 372 // Requests creation of a new stream with the contents of the
373 // specified URL; gets notification of the result. 373 // specified URL; gets notification of the result.
374 NPError NPN_GetURLNotify(NPP id, 374 NPError NPN_GetURLNotify(NPP id,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 const char* target, 418 const char* target,
419 uint32_t len, 419 uint32_t len,
420 const char* buf, 420 const char* buf,
421 NPBool file, 421 NPBool file,
422 bool notify, 422 bool notify,
423 void* notify_data) { 423 void* notify_data) {
424 if (!url) 424 if (!url)
425 return NPERR_INVALID_URL; 425 return NPERR_INVALID_URL;
426 426
427 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 427 scoped_refptr<PluginInstance> plugin(FindInstance(id));
428 if (!plugin) { 428 if (!plugin.get()) {
429 NOTREACHED(); 429 NOTREACHED();
430 return NPERR_GENERIC_ERROR; 430 return NPERR_GENERIC_ERROR;
431 } 431 }
432 432
433 std::string post_file_contents; 433 std::string post_file_contents;
434 434
435 if (file) { 435 if (file) {
436 // Post data to be uploaded from a file. This can be handled in two 436 // Post data to be uploaded from a file. This can be handled in two
437 // ways. 437 // ways.
438 // 1. Read entire file and send the contents as if it was a post data 438 // 1. Read entire file and send the contents as if it was a post data
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 // plug-in drawing occurs, returns HWND 676 // plug-in drawing occurs, returns HWND
677 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled 677 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled
678 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled 678 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled
679 // NPNVOfflineBool: tells whether offline-mode is enabled 679 // NPNVOfflineBool: tells whether offline-mode is enabled
680 680
681 NPError rv = NPERR_GENERIC_ERROR; 681 NPError rv = NPERR_GENERIC_ERROR;
682 682
683 switch (static_cast<int>(variable)) { 683 switch (static_cast<int>(variable)) {
684 case NPNVWindowNPObject: { 684 case NPNVWindowNPObject: {
685 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 685 scoped_refptr<PluginInstance> plugin(FindInstance(id));
686 if (!plugin) { 686 if (!plugin.get()) {
687 NOTREACHED(); 687 NOTREACHED();
688 return NPERR_INVALID_INSTANCE_ERROR; 688 return NPERR_INVALID_INSTANCE_ERROR;
689 } 689 }
690 NPObject *np_object = plugin->webplugin()->GetWindowScriptNPObject(); 690 NPObject *np_object = plugin->webplugin()->GetWindowScriptNPObject();
691 // Return value is expected to be retained, as 691 // Return value is expected to be retained, as
692 // described here: 692 // described here:
693 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess> 693 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess>
694 if (np_object) { 694 if (np_object) {
695 WebBindings::retainObject(np_object); 695 WebBindings::retainObject(np_object);
696 void **v = (void **)value; 696 void **v = (void **)value;
697 *v = np_object; 697 *v = np_object;
698 rv = NPERR_NO_ERROR; 698 rv = NPERR_NO_ERROR;
699 } else { 699 } else {
700 NOTREACHED(); 700 NOTREACHED();
701 } 701 }
702 break; 702 break;
703 } 703 }
704 case NPNVPluginElementNPObject: { 704 case NPNVPluginElementNPObject: {
705 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 705 scoped_refptr<PluginInstance> plugin(FindInstance(id));
706 if (!plugin) { 706 if (!plugin.get()) {
707 NOTREACHED(); 707 NOTREACHED();
708 return NPERR_INVALID_INSTANCE_ERROR; 708 return NPERR_INVALID_INSTANCE_ERROR;
709 } 709 }
710 NPObject *np_object = plugin->webplugin()->GetPluginElement(); 710 NPObject *np_object = plugin->webplugin()->GetPluginElement();
711 // Return value is expected to be retained, as 711 // Return value is expected to be retained, as
712 // described here: 712 // described here:
713 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess> 713 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess>
714 if (np_object) { 714 if (np_object) {
715 WebBindings::retainObject(np_object); 715 WebBindings::retainObject(np_object);
716 void** v = static_cast<void**>(value); 716 void** v = static_cast<void**>(value);
717 *v = np_object; 717 *v = np_object;
718 rv = NPERR_NO_ERROR; 718 rv = NPERR_NO_ERROR;
719 } else { 719 } else {
720 NOTREACHED(); 720 NOTREACHED();
721 } 721 }
722 break; 722 break;
723 } 723 }
724 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins. 724 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins.
725 case NPNVnetscapeWindow: { 725 case NPNVnetscapeWindow: {
726 scoped_refptr<PluginInstance> plugin = FindInstance(id); 726 scoped_refptr<PluginInstance> plugin = FindInstance(id);
727 if (!plugin) { 727 if (!plugin.get()) {
728 NOTREACHED(); 728 NOTREACHED();
729 return NPERR_INVALID_INSTANCE_ERROR; 729 return NPERR_INVALID_INSTANCE_ERROR;
730 } 730 }
731 gfx::PluginWindowHandle handle = plugin->window_handle(); 731 gfx::PluginWindowHandle handle = plugin->window_handle();
732 *((void**)value) = (void*)handle; 732 *((void**)value) = (void*)handle;
733 rv = NPERR_NO_ERROR; 733 rv = NPERR_NO_ERROR;
734 break; 734 break;
735 } 735 }
736 #endif 736 #endif
737 case NPNVjavascriptEnabledBool: { 737 case NPNVjavascriptEnabledBool: {
(...skipping 16 matching lines...) Expand all
754 #endif 754 #endif
755 case NPNVSupportsWindowless: { 755 case NPNVSupportsWindowless: {
756 NPBool* supports_windowless = reinterpret_cast<NPBool*>(value); 756 NPBool* supports_windowless = reinterpret_cast<NPBool*>(value);
757 *supports_windowless = true; 757 *supports_windowless = true;
758 rv = NPERR_NO_ERROR; 758 rv = NPERR_NO_ERROR;
759 break; 759 break;
760 } 760 }
761 case NPNVprivateModeBool: { 761 case NPNVprivateModeBool: {
762 NPBool* private_mode = reinterpret_cast<NPBool*>(value); 762 NPBool* private_mode = reinterpret_cast<NPBool*>(value);
763 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 763 scoped_refptr<PluginInstance> plugin(FindInstance(id));
764 if (!plugin) { 764 if (!plugin.get()) {
765 NOTREACHED(); 765 NOTREACHED();
766 return NPERR_INVALID_INSTANCE_ERROR; 766 return NPERR_INVALID_INSTANCE_ERROR;
767 } 767 }
768 *private_mode = plugin->webplugin()->IsOffTheRecord(); 768 *private_mode = plugin->webplugin()->IsOffTheRecord();
769 rv = NPERR_NO_ERROR; 769 rv = NPERR_NO_ERROR;
770 break; 770 break;
771 } 771 }
772 #if defined(OS_MACOSX) 772 #if defined(OS_MACOSX)
773 case NPNVpluginDrawingModel: { 773 case NPNVpluginDrawingModel: {
774 // return the drawing model that was negotiated when we initialized. 774 // return the drawing model that was negotiated when we initialized.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 DVLOG(1) << "NPN_GetValue(" << variable << ") is not implemented yet."; 829 DVLOG(1) << "NPN_GetValue(" << variable << ") is not implemented yet.";
830 break; 830 break;
831 } 831 }
832 return rv; 832 return rv;
833 } 833 }
834 834
835 NPError NPN_SetValue(NPP id, NPPVariable variable, void* value) { 835 NPError NPN_SetValue(NPP id, NPPVariable variable, void* value) {
836 // Allows the plugin to set various modes 836 // Allows the plugin to set various modes
837 837
838 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 838 scoped_refptr<PluginInstance> plugin(FindInstance(id));
839 if (!plugin) { 839 if (!plugin.get()) {
840 NOTREACHED(); 840 NOTREACHED();
841 return NPERR_INVALID_INSTANCE_ERROR; 841 return NPERR_INVALID_INSTANCE_ERROR;
842 } 842 }
843 switch(variable) { 843 switch(variable) {
844 case NPPVpluginWindowBool: { 844 case NPPVpluginWindowBool: {
845 // Sets windowless mode for display of the plugin 845 // Sets windowless mode for display of the plugin
846 // Note: the documentation at 846 // Note: the documentation at
847 // http://developer.mozilla.org/en/docs/NPN_SetValue is wrong. When 847 // http://developer.mozilla.org/en/docs/NPN_SetValue is wrong. When
848 // value is NULL, the mode is set to true. This is the same way Mozilla 848 // value is NULL, the mode is set to true. This is the same way Mozilla
849 // works. 849 // works.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 } 913 }
914 914
915 void* NPN_GetJavaPeer(NPP) { 915 void* NPN_GetJavaPeer(NPP) {
916 // TODO: implement me 916 // TODO: implement me
917 DVLOG(1) << "NPN_GetJavaPeer is not implemented."; 917 DVLOG(1) << "NPN_GetJavaPeer is not implemented.";
918 return NULL; 918 return NULL;
919 } 919 }
920 920
921 void NPN_PushPopupsEnabledState(NPP id, NPBool enabled) { 921 void NPN_PushPopupsEnabledState(NPP id, NPBool enabled) {
922 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 922 scoped_refptr<PluginInstance> plugin(FindInstance(id));
923 if (plugin) 923 if (plugin.get())
924 plugin->PushPopupsEnabledState(enabled ? true : false); 924 plugin->PushPopupsEnabledState(enabled ? true : false);
925 } 925 }
926 926
927 void NPN_PopPopupsEnabledState(NPP id) { 927 void NPN_PopPopupsEnabledState(NPP id) {
928 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 928 scoped_refptr<PluginInstance> plugin(FindInstance(id));
929 if (plugin) 929 if (plugin.get())
930 plugin->PopPopupsEnabledState(); 930 plugin->PopPopupsEnabledState();
931 } 931 }
932 932
933 void NPN_PluginThreadAsyncCall(NPP id, 933 void NPN_PluginThreadAsyncCall(NPP id,
934 void (*func)(void*), 934 void (*func)(void*),
935 void* user_data) { 935 void* user_data) {
936 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 936 scoped_refptr<PluginInstance> plugin(FindInstance(id));
937 if (plugin) 937 if (plugin.get())
938 plugin->PluginThreadAsyncCall(func, user_data); 938 plugin->PluginThreadAsyncCall(func, user_data);
939 } 939 }
940 940
941 NPError NPN_GetValueForURL(NPP id, 941 NPError NPN_GetValueForURL(NPP id,
942 NPNURLVariable variable, 942 NPNURLVariable variable,
943 const char* url, 943 const char* url,
944 char** value, 944 char** value,
945 uint32_t* len) { 945 uint32_t* len) {
946 if (!id) 946 if (!id)
947 return NPERR_INVALID_PARAM; 947 return NPERR_INVALID_PARAM;
948 948
949 if (!url || !*url || !len) 949 if (!url || !*url || !len)
950 return NPERR_INVALID_URL; 950 return NPERR_INVALID_URL;
951 951
952 *len = 0; 952 *len = 0;
953 std::string result; 953 std::string result;
954 954
955 switch (variable) { 955 switch (variable) {
956 case NPNURLVProxy: { 956 case NPNURLVProxy: {
957 result = "DIRECT"; 957 result = "DIRECT";
958 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 958 scoped_refptr<PluginInstance> plugin(FindInstance(id));
959 if (!plugin) 959 if (!plugin.get())
960 return NPERR_GENERIC_ERROR; 960 return NPERR_GENERIC_ERROR;
961 961
962 WebPlugin* webplugin = plugin->webplugin(); 962 WebPlugin* webplugin = plugin->webplugin();
963 if (!webplugin) 963 if (!webplugin)
964 return NPERR_GENERIC_ERROR; 964 return NPERR_GENERIC_ERROR;
965 965
966 if (!webplugin->FindProxyForUrl(GURL(std::string(url)), &result)) 966 if (!webplugin->FindProxyForUrl(GURL(std::string(url)), &result))
967 return NPERR_GENERIC_ERROR; 967 return NPERR_GENERIC_ERROR;
968 break; 968 break;
969 } 969 }
970 case NPNURLVCookie: { 970 case NPNURLVCookie: {
971 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 971 scoped_refptr<PluginInstance> plugin(FindInstance(id));
972 if (!plugin) 972 if (!plugin.get())
973 return NPERR_GENERIC_ERROR; 973 return NPERR_GENERIC_ERROR;
974 974
975 WebPlugin* webplugin = plugin->webplugin(); 975 WebPlugin* webplugin = plugin->webplugin();
976 if (!webplugin) 976 if (!webplugin)
977 return NPERR_GENERIC_ERROR; 977 return NPERR_GENERIC_ERROR;
978 978
979 // Bypass third-party cookie blocking by using the url as the 979 // Bypass third-party cookie blocking by using the url as the
980 // first_party_for_cookies. 980 // first_party_for_cookies.
981 GURL cookies_url((std::string(url))); 981 GURL cookies_url((std::string(url)));
982 result = webplugin->GetCookies(cookies_url, cookies_url); 982 result = webplugin->GetCookies(cookies_url, cookies_url);
(...skipping 19 matching lines...) Expand all
1002 uint32_t len) { 1002 uint32_t len) {
1003 if (!id) 1003 if (!id)
1004 return NPERR_INVALID_PARAM; 1004 return NPERR_INVALID_PARAM;
1005 1005
1006 if (!url || !*url) 1006 if (!url || !*url)
1007 return NPERR_INVALID_URL; 1007 return NPERR_INVALID_URL;
1008 1008
1009 switch (variable) { 1009 switch (variable) {
1010 case NPNURLVCookie: { 1010 case NPNURLVCookie: {
1011 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 1011 scoped_refptr<PluginInstance> plugin(FindInstance(id));
1012 if (!plugin) 1012 if (!plugin.get())
1013 return NPERR_GENERIC_ERROR; 1013 return NPERR_GENERIC_ERROR;
1014 1014
1015 WebPlugin* webplugin = plugin->webplugin(); 1015 WebPlugin* webplugin = plugin->webplugin();
1016 if (!webplugin) 1016 if (!webplugin)
1017 return NPERR_GENERIC_ERROR; 1017 return NPERR_GENERIC_ERROR;
1018 1018
1019 std::string cookie(value, len); 1019 std::string cookie(value, len);
1020 GURL cookies_url((std::string(url))); 1020 GURL cookies_url((std::string(url)));
1021 webplugin->SetCookie(cookies_url, cookies_url, cookie); 1021 webplugin->SetCookie(cookies_url, cookies_url, cookie);
1022 return NPERR_NO_ERROR; 1022 return NPERR_NO_ERROR;
(...skipping 25 matching lines...) Expand all
1048 1048
1049 // TODO: implement me (bug 23928) 1049 // TODO: implement me (bug 23928)
1050 return NPERR_GENERIC_ERROR; 1050 return NPERR_GENERIC_ERROR;
1051 } 1051 }
1052 1052
1053 uint32_t NPN_ScheduleTimer(NPP id, 1053 uint32_t NPN_ScheduleTimer(NPP id,
1054 uint32_t interval, 1054 uint32_t interval,
1055 NPBool repeat, 1055 NPBool repeat,
1056 void (*func)(NPP id, uint32_t timer_id)) { 1056 void (*func)(NPP id, uint32_t timer_id)) {
1057 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 1057 scoped_refptr<PluginInstance> plugin(FindInstance(id));
1058 if (!plugin) 1058 if (!plugin.get())
1059 return 0; 1059 return 0;
1060 1060
1061 return plugin->ScheduleTimer(interval, repeat, func); 1061 return plugin->ScheduleTimer(interval, repeat, func);
1062 } 1062 }
1063 1063
1064 void NPN_UnscheduleTimer(NPP id, uint32_t timer_id) { 1064 void NPN_UnscheduleTimer(NPP id, uint32_t timer_id) {
1065 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 1065 scoped_refptr<PluginInstance> plugin(FindInstance(id));
1066 if (plugin) 1066 if (plugin.get())
1067 plugin->UnscheduleTimer(timer_id); 1067 plugin->UnscheduleTimer(timer_id);
1068 } 1068 }
1069 1069
1070 NPError NPN_PopUpContextMenu(NPP id, NPMenu* menu) { 1070 NPError NPN_PopUpContextMenu(NPP id, NPMenu* menu) {
1071 if (!menu) 1071 if (!menu)
1072 return NPERR_INVALID_PARAM; 1072 return NPERR_INVALID_PARAM;
1073 1073
1074 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 1074 scoped_refptr<PluginInstance> plugin(FindInstance(id));
1075 if (plugin) { 1075 if (plugin.get()) {
1076 return plugin->PopUpContextMenu(menu); 1076 return plugin->PopUpContextMenu(menu);
1077 } 1077 }
1078 NOTREACHED(); 1078 NOTREACHED();
1079 return NPERR_GENERIC_ERROR; 1079 return NPERR_GENERIC_ERROR;
1080 } 1080 }
1081 1081
1082 NPBool NPN_ConvertPoint(NPP id, double sourceX, double sourceY, 1082 NPBool NPN_ConvertPoint(NPP id, double sourceX, double sourceY,
1083 NPCoordinateSpace sourceSpace, 1083 NPCoordinateSpace sourceSpace,
1084 double *destX, double *destY, 1084 double *destX, double *destY,
1085 NPCoordinateSpace destSpace) { 1085 NPCoordinateSpace destSpace) {
1086 scoped_refptr<PluginInstance> plugin(FindInstance(id)); 1086 scoped_refptr<PluginInstance> plugin(FindInstance(id));
1087 if (plugin) { 1087 if (plugin.get()) {
1088 return plugin->ConvertPoint(sourceX, sourceY, sourceSpace, 1088 return plugin->ConvertPoint(
1089 destX, destY, destSpace); 1089 sourceX, sourceY, sourceSpace, destX, destY, destSpace);
1090 } 1090 }
1091 NOTREACHED(); 1091 NOTREACHED();
1092 return false; 1092 return false;
1093 } 1093 }
1094 1094
1095 NPBool NPN_HandleEvent(NPP id, void *event, NPBool handled) { 1095 NPBool NPN_HandleEvent(NPP id, void *event, NPBool handled) {
1096 // TODO: Implement advanced key handling: http://crbug.com/46578 1096 // TODO: Implement advanced key handling: http://crbug.com/46578
1097 NOTIMPLEMENTED(); 1097 NOTIMPLEMENTED();
1098 return false; 1098 return false;
1099 } 1099 }
1100 1100
1101 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { 1101 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) {
1102 // TODO: Implement advanced key handling: http://crbug.com/46578 1102 // TODO: Implement advanced key handling: http://crbug.com/46578
1103 NOTIMPLEMENTED(); 1103 NOTIMPLEMENTED();
1104 return false; 1104 return false;
1105 } 1105 }
1106 1106
1107 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { 1107 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) {
1108 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); 1108 scoped_refptr<PluginInstance> plugin(FindInstance(instance));
1109 if (plugin) { 1109 if (plugin.get()) {
1110 plugin->URLRedirectResponse(!!allow, notify_data); 1110 plugin->URLRedirectResponse(!!allow, notify_data);
1111 } 1111 }
1112 } 1112 }
1113 1113
1114 } // extern "C" 1114 } // extern "C"
OLDNEW
« no previous file with comments | « webkit/glue/weburlloader_impl.cc ('k') | webkit/plugins/npapi/plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698