• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 * found in the LICENSE file.
4 */
5
6/**
7 * This file defines the <code>PPB_NetworkMonitor</code> interface.
8 */
9
10[generate_thunk]
11
12label Chrome {
13  M31 = 1.0
14};
15
16/**
17 * The <code>PPB_NetworkMonitor</code> allows to get network interfaces
18 * configuration and monitor network configuration changes.
19 *
20 * Permissions: Apps permission <code>socket</code> with subrule
21 * <code>network-state</code> is required for <code>UpdateNetworkList()</code>.
22 * For more details about network communication permissions, please see:
23 * http://developer.chrome.com/apps/app_network.html
24 */
25interface PPB_NetworkMonitor {
26  /**
27   * Creates a Network Monitor resource.
28   *
29   * @param[in] instance A <code>PP_Instance</code> identifying one instance of
30   * a module.
31   *
32   * @return A <code>PP_Resource</code> corresponding to a network monitor or 0
33   * on failure.
34   */
35  PP_Resource Create([in] PP_Instance instance);
36
37
38  /**
39   * Gets current network configuration. When called for the first time,
40   * completes as soon as the current network configuration is received from
41   * the browser. Each consequent call will wait for network list changes,
42   * returning a new <code>PPB_NetworkList</code> resource every time.
43   *
44   * @param[in] network_monitor A <code>PP_Resource</code> corresponding to a
45   * network monitor.
46   * @param[out] network_list The <code>PPB_NetworkList<code> resource with the
47   * current state of network interfaces.
48   * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon
49   * completion.
50   *
51   * @return An int32_t containing an error code from <code>pp_errors.h</code>.
52   * <code>PP_ERROR_NOACCESS</code> will be returned if the caller doesn't have
53   * required permissions.
54   */
55  int32_t UpdateNetworkList([in] PP_Resource network_monitor,
56                            [out] PP_Resource network_list,
57                            [in] PP_CompletionCallback callback);
58
59  /**
60   * Determines if the specified <code>resource</code> is a
61   * <code>NetworkMonitor</code> object.
62   *
63   * @param[in] resource A <code>PP_Resource</code> resource.
64   *
65   * @return Returns <code>PP_TRUE</code> if <code>resource</code> is a
66   * <code>PPB_NetworkMonitor</code>, <code>PP_FALSE</code>  otherwise.
67   */
68  PP_Bool IsNetworkMonitor([in] PP_Resource resource);
69};
70