Revert of Move NumberOfPlanesForGpuMemoryBufferFormat to gfx (patchset #4 id:120001...
[chromium-blink-merge.git] / ppapi / cpp / network_proxy.cc
blob2d81cb3f63da319017a397be264ecf164d8dca40
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.
5 #include "ppapi/cpp/network_proxy.h"
7 #include "ppapi/c/ppb_network_proxy.h"
8 #include "ppapi/cpp/module_impl.h"
10 namespace pp {
12 namespace {
14 template <> const char* interface_name<PPB_NetworkProxy_1_0>() {
15 return PPB_NETWORKPROXY_INTERFACE_1_0;
18 } // namespace
20 // static
21 bool NetworkProxy::IsAvailable() {
22 return has_interface<PPB_NetworkProxy_1_0>();
25 // static
26 int32_t NetworkProxy::GetProxyForURL(
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);
33 return get_interface<PPB_NetworkProxy_1_0>()->GetProxyForURL(
34 instance.pp_instance(), url.pp_var(),
35 callback.output(), callback.pp_completion_callback());
38 } // namespace pp