Pepper_47_C++_interfaces
network_proxy.cc
Go to the documentation of this file.
1 // Copyright 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 
6 
7 #include "ppapi/c/ppb_network_proxy.h"
9 
10 namespace pp {
11 
12 namespace {
13 
14 template <> const char* interface_name<PPB_NetworkProxy_1_0>() {
15  return PPB_NETWORKPROXY_INTERFACE_1_0;
16 }
17 
18 } // namespace
19 
20 // static
22  return has_interface<PPB_NetworkProxy_1_0>();
23 }
24 
25 // static
27  const InstanceHandle& instance,
28  const Var& url,
29  const CompletionCallbackWithOutput<Var>& callback) {
30  if (!has_interface<PPB_NetworkProxy_1_0>())
31  return callback.MayForce(PP_ERROR_NOINTERFACE);
32 
33  return get_interface<PPB_NetworkProxy_1_0>()->GetProxyForURL(
34  instance.pp_instance(), url.pp_var(),
35  callback.output(), callback.pp_completion_callback());
36 }
37 
38 } // namespace pp
int32_t MayForce(int32_t result) const
const PP_CompletionCallback & pp_completion_callback() const
const PP_Var & pp_var() const
Definition: var.h:226
static bool IsAvailable()
Returns true if the browser supports this API, false otherwise.
static int32_t GetProxyForURL(const InstanceHandle &instance, const Var &url, const pp::CompletionCallbackWithOutput< Var > &callback)
A generic type used for passing data types between the module and the page.
Definition: var.h:21
PP_Instance pp_instance() const