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

Side by Side Diff: ppapi/c/extensions/dev/ppb_events_dev.h

Issue 13080002: Apps V2 in Pepper: introduce singleton resource ExtensionsCommon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 8 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 | « ppapi/c/extensions/dev/ppb_alarms_dev.h ('k') | ppapi/c/extensions/dev/ppb_ext_alarms_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Copyright (c) 2013 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
6 /* From extensions/dev/ppb_events_dev.idl modified Sun Mar 10 10:37:48 2013. */
7
8 #ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_
9 #define PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_
10
11 #include "ppapi/c/pp_instance.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_stdint.h"
14
15 #define PPB_EXT_EVENTS_DEV_INTERFACE_0_1 "PPB_Ext_Events(Dev);0.1"
16 #define PPB_EXT_EVENTS_DEV_INTERFACE PPB_EXT_EVENTS_DEV_INTERFACE_0_1
17
18 /**
19 * @file
20 */
21
22
23 /**
24 * @addtogroup Typedefs
25 * @{
26 */
27 /**
28 * Used to represent arbitrary C function pointers. Please note that usually
29 * the function that a <code>PP_Ext_GenericFuncType</code> pointer points to
30 * has a different signature than <code>void (*)()</code>.
31 */
32 typedef void (*PP_Ext_GenericFuncType)(void);
33 /**
34 * @}
35 */
36
37 /**
38 * @addtogroup Structs
39 * @{
40 */
41 /**
42 * An event listener that can be registered with the browser and receive
43 * notifications via the callback function.
44 *
45 * A function is defined for each event type to return a properly-filled
46 * <code>PP_Ext_EventListener</code> struct, for example,
47 * <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
48 */
49 struct PP_Ext_EventListener {
50 /**
51 * The name of the event to register to.
52 */
53 const char* event_name;
54 /**
55 * A callback function whose signature is determined by
56 * <code>event_name</code>. All calls will happen on the same thread as the
57 * one on which <code>AddListener()</code> is called.
58 */
59 PP_Ext_GenericFuncType func;
60 /**
61 * An opaque pointer that will be passed to <code>func</code>.
62 */
63 void* user_data;
64 };
65 /**
66 * @}
67 */
68
69 /**
70 * @addtogroup Interfaces
71 * @{
72 */
73 struct PPB_Ext_Events_Dev_0_1 {
74 /**
75 * Registers a listener to an event.
76 *
77 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
78 * a module.
79 * @param[in] listener A <code>PP_Ext_EventListener</code> struct.
80 *
81 * @return An listener ID, or 0 if failed.
82 */
83 uint32_t (*AddListener)(PP_Instance instance,
84 struct PP_Ext_EventListener listener);
85 /**
86 * Deregisters a listener.
87 *
88 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
89 * a module.
90 * @param[in] listener_id The ID returned by <code>AddListener()</code>.
91 */
92 void (*RemoveListener)(PP_Instance instance, uint32_t listener_id);
93 };
94
95 typedef struct PPB_Ext_Events_Dev_0_1 PPB_Ext_Events_Dev;
96 /**
97 * @}
98 */
99
100 /**
101 * Creates a <code>PP_Ext_EventListener</code> struct.
102 *
103 * Usually you should not call it directly. Instead you should call those
104 * functions that return a <code>PP_Ext_EventListener</code> struct for a
105 * specific event type, for example, <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
106 */
107 PP_INLINE struct PP_Ext_EventListener PP_Ext_MakeEventListener(
108 const char* event_name,
109 PP_Ext_GenericFuncType func,
110 void* user_data) {
111 struct PP_Ext_EventListener listener;
112 listener.event_name = event_name;
113 listener.func = func;
114 listener.user_data = user_data;
115 return listener;
116 }
117 #endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_ */
118
OLDNEW
« no previous file with comments | « ppapi/c/extensions/dev/ppb_alarms_dev.h ('k') | ppapi/c/extensions/dev/ppb_ext_alarms_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698