summaryrefslogtreecommitdiffstats
path: root/ppapi/api/trusted/ppb_broker_trusted.idl
blob: 023d9fcff075a33e21262b20f0afd6dad42fa2dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/**
 * This file defines the PPB_BrokerTrusted interface, which provides
 * access to a trusted broker with greater privileges than the plugin.
 */

label Chrome {
  M14 = 0.2,
  M25 = 0.3
};

/**
 * The PPB_BrokerTrusted interface provides access to a trusted broker
 * with greater privileges than the plugin. The interface only supports
 * out-of-process plugins and is to be used by proxy implementations.  All
 * functions should be called from the main thread only.
 *
 * A PPB_BrokerTrusted resource represents a connection to the broker. Its
 * lifetime controls the lifetime of the broker, regardless of whether the
 * handle is closed. The handle should be closed before the resource is
 * released.
 */
[macro="PPB_BROKER_TRUSTED_INTERFACE"]
interface PPB_BrokerTrusted {
  /**
   * Returns a trusted broker resource.
   */
  PP_Resource CreateTrusted([in] PP_Instance instance);

  /**
   * Returns true if the resource is a trusted broker.
   */
  PP_Bool IsBrokerTrusted([in] PP_Resource resource);

  /**
   * Connects to the trusted broker. It may have already
   * been launched by another instance.
   * The plugin takes ownership of the handle once the callback has been called
   * with a result of PP_OK. The plugin should immediately call GetHandle and
   * begin managing it. If the result is not PP_OK, the browser still owns the
   * handle.
   *
   * Returns PP_ERROR_WOULD_BLOCK on success, and invokes
   * the |connect_callback| asynchronously to complete.
   * As this function should always be invoked from the main thread,
   * do not use the blocking variant of PP_CompletionCallback.
   * Returns PP_ERROR_FAILED if called from an in-process plugin.
   */
  int32_t Connect([in] PP_Resource broker,
                  [in] PP_CompletionCallback connect_callback);

  /**
   * Gets the handle to the pipe. Use once Connect has completed. Each instance
   * of this interface has its own pipe.
   *
   * Returns PP_OK on success, and places the result into the given output
   * parameter. The handle is only set when returning PP_OK. Calling this
   * before connect has completed will return PP_ERROR_FAILED.
   */
  int32_t GetHandle([in] PP_Resource broker, [out] int32_t handle);

  /**
   * Returns PP_TRUE if the plugin has permission to launch the broker. A user
   * must explicitly grant permission to launch the broker for a particular
   * website. This is done through an infobar that is displayed when |Connect|
   * is called. This function returns PP_TRUE if the user has already granted
   * permission to launch the broker for the website containing this plugin
   * instance. Returns PP_FALSE otherwise.
   */
  [version=0.3]
  PP_Bool IsAllowed([in] PP_Resource broker);
};