Pepper_47_C++_interfaces
network_monitor.cc
Go to the documentation of this file.
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 
6 
7 #include "ppapi/c/ppb_network_monitor.h"
9 #include "ppapi/cpp/instance.h"
10 #include "ppapi/cpp/module_impl.h"
11 #include "ppapi/cpp/network_list.h"
12 
13 namespace pp {
14 
15 namespace {
16 
17 template <> const char* interface_name<PPB_NetworkMonitor_1_0>() {
18  return PPB_NETWORKMONITOR_INTERFACE_1_0;
19 }
20 
21 } // namespace
22 
24  if (has_interface<PPB_NetworkMonitor_1_0>()) {
25  PassRefFromConstructor(get_interface<PPB_NetworkMonitor_1_0>()->Create(
26  instance.pp_instance()));
27  }
28 }
29 
32  if (has_interface<PPB_NetworkMonitor_1_0>()) {
33  return get_interface<PPB_NetworkMonitor_1_0>()->UpdateNetworkList(
34  pp_resource(), callback.output(), callback.pp_completion_callback());
35  }
36  return callback.MayForce(PP_ERROR_NOINTERFACE);
37 }
38 
39 // static
41  return has_interface<PPB_NetworkMonitor_1_0>();
42 }
43 
44 } // namespace pp
void PassRefFromConstructor(PP_Resource resource)
Definition: resource.cc:50
NetworkMonitor(const InstanceHandle &instance)
int32_t MayForce(int32_t result) const
const PP_CompletionCallback & pp_completion_callback() const
int32_t UpdateNetworkList(const CompletionCallbackWithOutput< NetworkList > &callback)
static bool IsAvailable()
PP_Resource pp_resource() const
Definition: resource.h:47
PP_Instance pp_instance() const