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

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

Issue 322003: Make Pepper NPN variable return a pointer to an allocated... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 | « third_party/npapi/bindings/npapi.h ('k') | webkit/tools/pepper_test_plugin/README » ('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) 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 // Pepper API support should be turned on for this module. 5 // Pepper API support should be turned on for this module.
6 #define PEPPER_APIS_ENABLED 6 #define PEPPER_APIS_ENABLED
7 7
8 #include "webkit/glue/plugins/plugin_host.h" 8 #include "webkit/glue/plugins/plugin_host.h"
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 NPError err = delegate->FlushRenderContext(context); 688 NPError err = delegate->FlushRenderContext(context);
689 // Invoke the callback to inform the caller the work was done. 689 // Invoke the callback to inform the caller the work was done.
690 if (callback != NULL) { 690 if (callback != NULL) {
691 (*callback)(context, err, user_data); 691 (*callback)(context, err, user_data);
692 } 692 }
693 // Return any errors. 693 // Return any errors.
694 return err; 694 return err;
695 } 695 }
696 return NPERR_GENERIC_ERROR; 696 return NPERR_GENERIC_ERROR;
697 } 697 }
698
699 static NPError DestroyRenderContext(NPP id,
700 NPRenderContext* context) {
701 // TODO(sehr) implement render context destruction.
702 return NPERR_GENERIC_ERROR;
703 }
698 #endif // defined(PEPPER_APIS_ENABLED) 704 #endif // defined(PEPPER_APIS_ENABLED)
699 705
700 NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) { 706 NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) {
701 // Allows the plugin to query the browser for information 707 // Allows the plugin to query the browser for information
702 // 708 //
703 // Variables: 709 // Variables:
704 // NPNVxDisplay (unix only) 710 // NPNVxDisplay (unix only)
705 // NPNVxtAppContext (unix only) 711 // NPNVxtAppContext (unix only)
706 // NPNVnetscapeWindow (win only) - Gets the native window on which the 712 // NPNVnetscapeWindow (win only) - Gets the native window on which the
707 // plug-in drawing occurs, returns HWND 713 // plug-in drawing occurs, returns HWND
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 case NPNVsupportsCocoaBool: 849 case NPNVsupportsCocoaBool:
844 { 850 {
845 // we do not support these drawing and event models. 851 // we do not support these drawing and event models.
846 NPBool* supports_model = reinterpret_cast<NPBool*>(value); 852 NPBool* supports_model = reinterpret_cast<NPBool*>(value);
847 *supports_model = FALSE; 853 *supports_model = FALSE;
848 rv = NPERR_NO_ERROR; 854 rv = NPERR_NO_ERROR;
849 break; 855 break;
850 } 856 }
851 #endif 857 #endif
852 #if defined(PEPPER_APIS_ENABLED) 858 #if defined(PEPPER_APIS_ENABLED)
853 case NPNVInitializeRenderContextFunc: 859 case NPNVPepperExtensions:
854 { 860 {
855 NPInitializeRenderContextPtr* func = 861 static const NPPepperExtensions kExtensions = {
856 reinterpret_cast<NPInitializeRenderContextPtr*>(value); 862 InitializeRenderContext,
857 *func = InitializeRenderContext; 863 FlushRenderContext,
858 rv = NPERR_NO_ERROR; 864 DestroyRenderContext
859 break; 865 };
860 } 866 // Make a copy of the canonical function table.
brettw 2009/10/26 23:13:38 Nit: fix comment (you don't copy anymore).
861 case NPNVFlushRenderContextFunc: 867 NPPepperExtensions* extensions =
862 { 868 const_cast<NPPepperExtensions*>(&kExtensions);
863 NPFlushRenderContextPtr* func = 869 NPPepperExtensions** exts = reinterpret_cast<NPPepperExtensions**>(value);
864 reinterpret_cast<NPFlushRenderContextPtr*>(value); 870 *exts = extensions;
865 *func = FlushRenderContext;
866 rv = NPERR_NO_ERROR; 871 rv = NPERR_NO_ERROR;
867 break; 872 break;
868 } 873 }
869 #endif // defined(PEPPER_APIS_ENABLED) 874 #endif // defined(PEPPER_APIS_ENABLED)
870 default: 875 default:
871 { 876 {
872 // TODO: implement me 877 // TODO: implement me
873 DLOG(INFO) << "NPN_GetValue(" << variable << ") is not implemented yet."; 878 DLOG(INFO) << "NPN_GetValue(" << variable << ") is not implemented yet.";
874 break; 879 break;
875 } 880 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 1107
1103 return plugin->ScheduleTimer(interval, repeat, func); 1108 return plugin->ScheduleTimer(interval, repeat, func);
1104 } 1109 }
1105 1110
1106 void NPN_UnscheduleTimer(NPP id, uint32 timer_id) { 1111 void NPN_UnscheduleTimer(NPP id, uint32 timer_id) {
1107 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 1112 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
1108 if (plugin) 1113 if (plugin)
1109 plugin->UnscheduleTimer(timer_id); 1114 plugin->UnscheduleTimer(timer_id);
1110 } 1115 }
1111 } // extern "C" 1116 } // extern "C"
OLDNEW
« no previous file with comments | « third_party/npapi/bindings/npapi.h ('k') | webkit/tools/pepper_test_plugin/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698