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_
10 #include "ppapi/cpp/completion_callback.h"
11 #include "ppapi/cpp/instance_handle.h"
15 /// This class provides a way to determine the appropriate proxy settings for
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
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
31 /// @param[in] instance An <code>InstanceHandle</code> identifying one
32 /// instance of a module.
34 /// @param[in] url A string <code>Var</code> containing a URL.
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>.
40 /// @return An int32_t containing an error code from <code>pp_errors.h</code>.
41 static int32_t GetProxyForURL(
42 const InstanceHandle
& instance
,
44 const pp::CompletionCallbackWithOutput
<Var
>& callback
);
49 #endif // PPAPI_CPP_NETWORK_PROXY_H_