OLD | NEW |
1 /* Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef PPAPI_C_PPP_H_ | 5 #ifndef PPAPI_C_PPP_H_ |
6 #define PPAPI_C_PPP_H_ | 6 #define PPAPI_C_PPP_H_ |
7 | 7 |
8 #include "ppapi/c/pp_module.h" | 8 #include "ppapi/c/pp_module.h" |
9 #include "ppapi/c/pp_stdint.h" | 9 #include "ppapi/c/pp_stdint.h" |
10 #include "ppapi/c/ppb.h" | 10 #include "ppapi/c/ppb.h" |
11 | 11 |
12 #if __GNUC__ >= 4 | 12 #if __GNUC__ >= 4 |
13 #define PP_EXPORT __attribute__ ((visibility("default"))) | 13 #define PP_EXPORT __attribute__ ((visibility("default"))) |
14 #elif defined(_MSC_VER) | 14 #elif defined(_MSC_VER) |
15 #define PP_EXPORT __declspec(dllexport) | 15 #define PP_EXPORT __declspec(dllexport) |
16 #endif | 16 #endif |
17 | 17 |
18 /** | 18 /** |
19 * @file | 19 * @file |
20 * Defines the API ... | 20 * This file defines three functions that your module must |
| 21 * implement to interact with the browser. |
21 * | 22 * |
22 * {PENDING: undefine PP_EXPORT?} | 23 * {PENDING: undefine PP_EXPORT?} |
23 */ | 24 */ |
24 | 25 |
25 /* We don't want name mangling for these external functions. We only need | 26 /* We don't want name mangling for these external functions. We only need |
26 * 'extern "C"' if we're compiling with a C++ compiler. | 27 * 'extern "C"' if we're compiling with a C++ compiler. |
27 */ | 28 */ |
28 #ifdef __cplusplus | 29 #ifdef __cplusplus |
29 extern "C" { | 30 extern "C" { |
30 #endif | 31 #endif |
31 | 32 |
32 /** | 33 /** |
33 * @addtogroup Functions | 34 * @addtogroup Functions |
34 * @{ | 35 * @{ |
35 */ | 36 */ |
36 | 37 |
37 /** | 38 /** |
38 * Entrypoint for the module. | 39 * PPP_InitializeModule() is the entry point for a Native Client module and is |
| 40 * called by the browser when your module loads. Your code must implement this |
| 41 * function. |
39 * | 42 * |
40 * Returns PP_OK on success, any other value on failure. Failure indicates to | 43 * Failure indicates to the browser that this plugin can not be used. In this |
41 * the browser that this plugin can not be used. In this case, the plugin will | 44 * case, the plugin will be unloaded and ShutdownModule will NOT be called. |
42 * be unloaded and ShutdownModule will NOT be called. | |
43 * | 45 * |
| 46 * @param[in] module A handle to one Native Client module. |
| 47 * @param[in] get_browser_interface An interface pointer. |
| 48 * @return PP_OK on success. Any other value on failure. |
44 */ | 49 */ |
45 PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, | 50 PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, |
46 PPB_GetInterface get_browser_interface); | 51 PPB_GetInterface get_browser_interface); |
47 /** | 52 /** |
48 * @} | 53 * @} |
49 */ | 54 */ |
50 | 55 |
51 /** | 56 /** |
52 * @addtogroup Functions | 57 * @addtogroup Functions |
53 * @{ | 58 * @{ |
54 */ | 59 */ |
55 | 60 |
56 /** Called before the plugin module is unloaded. */ | 61 /** PPP_ShutdownModule() is called before the Native Client module is unloaded. |
| 62 * Your code must implement this function. |
| 63 */ |
57 PP_EXPORT void PPP_ShutdownModule(); | 64 PP_EXPORT void PPP_ShutdownModule(); |
58 /** | 65 /** |
59 * @} | 66 * @} |
60 */ | 67 */ |
61 | 68 |
62 /** | 69 /** |
63 * @addtogroup Functions | 70 * @addtogroup Functions |
64 * @{ | 71 * @{ |
65 */ | 72 */ |
66 | 73 |
67 /** | 74 /** |
68 * Returns an interface pointer for the interface of the given name, or NULL | 75 * PPP_GetInterface() is called by the browser to determine the PPP_Instance |
69 * if the interface is not supported. Interface names should be ASCII. | 76 * functions that the Native Client module implements. PPP_Instance is |
| 77 * an interface (struct) that contains pointers to several functions your |
| 78 * module must implement in some form (all functions can be empty, but |
| 79 * must be implemented). If you care about things such as keyboard events |
| 80 * or your module gaining or losing focus on a page, these functions must |
| 81 * have code to handle those events. Refer to PPP_Instance interface for |
| 82 * more information on these functions. |
| 83 * |
| 84 * @param[in] interface_name A pointer to an interface name. Interface names |
| 85 * should be ASCII. |
| 86 * @return An interface pointer for the interface or NULL if the interface is |
| 87 * not supported. |
70 */ | 88 */ |
71 PP_EXPORT const void* PPP_GetInterface(const char* interface_name); | 89 PP_EXPORT const void* PPP_GetInterface(const char* interface_name); |
72 /** | 90 /** |
73 * @} | 91 * @} |
74 */ | 92 */ |
75 | 93 |
76 #ifdef __cplusplus | 94 #ifdef __cplusplus |
77 } /* extern "C" */ | 95 } /* extern "C" */ |
78 #endif | 96 #endif |
79 | 97 |
80 #endif /* PPAPI_C_PPP_H_ */ | 98 #endif /* PPAPI_C_PPP_H_ */ |
81 | 99 |
OLD | NEW |