1/* Copyright (c) 2012 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
6/* From private/ppb_instance_private.idl modified Tue Jul 23 13:19:04 2013. */
7
8#ifndef PPAPI_C_PRIVATE_PPB_INSTANCE_PRIVATE_H_
9#define PPAPI_C_PRIVATE_PPB_INSTANCE_PRIVATE_H_
10
11#include "ppapi/c/pp_bool.h"
12#include "ppapi/c/pp_instance.h"
13#include "ppapi/c/pp_macros.h"
14#include "ppapi/c/pp_stdint.h"
15#include "ppapi/c/pp_var.h"
16
17#define PPB_INSTANCE_PRIVATE_INTERFACE_0_1 "PPB_Instance_Private;0.1"
18#define PPB_INSTANCE_PRIVATE_INTERFACE PPB_INSTANCE_PRIVATE_INTERFACE_0_1
19
20/**
21 * @file
22 * This file defines the PPB_Instance_Private interface implemented by the
23 * browser and containing pointers to functions available only to trusted plugin
24 * instances.
25 */
26
27
28/**
29 * @addtogroup Enums
30 * @{
31 */
32/**
33 * The <code>PP_ExternalPluginResult </code> enum contains result codes from
34 * launching an external plugin.
35 */
36typedef enum {
37  /** Successful external plugin call */
38  PP_EXTERNAL_PLUGIN_OK = 0,
39  /** Unspecified external plugin error */
40  PP_EXTERNAL_PLUGIN_FAILED = 1,
41  /** Error creating the module */
42  PP_EXTERNAL_PLUGIN_ERROR_MODULE = 2,
43  /** Error creating and initializing the instance */
44  PP_EXTERNAL_PLUGIN_ERROR_INSTANCE = 3
45} PP_ExternalPluginResult;
46PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ExternalPluginResult, 4);
47/**
48 * @}
49 */
50
51/**
52 * @addtogroup Interfaces
53 * @{
54 */
55/**
56 * The PPB_Instance_Private interface contains functions available only to
57 * trusted plugin instances.
58 *
59 */
60struct PPB_Instance_Private_0_1 {
61  /**
62   * GetWindowObject is a pointer to a function that determines
63   * the DOM window containing this module instance.
64   *
65   * @param[in] instance A PP_Instance whose WindowObject should be retrieved.
66   * @return A PP_Var containing window object on success.
67   */
68  struct PP_Var (*GetWindowObject)(PP_Instance instance);
69  /**
70   * GetOwnerElementObject is a pointer to a function that determines
71   * the DOM element containing this module instance.
72   *
73   * @param[in] instance A PP_Instance whose WindowObject should be retrieved.
74   * @return A PP_Var containing DOM element on success.
75   */
76  struct PP_Var (*GetOwnerElementObject)(PP_Instance instance);
77  /**
78   * ExecuteScript is a pointer to a function that executes the given
79   * script in the context of the frame containing the module.
80   *
81   * The exception, if any, will be returned in *exception. As with the PPB_Var
82   * interface, the exception parameter, if non-NULL, must be initialized
83   * to a "void" var or the function will immediately return. On success,
84   * the exception parameter will be set to a "void" var. On failure, the
85   * return value will be a "void" var.
86   *
87   * @param[in] script A string containing the JavaScript to execute.
88   * @param[in/out] exception PP_Var containing the exception. Initialize
89   * this to NULL if you don't want exception info; initialize this to a void
90   * exception if want exception info.
91   *
92   * @return The result of the script execution, or a "void" var
93   * if execution failed.
94   */
95  struct PP_Var (*ExecuteScript)(PP_Instance instance,
96                                 struct PP_Var script,
97                                 struct PP_Var* exception);
98};
99
100typedef struct PPB_Instance_Private_0_1 PPB_Instance_Private;
101/**
102 * @}
103 */
104
105#endif  /* PPAPI_C_PRIVATE_PPB_INSTANCE_PRIVATE_H_ */
106
107