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

Side by Side Diff: ppapi/cpp/dev/network_proxy_dev.cc

Issue 16819002: PPAPI: Introduce PPB_NetworkProxy_Dev (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 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
5 #include "ppapi/cpp/dev/network_proxy_dev.h"
6
7 #include "ppapi/c/dev/ppb_network_proxy_dev.h"
8 #include "ppapi/cpp/module_impl.h"
9
10 namespace pp {
11
12 namespace {
13
14 template <> const char* interface_name<PPB_NetworkProxy_Dev_0_1>() {
15 return PPB_NETWORKPROXY_DEV_INTERFACE_0_1;
16 }
17
18 } // namespace
19
20 // static
21 bool NetworkProxy::IsAvailable() {
22 return has_interface<PPB_NetworkProxy_Dev_0_1>();
23 }
24
25 // static
26 int32_t NetworkProxy::GetProxyForURL(
27 const InstanceHandle& instance,
28 const std::string& url,
29 const CompletionCallbackWithOutput<Var>& callback) {
30 if (!has_interface<PPB_NetworkProxy_Dev_0_1>())
31 return callback.MayForce(PP_ERROR_NOINTERFACE);
32
33 Var url_var(url);
34 // The Var will be null if the url is not valid UTF-8.
35 if (url_var.is_null())
yzshen1 2013/06/16 23:49:53 It seems unnecessary to check |url_var| here: the
dmichael (off chromium) 2013/06/17 21:48:28 Good point. I took your suggestion of using Var, s
36 return callback.MayForce(PP_ERROR_BADARGUMENT);
37
38 return get_interface<PPB_NetworkProxy_Dev_0_1>()->GetProxyForURL(
39 instance.pp_instance(), url_var.pp_var(),
40 callback.output(), callback.pp_completion_callback());
41 }
42
43 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698