| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 #ifndef PPAPI_C_PPB_BROKER_TRUSTED_H_ | |
| 6 #define PPAPI_C_PPB_BROKER_TRUSTED_H_ | |
| 7 | 5 |
| 6 /* From trusted/ppb_broker_trusted.idl modified Sat Jul 16 16:51:03 2011. */ |
| 7 |
| 8 #ifndef PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_ |
| 9 #define PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_ |
| 10 |
| 11 #include "ppapi/c/pp_bool.h" |
| 8 #include "ppapi/c/pp_completion_callback.h" | 12 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/pp_bool.h" | |
| 10 #include "ppapi/c/pp_instance.h" | 13 #include "ppapi/c/pp_instance.h" |
| 14 #include "ppapi/c/pp_macros.h" |
| 11 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
| 12 | 16 #include "ppapi/c/pp_stdint.h" |
| 13 #define PPB_BROKER_TRUSTED_INTERFACE "PPB_BrokerTrusted;0.2" | |
| 14 | 17 |
| 15 /** | 18 /** |
| 16 * @file | 19 * @file |
| 17 * This file defines the PPB_BrokerTrusted interface, which provides | 20 * This file defines the PPB_BrokerTrusted interface, which provides |
| 18 * access to a trusted broker with greater privileges than the plugin. | 21 * access to a trusted broker with greater privileges than the plugin. |
| 19 */ | 22 */ |
| 20 | 23 |
| 24 |
| 21 /** | 25 /** |
| 22 * @addtogroup Interfaces | 26 * @addtogroup Interfaces |
| 23 * @{ | 27 * @{ |
| 24 */ | 28 */ |
| 25 | |
| 26 /** | 29 /** |
| 27 * The PPB_BrokerTrusted interface provides access to a trusted broker | 30 * The PPB_BrokerTrusted interface provides access to a trusted broker |
| 28 * with greater privileges than the plugin. The interface only supports | 31 * with greater privileges than the plugin. The interface only supports |
| 29 * out-of-process plugins and is to be used by proxy implementations. All | 32 * out-of-process plugins and is to be used by proxy implementations. All |
| 30 * functions should be called from the main thread only. | 33 * functions should be called from the main thread only. |
| 31 * | 34 * |
| 32 * A PPB_BrokerTrusted resource represents a connection to the broker. Its | 35 * A PPB_BrokerTrusted resource represents a connection to the broker. Its |
| 33 * lifetime controls the lifetime of the broker, regardless of whether the | 36 * lifetime controls the lifetime of the broker, regardless of whether the |
| 34 * handle is closed. The handle should be closed before the resource is | 37 * handle is closed. The handle should be closed before the resource is |
| 35 * released. | 38 * released. |
| 36 */ | 39 */ |
| 40 #define PPB_BROKER_TRUSTED_INTERFACE_0_2 "PPB_BrokerTrusted;0.2" |
| 41 #define PPB_BROKER_TRUSTED_INTERFACE PPB_BROKER_TRUSTED_INTERFACE_0_2 |
| 42 |
| 37 struct PPB_BrokerTrusted { | 43 struct PPB_BrokerTrusted { |
| 38 /** | 44 /** |
| 39 * Returns a trusted broker resource. | 45 * Returns a trusted broker resource. |
| 40 */ | 46 */ |
| 41 PP_Resource (*CreateTrusted)(PP_Instance instance); | 47 PP_Resource (*CreateTrusted)(PP_Instance instance); |
| 42 | |
| 43 /** | 48 /** |
| 44 * Returns true if the resource is a trusted broker. | 49 * Returns true if the resource is a trusted broker. |
| 45 */ | 50 */ |
| 46 PP_Bool (*IsBrokerTrusted)(PP_Resource resource); | 51 PP_Bool (*IsBrokerTrusted)(PP_Resource resource); |
| 47 | |
| 48 /** | 52 /** |
| 49 * Connects to the trusted broker. It may have already | 53 * Connects to the trusted broker. It may have already |
| 50 * been launched by another instance. | 54 * been launched by another instance. |
| 51 * The plugin takes ownership of the handle once the callback has been called | 55 * The plugin takes ownership of the handle once the callback has been called |
| 52 * with a result of PP_OK. The plugin should immediately call GetHandle and | 56 * with a result of PP_OK. The plugin should immediately call GetHandle and |
| 53 * begin managing it. If the result is not PP_OK, the browser still owns the | 57 * begin managing it. If the result is not PP_OK, the browser still owns the |
| 54 * handle. | 58 * handle. |
| 55 * | 59 * |
| 56 * Returns PP_ERROR_WOULD_BLOCK on success, and invokes | 60 * Returns PP_ERROR_WOULD_BLOCK on success, and invokes |
| 57 * the |connect_callback| asynchronously to complete. | 61 * the |connect_callback| asynchronously to complete. |
| 58 * As this function should always be invoked from the main thread, | 62 * As this function should always be invoked from the main thread, |
| 59 * do not use the blocking variant of PP_CompletionCallback. | 63 * do not use the blocking variant of PP_CompletionCallback. |
| 60 * Returns PP_ERROR_FAILED if called from an in-process plugin. | 64 * Returns PP_ERROR_FAILED if called from an in-process plugin. |
| 61 */ | 65 */ |
| 62 int32_t (*Connect)(PP_Resource broker, | 66 int32_t (*Connect)(PP_Resource broker, |
| 63 struct PP_CompletionCallback connect_callback); | 67 struct PP_CompletionCallback connect_callback); |
| 64 | |
| 65 /** | 68 /** |
| 66 * Gets the handle to the pipe. Use once Connect has completed. Each instance | 69 * Gets the handle to the pipe. Use once Connect has completed. Each instance |
| 67 * of this interface has its own pipe. | 70 * of this interface has its own pipe. |
| 68 * | 71 * |
| 69 * Returns PP_OK on success, and places the result into the given output | 72 * Returns PP_OK on success, and places the result into the given output |
| 70 * parameter. The handle is only set when returning PP_OK. Calling this | 73 * parameter. The handle is only set when returning PP_OK. Calling this |
| 71 * before connect has completed will return PP_ERROR_FAILED. | 74 * before connect has completed will return PP_ERROR_FAILED. |
| 72 */ | 75 */ |
| 73 int32_t (*GetHandle)(PP_Resource broker, int32_t* handle); | 76 int32_t (*GetHandle)(PP_Resource broker, int32_t* handle); |
| 74 }; | 77 }; |
| 75 /** | 78 /** |
| 76 * @} | 79 * @} |
| 77 */ | 80 */ |
| 78 | 81 |
| 79 #endif /* PPAPI_C_PPB_BROKER_TRUSTED_H_ */ | 82 #endif /* PPAPI_C_TRUSTED_PPB_BROKER_TRUSTED_H_ */ |
| 83 |
| OLD | NEW |