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

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

Issue 291001: Moved Pepper delegate definition to chrome\renderer to allow it to use... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 | « third_party/npapi/bindings/npapi.h ('k') | webkit/glue/plugins/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) 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"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/string_piece.h" 13 #include "base/string_piece.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/sys_string_conversions.h" 15 #include "base/sys_string_conversions.h"
16 #include "net/base/net_util.h" 16 #include "net/base/net_util.h"
17 #include "webkit/api/public/WebBindings.h" 17 #include "webkit/api/public/WebBindings.h"
18 #include "webkit/default_plugin/default_plugin_shared.h" 18 #include "webkit/default_plugin/default_plugin_shared.h"
19 #include "webkit/glue/glue_util.h" 19 #include "webkit/glue/glue_util.h"
20 #include "webkit/glue/webplugininfo.h" 20 #include "webkit/glue/webplugininfo.h"
21 #include "webkit/glue/webplugin_delegate.h"
21 #include "webkit/glue/webkit_glue.h" 22 #include "webkit/glue/webkit_glue.h"
22 #include "webkit/glue/plugins/plugin_instance.h" 23 #include "webkit/glue/plugins/plugin_instance.h"
23 #include "webkit/glue/plugins/plugin_lib.h" 24 #include "webkit/glue/plugins/plugin_lib.h"
24 #include "webkit/glue/plugins/plugin_list.h" 25 #include "webkit/glue/plugins/plugin_list.h"
25 #include "webkit/glue/plugins/plugin_stream_url.h" 26 #include "webkit/glue/plugins/plugin_stream_url.h"
26 #include "third_party/npapi/bindings/npruntime.h" 27 #include "third_party/npapi/bindings/npruntime.h"
27 28
28 using WebKit::WebBindings; 29 using WebKit::WebBindings;
29 30
30 namespace NPAPI 31 namespace NPAPI
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 661
661 NOTIMPLEMENTED(); 662 NOTIMPLEMENTED();
662 } 663 }
663 664
664 #if defined(PEPPER_APIS_ENABLED) 665 #if defined(PEPPER_APIS_ENABLED)
665 static NPError InitializeRenderContext(NPP id, 666 static NPError InitializeRenderContext(NPP id,
666 NPRenderType type, 667 NPRenderType type,
667 NPRenderContext* context) { 668 NPRenderContext* context) {
668 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 669 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
669 if (plugin) { 670 if (plugin) {
670 return plugin->InitializeRenderContext(type, context); 671 webkit_glue::WebPluginDelegate* delegate = plugin->webplugin()->delegate();
672 // Set up the renderer for the specified type.
673 return delegate->InitializeRenderContext(type, context);
671 } 674 }
672 return NPERR_GENERIC_ERROR; 675 return NPERR_GENERIC_ERROR;
673 } 676 }
674 677
675 static NPError FlushRenderContext(NPP id, 678 static NPError FlushRenderContext(NPP id,
676 NPRenderContext* context, 679 NPRenderContext* context,
677 NPFlushRenderContextCallbackPtr callback, 680 NPFlushRenderContextCallbackPtr callback,
678 void* userData) { 681 void* user_data) {
679 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 682 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
680 if (plugin) { 683 if (plugin) {
681 return plugin->FlushRenderContext(context, callback, userData); 684 webkit_glue::WebPluginDelegate* delegate = plugin->webplugin()->delegate();
685 // Do the flush.
686 NPError err = delegate->FlushRenderContext(context);
687 // Invoke the callback to inform the caller the work was done.
688 if (callback != NULL) {
689 (*callback)(context, err, user_data);
690 }
691 // Return any errors.
692 return err;
682 } 693 }
683 return NPERR_GENERIC_ERROR; 694 return NPERR_GENERIC_ERROR;
684 } 695 }
685 #endif // defined(PEPPER_APIS_ENABLED) 696 #endif // defined(PEPPER_APIS_ENABLED)
686 697
687 NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) { 698 NPError NPN_GetValue(NPP id, NPNVariable variable, void *value) {
688 // Allows the plugin to query the browser for information 699 // Allows the plugin to query the browser for information
689 // 700 //
690 // Variables: 701 // Variables:
691 // NPNVxDisplay (unix only) 702 // NPNVxDisplay (unix only)
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 979
969 void NPN_PluginThreadAsyncCall(NPP id, 980 void NPN_PluginThreadAsyncCall(NPP id,
970 void (*func)(void *), 981 void (*func)(void *),
971 void *userData) { 982 void *userData) {
972 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 983 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
973 if (plugin) { 984 if (plugin) {
974 plugin->PluginThreadAsyncCall(func, userData); 985 plugin->PluginThreadAsyncCall(func, userData);
975 } 986 }
976 } 987 }
977 988
978 #if defined(PEPPER_APIS_ENABLED)
979 NPError NPN_InitializeRenderContext(NPP id,
980 NPRenderType type,
981 NPRenderContext* context) {
982 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
983 if (plugin) {
984 return plugin->InitializeRenderContext(type, context);
985 }
986 return NPERR_GENERIC_ERROR;
987 }
988
989 NPError NPN_FlushRenderContext(NPP id,
990 NPRenderContext* context,
991 NPFlushRenderContextCallbackPtr callback,
992 void* userData) {
993 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
994 if (plugin) {
995 return plugin->FlushRenderContext(context, callback, userData);
996 }
997 return NPERR_GENERIC_ERROR;
998 }
999 #endif // defined(PEPPER_APIS_ENABLED)
1000
1001 NPError NPN_GetValueForURL(NPP id, 989 NPError NPN_GetValueForURL(NPP id,
1002 NPNURLVariable variable, 990 NPNURLVariable variable,
1003 const char *url, 991 const char *url,
1004 char **value, 992 char **value,
1005 uint32_t *len) { 993 uint32_t *len) {
1006 if (!id) 994 if (!id)
1007 return NPERR_INVALID_PARAM; 995 return NPERR_INVALID_PARAM;
1008 996
1009 if (!url || !*url || !len) 997 if (!url || !*url || !len)
1010 return NPERR_INVALID_URL; 998 return NPERR_INVALID_URL;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 uint32_t *plen) { 1084 uint32_t *plen) {
1097 if (!id || !protocol || !host || !scheme || !realm || !username || 1085 if (!id || !protocol || !host || !scheme || !realm || !username ||
1098 !ulen || !password || !plen) 1086 !ulen || !password || !plen)
1099 return NPERR_INVALID_PARAM; 1087 return NPERR_INVALID_PARAM;
1100 1088
1101 // TODO: implement me (bug 23928) 1089 // TODO: implement me (bug 23928)
1102 return NPERR_GENERIC_ERROR; 1090 return NPERR_GENERIC_ERROR;
1103 } 1091 }
1104 1092
1105 } // extern "C" 1093 } // extern "C"
OLDNEW
« no previous file with comments | « third_party/npapi/bindings/npapi.h ('k') | webkit/glue/plugins/plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698