Don't delete or unpack binutils and gcc: we get them from Git
[nativeclient.git] / npapi_plugin / npinstance.h
blob2fc4e28f953b4799ae89e33b851a96db80e22b40
1 /*
2 * Copyright 2008, Google Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 // NaCl-NPAPI Interface
35 #ifndef NATIVE_CLIENT_NPAPI_PLUGIN_NPINSTANCE_H_
36 #define NATIVE_CLIENT_NPAPI_PLUGIN_NPINSTANCE_H_
38 #include "native_client/tools/npapi_runtime/nacl_npapi.h"
40 namespace nacl {
42 // Pure abstract base class for the NaCl MIME type implementation classes.
43 class NPInstance {
44 public:
45 virtual ~NPInstance() {}
47 // Processes NPP_Destroy() invocation from the browser.
48 virtual NPError Destroy(NPSavedData** save) = 0;
49 // Processes NPP_SetWindow() invocation from the browser.
50 virtual NPError SetWindow(NPWindow* window) = 0;
51 // Processes NPP_GetValue() invocation from the browser.
52 virtual NPError GetValue(NPPVariable variable, void *value) = 0;
53 // Processes NPP_HandleEvent() invocation from the browser.
54 virtual int16_t HandleEvent(void* event) = 0;
55 // Processes NPP_GetScriptableInstance() invocation from the browser.
56 virtual NPObject* GetScriptableInstance() = 0;
57 // Processes NPP_NewStream() invocation from the browser.
58 virtual NPError NewStream(NPMIMEType type,
59 NPStream* stream, NPBool seekable,
60 uint16_t* stype) = 0;
61 // Processes NPP_StreamAsFile() invocation from the browser.
62 // The filename is given in the POSIX form.
64 // Note even though Safari under OS X passes the filename in the classic Mac
65 // pathname form like like "MachintoshHD:private:..." to the plugin, the NaCl
66 // plugin converts it to the POSIX form before calling StreamAsFile().
67 virtual void StreamAsFile(NPStream* stream, const char* filename) = 0;
68 // Processes NPP_DestroyStream() invocation from the browser.
69 virtual NPError DestroyStream(NPStream *stream, NPError reason) = 0;
70 // Processes NPP_URLNotify() invocation from the browser.
71 virtual void URLNotify(const char* url, NPReason reason,
72 void* notify_data) = 0;
75 extern NPError CheckExecutableVersion(NPP instance, const char *filename);
77 } // namespace nacl
79 #endif // NATIVE_CLIENT_NPAPI_PLUGIN_NPINSTANCE_H_