ppb_instance.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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 ppb_instance.idl modified Wed Oct  5 14:06:02 2011. */
7
8#ifndef PPAPI_C_PPB_INSTANCE_H_
9#define PPAPI_C_PPB_INSTANCE_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_resource.h"
15#include "ppapi/c/pp_stdint.h"
16#include "ppapi/c/pp_var.h"
17
18#define PPB_INSTANCE_INTERFACE_0_5 "PPB_Instance;0.5"
19#define PPB_INSTANCE_INTERFACE_1_0 "PPB_Instance;1.0"
20#define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_1_0
21
22/**
23 * @file
24 * This file defines the <code>PPB_Instance</code> interface implemented by the
25 * browser and containing pointers to functions related to
26 * the module instance on a web page.
27 */
28
29
30/**
31 * @addtogroup Interfaces
32 * @{
33 */
34/**
35 * The PPB_Instance interface contains pointers to functions
36 * related to the module instance on a web page.
37 */
38struct PPB_Instance_1_0 {
39  /**
40   * BindGraphics() binds the given graphics as the current display surface.
41   * The contents of this device is what will be displayed in the instance's
42   * area on the web page. The device must be a 2D or a 3D device.
43   *
44   * You can pass a <code>NULL</code> resource as the device parameter to
45   * unbind all devices from the given instance. The instance will then appear
46   * transparent. Re-binding the same device will return <code>PP_TRUE</code>
47   * and will do nothing.
48   *
49   * Any previously-bound device will be released. It is an error to bind
50   * a device when it is already bound to another instance. If you want
51   * to move a device between instances, first unbind it from the old one, and
52   * then rebind it to the new one.
53   *
54   * Binding a device will invalidate that portion of the web page to flush the
55   * contents of the new device to the screen.
56   *
57   * @param[in] instance A PP_Instance identifying one instance of a module.
58   * @param[in] device A PP_Resource corresponding to a graphics device.
59   *
60   * @return <code>PP_Bool</code> containing <code>PP_TRUE</code> if bind was
61   * successful or <code>PP_FALSE</code> if the device was not the correct
62   * type. On success, a reference to the device will be held by the
63   * instance, so the caller can release its reference if it chooses.
64   */
65  PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device);
66  /**
67   * IsFullFrame() determines if the instance is full-frame. Such an instance
68   * represents the entire document in a frame rather than an embedded
69   * resource. This can happen if the user does a top-level navigation or the
70   * page specifies an iframe to a resource with a MIME type registered by the
71   * module.
72   *
73   * @param[in] instance A <code>PP_Instance</code> identifying one instance
74   * of a module.
75   *
76   * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the
77   * instance is full-frame.
78   */
79  PP_Bool (*IsFullFrame)(PP_Instance instance);
80};
81
82typedef struct PPB_Instance_1_0 PPB_Instance;
83
84struct PPB_Instance_0_5 {
85  struct PP_Var (*GetWindowObject)(PP_Instance instance);
86  struct PP_Var (*GetOwnerElementObject)(PP_Instance instance);
87  PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device);
88  PP_Bool (*IsFullFrame)(PP_Instance instance);
89};
90/**
91 * @}
92 */
93
94#endif  /* PPAPI_C_PPB_INSTANCE_H_ */
95
96