Roll src/third_party/skia b9ed884:8566539
[chromium-blink-merge.git] / ppapi / cpp / network_proxy.h
blob25696de5a4b8ef93c51fc9ac3c56d74931a726ad
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 #ifndef PPAPI_CPP_NETWORK_PROXY_H_
6 #define PPAPI_CPP_NETWORK_PROXY_H_
8 #include <string>
10 #include "ppapi/cpp/completion_callback.h"
11 #include "ppapi/cpp/instance_handle.h"
13 namespace pp {
15 /// This class provides a way to determine the appropriate proxy settings for
16 /// for a given URL.
17 ///
18 /// Permissions: Apps permission <code>socket</code> with subrule
19 /// <code>resolve-proxy</code> is required for using this API.
20 /// For more details about network communication permissions, please see:
21 /// http://developer.chrome.com/apps/app_network.html
22 class NetworkProxy {
23 public:
24 /// Returns true if the browser supports this API, false otherwise.
25 static bool IsAvailable();
27 /// Retrieves the proxy that will be used for the given URL. The result will
28 /// be a string in PAC format. For more details about PAC format, please see
29 /// http://en.wikipedia.org/wiki/Proxy_auto-config
30 ///
31 /// @param[in] instance An <code>InstanceHandle</code> identifying one
32 /// instance of a module.
33 ///
34 /// @param[in] url A string <code>Var</code> containing a URL.
35 ///
36 /// @param[in] callback A <code>CompletionCallbackWithOutput</code> to be
37 /// called upon completion. It will be passed a string <code>Var</code>
38 /// containing the appropriate PAC string for <code>url</code>.
39 ///
40 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
41 static int32_t GetProxyForURL(
42 const InstanceHandle& instance,
43 const Var& url,
44 const pp::CompletionCallbackWithOutput<Var>& callback);
47 } // namespace pp
49 #endif // PPAPI_CPP_NETWORK_PROXY_H_