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

Unified Diff: ppapi/c/private/ppb_network_monitor_private.h

Issue 23453025: Refactor PPB_NetworkMonitor_Private interface to use CompletionCallback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/api/private/ppb_network_monitor_private.idl ('k') | ppapi/cpp/private/network_monitor_private.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/c/private/ppb_network_monitor_private.h
diff --git a/ppapi/c/private/ppb_network_monitor_private.h b/ppapi/c/private/ppb_network_monitor_private.h
index 93c1ff03bd190bc0a26045210a5c534f2426b2bc..29aba9816727e8925a5308d22d29f7a8053cc89a 100644
--- a/ppapi/c/private/ppb_network_monitor_private.h
+++ b/ppapi/c/private/ppb_network_monitor_private.h
@@ -4,22 +4,23 @@
*/
/* From private/ppb_network_monitor_private.idl,
- * modified Thu Mar 28 10:30:11 2013.
+ * modified Wed Sep 4 14:16:07 2013.
*/
#ifndef PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NETWORK_MONITOR_PRIVATE_H_
#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
-#define PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2 \
- "PPB_NetworkMonitor_Private;0.2"
+#define PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_3 \
+ "PPB_NetworkMonitor_Private;0.3"
#define PPB_NETWORKMONITOR_PRIVATE_INTERFACE \
- PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_2
+ PPB_NETWORKMONITOR_PRIVATE_INTERFACE_0_3
/**
* @file
@@ -28,23 +29,6 @@
/**
- * @addtogroup Typedefs
- * @{
- */
-/**
- * <code>PPB_NetworkMonitor_Callback</code> is a callback function
- * type that is used to receive notifications about network
- * configuration changes. The <code>network_list</code> passed to this
- * callback is a <code>PPB_NetworkList_Private</code> resource that
- * contains current configuration of network interfaces.
- */
-typedef void (*PPB_NetworkMonitor_Callback)(void* user_data,
- PP_Resource network_list);
-/**
- * @}
- */
-
-/**
* @addtogroup Interfaces
* @{
*/
@@ -52,29 +36,37 @@ typedef void (*PPB_NetworkMonitor_Callback)(void* user_data,
* The <code>PPB_NetworkMonitor_Private</code> provides access to
* notifications of network configuration changes.
*/
-struct PPB_NetworkMonitor_Private_0_2 {
+struct PPB_NetworkMonitor_Private_0_3 {
/**
- * Starts network change monitoring. The specified
- * <code>callback</code> will be called on the main thread once
- * after this method is called (to supply the initial network
- * configuration) and then later every time network configuration
- * changes. Notifications are stopped when the returned resource is
- * destroyed. If the plugin doesn't have access to the network list
- * then the callback will be called once with the
- * <code>network_list</code> parameter is set to 0.
+ * Creates a Network Monitor resource.
*
- * @param[in] callback The callback that will be called every time
- * network configuration changes or NULL to stop network monitoring.
+ * @param[in] instance A <code>PP_Instance</code> identifying one instance of
+ * a module.
+ *
+ * @return A <code>PP_Resource</code> corresponding to a network monitor or 0
+ * on failure.
+ */
+ PP_Resource (*Create)(PP_Instance instance);
+ /**
+ * Gets current network configuration. When called for the first time,
+ * completes as soon as the current network configuration is received from
+ * the browser. Each consequent call will wait for network list changes,
+ * returning a new <code>PPB_NetworkList</code> resource every time.
*
- * @param[inout] user_data The data to be passed to the callback on
- * each call.
+ * @param[in] network_monitor A <code>PP_Resource</code> corresponding to a
+ * network monitor.
+ * @param[out] network_list The <code>PPB_NetworkList<code> resource with the
+ * current state of network interfaces.
+ * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
+ * completion.
*
- * @return A <code>PP_Resource</code> containing the created
- * NetworkMonitor resource.
+ * @return An int32_t containing an error code from <code>pp_errors.h</code>.
+ * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have
+ * required permissions.
*/
- PP_Resource (*Create)(PP_Instance instance,
- PPB_NetworkMonitor_Callback callback,
- void* user_data);
+ int32_t (*UpdateNetworkList)(PP_Resource network_monitor,
+ PP_Resource* network_list,
+ struct PP_CompletionCallback callback);
/**
* Determines if the specified <code>resource</code> is a
* <code>NetworkMonitor</code> object.
@@ -88,7 +80,7 @@ struct PPB_NetworkMonitor_Private_0_2 {
PP_Bool (*IsNetworkMonitor)(PP_Resource resource);
};
-typedef struct PPB_NetworkMonitor_Private_0_2 PPB_NetworkMonitor_Private;
+typedef struct PPB_NetworkMonitor_Private_0_3 PPB_NetworkMonitor_Private;
/**
* @}
*/
« no previous file with comments | « ppapi/api/private/ppb_network_monitor_private.idl ('k') | ppapi/cpp/private/network_monitor_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698