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_flash_message_loop.idl modified Tue Jan 17 17:48:30 2012. */
7
8#ifndef PPAPI_C_PRIVATE_PPB_FLASH_MESSAGE_LOOP_H_
9#define PPAPI_C_PRIVATE_PPB_FLASH_MESSAGE_LOOP_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_FLASH_MESSAGELOOP_INTERFACE_0_1 "PPB_Flash_MessageLoop;0.1"
18#define PPB_FLASH_MESSAGELOOP_INTERFACE PPB_FLASH_MESSAGELOOP_INTERFACE_0_1
19
20/**
21 * @file
22 * This file contains the <code>PPB_Flash_MessageLoop</code> interface.
23 */
24
25
26/**
27 * @addtogroup Interfaces
28 * @{
29 */
30/**
31 * The <code>PPB_Flash_MessageLoop</code> interface supports Pepper Flash to run
32 * nested message loops.
33 */
34struct PPB_Flash_MessageLoop_0_1 {
35  /**
36   * Allocates a Flash message loop resource.
37   *
38   * @param[in] instance A <code>PP_Instance</code> identifying one instance
39   * of a module.
40   *
41   * @return A <code>PP_Resource</code> that can be used to run a nested message
42   * loop if successful; 0 if failed.
43   */
44  PP_Resource (*Create)(PP_Instance instance);
45  /**
46   * Determines if a given resource is a Flash message loop.
47   *
48   * @param[in] resource A <code>PP_Resource</code> corresponding to a generic
49   * resource.
50   *
51   * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given
52   * resource is a Flash message loop, otherwise <code>PP_FALSE</code>.
53   */
54  PP_Bool (*IsFlashMessageLoop)(PP_Resource resource);
55  /**
56   * Runs a nested message loop. The plugin will be reentered from this call.
57   * This function is used in places where Flash would normally enter a nested
58   * message loop (e.g., when displaying context menus), but Pepper provides
59   * only an asynchronous call. After performing that asynchronous call, call
60   * <code>Run()</code>. In the callback, call <code>Quit()</code>.
61   *
62   * For a given message loop resource, only the first call to
63   * <code>Run()</code> will start a nested message loop. The subsequent calls
64   * will return <code>PP_ERROR_FAILED</code> immediately.
65   *
66   * @param[in] flash_message_loop The Flash message loop.
67   *
68   * @return <code>PP_ERROR_ABORTED</code> if the message loop quits because the
69   * resource is destroyed; <code>PP_OK</code> if the message loop quits because
70   * of other reasons (e.g., <code>Quit()</code> is called);
71   * <code>PP_ERROR_FAILED</code> if this is not the first call to
72   * <code>Run()</code>.
73   */
74  int32_t (*Run)(PP_Resource flash_message_loop);
75  /**
76   * Signals to quit the outermost nested message loop. Use this to exit and
77   * return back to the caller after you call <code>Run()</code>.
78   *
79   * If <code>Quit()</code> is not called to balance the call to
80   * <code>Run()</code>, the outermost nested message loop will be quitted
81   * implicitly when the resource is destroyed.
82   *
83   * @param[in] flash_message_loop The Flash message loop.
84   */
85  void (*Quit)(PP_Resource flash_message_loop);
86};
87
88typedef struct PPB_Flash_MessageLoop_0_1 PPB_Flash_MessageLoop;
89/**
90 * @}
91 */
92
93#endif  /* PPAPI_C_PRIVATE_PPB_FLASH_MESSAGE_LOOP_H_ */
94
95