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 // 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 return err; | 695 return err; |
696 } | 696 } |
697 return NPERR_GENERIC_ERROR; | 697 return NPERR_GENERIC_ERROR; |
698 } | 698 } |
699 | 699 |
700 static NPError DestroyRenderContext(NPP id, | 700 static NPError DestroyRenderContext(NPP id, |
701 NPRenderContext* context) { | 701 NPRenderContext* context) { |
702 // TODO(sehr) implement render context destruction. | 702 // TODO(sehr) implement render context destruction. |
703 return NPERR_GENERIC_ERROR; | 703 return NPERR_GENERIC_ERROR; |
704 } | 704 } |
| 705 |
| 706 static NPError OpenFileInSandbox(NPP id, const char* file_name, void** handle) { |
| 707 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 708 if (!plugin) |
| 709 return NPERR_GENERIC_ERROR; |
| 710 webkit_glue::WebPluginDelegate* delegate = plugin->webplugin()->delegate(); |
| 711 return delegate->OpenFileInSandbox(file_name, handle); |
| 712 } |
705 #endif // defined(PEPPER_APIS_ENABLED) | 713 #endif // defined(PEPPER_APIS_ENABLED) |
706 | 714 |
707 NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) { | 715 NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) { |
708 // Allows the plugin to query the browser for information | 716 // Allows the plugin to query the browser for information |
709 // | 717 // |
710 // Variables: | 718 // Variables: |
711 // NPNVxDisplay (unix only) | 719 // NPNVxDisplay (unix only) |
712 // NPNVxtAppContext (unix only) | 720 // NPNVxtAppContext (unix only) |
713 // NPNVnetscapeWindow (win only) - Gets the native window on which the | 721 // NPNVnetscapeWindow (win only) - Gets the native window on which the |
714 // plug-in drawing occurs, returns HWND | 722 // plug-in drawing occurs, returns HWND |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 rv = NPERR_NO_ERROR; | 863 rv = NPERR_NO_ERROR; |
856 break; | 864 break; |
857 } | 865 } |
858 #endif | 866 #endif |
859 #if defined(PEPPER_APIS_ENABLED) | 867 #if defined(PEPPER_APIS_ENABLED) |
860 case NPNVPepperExtensions: | 868 case NPNVPepperExtensions: |
861 { | 869 { |
862 static const NPPepperExtensions kExtensions = { | 870 static const NPPepperExtensions kExtensions = { |
863 InitializeRenderContext, | 871 InitializeRenderContext, |
864 FlushRenderContext, | 872 FlushRenderContext, |
865 DestroyRenderContext | 873 DestroyRenderContext, |
| 874 OpenFileInSandbox, |
866 }; | 875 }; |
867 // Return a pointer to the canonical function table. | 876 // Return a pointer to the canonical function table. |
868 NPPepperExtensions* extensions = | 877 NPPepperExtensions* extensions = |
869 const_cast<NPPepperExtensions*>(&kExtensions); | 878 const_cast<NPPepperExtensions*>(&kExtensions); |
870 NPPepperExtensions** exts = reinterpret_cast<NPPepperExtensions**>(value); | 879 NPPepperExtensions** exts = reinterpret_cast<NPPepperExtensions**>(value); |
871 *exts = extensions; | 880 *exts = extensions; |
872 rv = NPERR_NO_ERROR; | 881 rv = NPERR_NO_ERROR; |
873 break; | 882 break; |
874 } | 883 } |
875 #endif // defined(PEPPER_APIS_ENABLED) | 884 #endif // defined(PEPPER_APIS_ENABLED) |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 | 1117 |
1109 return plugin->ScheduleTimer(interval, repeat, func); | 1118 return plugin->ScheduleTimer(interval, repeat, func); |
1110 } | 1119 } |
1111 | 1120 |
1112 void NPN_UnscheduleTimer(NPP id, uint32 timer_id) { | 1121 void NPN_UnscheduleTimer(NPP id, uint32 timer_id) { |
1113 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); | 1122 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
1114 if (plugin) | 1123 if (plugin) |
1115 plugin->UnscheduleTimer(timer_id); | 1124 plugin->UnscheduleTimer(timer_id); |
1116 } | 1125 } |
1117 } // extern "C" | 1126 } // extern "C" |
OLD | NEW |