OLD | NEW |
(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 #ifndef PPAPI_CPP_NETWORK_PROXY_H_ |
| 6 #define PPAPI_CPP_NETWORK_PROXY_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "ppapi/cpp/completion_callback.h" |
| 11 #include "ppapi/cpp/instance_handle.h" |
| 12 |
| 13 namespace pp { |
| 14 |
| 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(); |
| 26 |
| 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); |
| 45 }; |
| 46 |
| 47 } // namespace pp |
| 48 |
| 49 #endif // PPAPI_CPP_NETWORK_PROXY_H_ |
OLD | NEW |