OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 | 5 |
6 /* From private/ppb_network_monitor_private.idl, | 6 /* From private/ppb_network_monitor_private.idl, |
7 * modified Thu Mar 28 10:30:11 2013. | 7 * modified Wed Sep 4 14:16:07 2013. |
8 */ | 8 */ |
9 | 9 |
10 #ifndef PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_ | 10 #ifndef PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_ |
11 #define PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_ | 11 #define PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_ |
12 | 12 |
13 #include "ppapi/c/pp_bool.h" | 13 #include "ppapi/c/pp_bool.h" |
| 14 #include "ppapi/c/pp_completion_callback.h" |
14 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
15 #include "ppapi/c/pp_macros.h" | 16 #include "ppapi/c/pp_macros.h" |
16 #include "ppapi/c/pp_resource.h" | 17 #include "ppapi/c/pp_resource.h" |
17 #include "ppapi/c/pp_stdint.h" | 18 #include "ppapi/c/pp_stdint.h" |
18 | 19 |
19 #define PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2 \ | 20 #define PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_3 \ |
20 "PPB_NetworkMonitor_Private;0.2" | 21 "PPB_NetworkMonitor_Private;0.3" |
21 #define PPB_NETWORKMONITOR_PRIVATE_INTERFACE \ | 22 #define PPB_NETWORKMONITOR_PRIVATE_INTERFACE \ |
22 PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2 | 23 PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_3 |
23 | 24 |
24 /** | 25 /** |
25 * @file | 26 * @file |
26 * This file defines the <code>PPB_NetworkMonitor_Private</code> interface. | 27 * This file defines the <code>PPB_NetworkMonitor_Private</code> interface. |
27 */ | 28 */ |
28 | 29 |
29 | 30 |
30 /** | 31 /** |
31 * @addtogroup Typedefs | |
32 * @{ | |
33 */ | |
34 /** | |
35 * <code>PPB_NetworkMonitor_Callback</code> is a callback function | |
36 * type that is used to receive notifications about network | |
37 * configuration changes. The <code>network_list</code> passed to this | |
38 * callback is a <code>PPB_NetworkList_Private</code> resource that | |
39 * contains current configuration of network interfaces. | |
40 */ | |
41 typedef void (*PPB_NetworkMonitor_Callback)(void* user_data, | |
42 PP_Resource network_list); | |
43 /** | |
44 * @} | |
45 */ | |
46 | |
47 /** | |
48 * @addtogroup Interfaces | 32 * @addtogroup Interfaces |
49 * @{ | 33 * @{ |
50 */ | 34 */ |
51 /** | 35 /** |
52 * The <code>PPB_NetworkMonitor_Private</code> provides access to | 36 * The <code>PPB_NetworkMonitor_Private</code> provides access to |
53 * notifications of network configuration changes. | 37 * notifications of network configuration changes. |
54 */ | 38 */ |
55 struct PPB_NetworkMonitor_Private_0_2 { | 39 struct PPB_NetworkMonitor_Private_0_3 { |
56 /** | 40 /** |
57 * Starts network change monitoring. The specified | 41 * Creates a Network Monitor resource. |
58 * <code>callback</code> will be called on the main thread once | |
59 * after this method is called (to supply the initial network | |
60 * configuration) and then later every time network configuration | |
61 * changes. Notifications are stopped when the returned resource is | |
62 * destroyed. If the plugin doesn't have access to the network list | |
63 * then the callback will be called once with the | |
64 * <code>network_list</code> parameter is set to 0. | |
65 * | 42 * |
66 * @param[in] callback The callback that will be called every time | 43 * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
67 * network configuration changes or NULL to stop network monitoring. | 44 * a module. |
68 * | 45 * |
69 * @param[inout] user_data The data to be passed to the callback on | 46 * @return A <code>PP_Resource</code> corresponding to a network monitor or 0 |
70 * each call. | 47 * on failure. |
| 48 */ |
| 49 PP_Resource (*Create)(PP_Instance instance); |
| 50 /** |
| 51 * Gets current network configuration. When called for the first time, |
| 52 * completes as soon as the current network configuration is received from |
| 53 * the browser. Each consequent call will wait for network list changes, |
| 54 * returning a new <code>PPB_NetworkList</code> resource every time. |
71 * | 55 * |
72 * @return A <code>PP_Resource</code> containing the created | 56 * @param[in] network_monitor A <code>PP_Resource</code> corresponding to a |
73 * NetworkMonitor resource. | 57 * network monitor. |
| 58 * @param[out] network_list The <code>PPB_NetworkList<code> resource with the |
| 59 * current state of network interfaces. |
| 60 * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon |
| 61 * completion. |
| 62 * |
| 63 * @return An int32_t containing an error code from <code>pp_errors.h</code>. |
| 64 * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have |
| 65 * required permissions. |
74 */ | 66 */ |
75 PP_Resource (*Create)(PP_Instance instance, | 67 int32_t (*UpdateNetworkList)(PP_Resource network_monitor, |
76 PPB_NetworkMonitor_Callback callback, | 68 PP_Resource* network_list, |
77 void* user_data); | 69 struct PP_CompletionCallback callback); |
78 /** | 70 /** |
79 * Determines if the specified <code>resource</code> is a | 71 * Determines if the specified <code>resource</code> is a |
80 * <code>NetworkMonitor</code> object. | 72 * <code>NetworkMonitor</code> object. |
81 * | 73 * |
82 * @param[in] resource A <code>PP_Resource</code> resource. | 74 * @param[in] resource A <code>PP_Resource</code> resource. |
83 * | 75 * |
84 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is | 76 * @return Returns <code>PP_TRUE</code> if <code>resource</code> is |
85 * a <code>PPB_NetworkMonitor_Private</code>, <code>PP_FALSE</code> | 77 * a <code>PPB_NetworkMonitor_Private</code>, <code>PP_FALSE</code> |
86 * otherwise. | 78 * otherwise. |
87 */ | 79 */ |
88 PP_Bool (*IsNetworkMonitor)(PP_Resource resource); | 80 PP_Bool (*IsNetworkMonitor)(PP_Resource resource); |
89 }; | 81 }; |
90 | 82 |
91 typedef struct PPB_NetworkMonitor_Private_0_2 PPB_NetworkMonitor_Private; | 83 typedef struct PPB_NetworkMonitor_Private_0_3 PPB_NetworkMonitor_Private; |
92 /** | 84 /** |
93 * @} | 85 * @} |
94 */ | 86 */ |
95 | 87 |
96 #endif /* PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_ */ | 88 #endif /* PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_ */ |
97 | 89 |
OLD | NEW |