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