OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef REMOTING_CLIENT_PEPPER_PEPPER_PLUGIN_H_ |
| 6 #define REMOTING_CLIENT_PEPPER_PEPPER_PLUGIN_H_ |
| 7 |
| 8 #include "third_party/npapi/bindings/npapi.h" |
| 9 #include "third_party/npapi/bindings/npapi_extensions.h" |
| 10 #include "third_party/npapi/bindings/nphostapi.h" |
| 11 |
| 12 namespace pepper { |
| 13 |
| 14 class PepperPlugin { |
| 15 public: |
| 16 // This class stores information about the plugin that cannot be instantiated |
| 17 // as part of the PepperPlugin class because it is required before the |
| 18 // PepperPlugin has been created. |
| 19 class Info { |
| 20 public: |
| 21 // True if these fields have been initialized. |
| 22 bool initialized; |
| 23 |
| 24 // MIME type and description. |
| 25 const char* mime_description; |
| 26 |
| 27 // Name of plugin (shown in about:plugins). |
| 28 const char* plugin_name; |
| 29 |
| 30 // Short description of plugin (shown in about:plugins). |
| 31 const char* plugin_description; |
| 32 }; |
| 33 |
| 34 PepperPlugin(NPNetscapeFuncs* browser_funcs, NPP instance); |
| 35 virtual ~PepperPlugin(); |
| 36 |
| 37 NPNetscapeFuncs* browser() const { return browser_funcs_; } |
| 38 NPNExtensions* extensions() const { return extensions_; } |
| 39 NPP instance() const { return instance_; } |
| 40 |
| 41 // Virtual methods to be implemented by the plugin subclass. |
| 42 |
| 43 virtual NPError New(NPMIMEType pluginType, int16 argc, |
| 44 char* argn[], char* argv[]) { |
| 45 return NPERR_GENERIC_ERROR; |
| 46 } |
| 47 |
| 48 virtual NPError Destroy(NPSavedData** save) { |
| 49 return NPERR_GENERIC_ERROR; |
| 50 } |
| 51 |
| 52 virtual NPError SetWindow(NPWindow* window) { |
| 53 return NPERR_GENERIC_ERROR; |
| 54 } |
| 55 |
| 56 virtual NPError NewStream(NPMIMEType type, NPStream* stream, |
| 57 NPBool seekable, uint16* stype) { |
| 58 return NPERR_GENERIC_ERROR; |
| 59 } |
| 60 |
| 61 virtual NPError DestroyStream(NPStream* stream, NPReason reason) { |
| 62 return NPERR_GENERIC_ERROR; |
| 63 } |
| 64 |
| 65 virtual void StreamAsFile(NPStream* stream, const char* fname) { |
| 66 } |
| 67 |
| 68 virtual int32 WriteReady(NPStream* stream) { |
| 69 return 0; |
| 70 } |
| 71 |
| 72 virtual int32 Write(NPStream* stream, int32 offset, int32 len, void* buffer) { |
| 73 return -1; |
| 74 } |
| 75 |
| 76 virtual void Print(NPPrint* platformPrint) { |
| 77 } |
| 78 |
| 79 virtual int16 HandleEvent(void* event) { |
| 80 return false; |
| 81 } |
| 82 |
| 83 virtual void URLNotify(const char* url, NPReason reason, void* nofifyData) { |
| 84 } |
| 85 |
| 86 virtual NPError GetValue(NPPVariable variable, void* value) { |
| 87 return NPERR_GENERIC_ERROR; |
| 88 } |
| 89 |
| 90 virtual NPError SetValue(NPNVariable variable, void* value) { |
| 91 return NPERR_GENERIC_ERROR; |
| 92 } |
| 93 |
| 94 private: |
| 95 // Browser callbacks. |
| 96 NPNetscapeFuncs* browser_funcs_; |
| 97 NPNExtensions* extensions_; |
| 98 |
| 99 NPP instance_; |
| 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(PepperPlugin); |
| 102 }; |
| 103 |
| 104 } // namespace pepper |
| 105 |
| 106 #endif // REMOTING_CLIENT_PEPPER_PEPPER_PLUGIN_H_ |
OLD | NEW |