Send activityLogPrivate to stable
[chromium-blink-merge.git] / ppapi / c / private / ppb_flash_clipboard.h
blobd59957a828eff8e2275e6bd1bed9c4a9095431bf
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 */
6 /* From private/ppb_flash_clipboard.idl modified Thu Mar 28 10:23:59 2013. */
8 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
9 #define PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
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"
17 #define PPB_FLASH_CLIPBOARD_INTERFACE_4_0 "PPB_Flash_Clipboard;4.0"
18 #define PPB_FLASH_CLIPBOARD_INTERFACE_5_0 "PPB_Flash_Clipboard;5.0"
19 #define PPB_FLASH_CLIPBOARD_INTERFACE PPB_FLASH_CLIPBOARD_INTERFACE_5_0
21 /**
22 * @file
23 * This file defines the private <code>PPB_Flash_Clipboard</code> API used by
24 * Pepper Flash for reading and writing to the clipboard.
28 /**
29 * @addtogroup Enums
30 * @{
32 /**
33 * This enumeration contains the types of clipboards that can be accessed.
34 * These types correspond to clipboard types in WebKit.
36 typedef enum {
37 /** The standard clipboard. */
38 PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0,
39 /** The selection clipboard (e.g., on Linux). */
40 PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1
41 } PP_Flash_Clipboard_Type;
42 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Type, 4);
44 /**
45 * This enumeration contains the predefined clipboard data formats.
47 typedef enum {
48 /** Indicates an invalid or unsupported clipboard data format. */
49 PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0,
50 /**
51 * Indicates plaintext clipboard data. The format expected/returned is a
52 * <code>PP_VARTYPE_STRING</code>.
54 PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1,
55 /**
56 * Indicates HTML clipboard data. The format expected/returned is a
57 * <code>PP_VARTYPE_STRING</code>.
59 PP_FLASH_CLIPBOARD_FORMAT_HTML = 2,
60 /**
61 * Indicates RTF clipboard data. The format expected/returned is a
62 * <code>PP_VARTYPE_ARRAY_BUFFER</code>.
64 PP_FLASH_CLIPBOARD_FORMAT_RTF = 3
65 } PP_Flash_Clipboard_Format;
66 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Format, 4);
67 /**
68 * @}
71 /**
72 * @addtogroup Interfaces
73 * @{
75 /**
76 * The <code>PPB_Flash_Clipboard</code> interface contains pointers to functions
77 * used by Pepper Flash to access the clipboard.
80 struct PPB_Flash_Clipboard_5_0 {
81 /**
82 * Registers a custom clipboard format. The format is identified by a
83 * string. An id identifying the format will be returned if the format is
84 * successfully registered, which can be used to read/write data of that
85 * format. If the format has already been registered, the id associated with
86 * that format will be returned. If the format fails to be registered
87 * <code>PP_FLASH_CLIPBOARD_FORMAT_INVALID</code> will be returned.
89 * All custom data should be read/written as <code>PP_Var</code> array
90 * buffers. The clipboard format is pepper-specific meaning that although the
91 * data will be stored on the system clipboard, it can only be accessed in a
92 * sensible way by using the pepper API. Data stored in custom formats can
93 * be safely shared between different applications that use pepper.
95 uint32_t (*RegisterCustomFormat)(PP_Instance instance_id,
96 const char* format_name);
97 /**
98 * Checks whether a given data format is available from the given clipboard.
99 * Returns true if the given format is available from the given clipboard.
101 PP_Bool (*IsFormatAvailable)(PP_Instance instance_id,
102 PP_Flash_Clipboard_Type clipboard_type,
103 uint32_t format);
105 * Reads data in the given <code>format</code> from the clipboard. An
106 * undefined <code>PP_Var</code> is returned if there is an error in reading
107 * the clipboard data and a null <code>PP_Var</code> is returned if there is
108 * no data of the specified <code>format</code> to read.
110 struct PP_Var (*ReadData)(PP_Instance instance_id,
111 PP_Flash_Clipboard_Type clipboard_type,
112 uint32_t format);
114 * Writes the given array of data items to the clipboard. All existing
115 * clipboard data in any format is erased before writing this data. Thus,
116 * passing an array of size 0 has the effect of clearing the clipboard without
117 * writing any data. Each data item in the array should have a different
118 * <code>PP_Flash_Clipboard_Format</code>. If multiple data items have the
119 * same format, only the last item with that format will be written.
120 * If there is an error writing any of the items in the array to the
121 * clipboard, none will be written and an error code is returned.
122 * The error code will be <code>PP_ERROR_NOSPACE</code> if the value is
123 * too large to be written, <code>PP_ERROR_BADARGUMENT</code> if a PP_Var
124 * cannot be converted into the format supplied or <code>PP_FAILED</code>
125 * if the format is not supported.
127 int32_t (*WriteData)(PP_Instance instance_id,
128 PP_Flash_Clipboard_Type clipboard_type,
129 uint32_t data_item_count,
130 const uint32_t formats[],
131 const struct PP_Var data_items[]);
134 typedef struct PPB_Flash_Clipboard_5_0 PPB_Flash_Clipboard;
136 struct PPB_Flash_Clipboard_4_0 {
137 PP_Bool (*IsFormatAvailable)(PP_Instance instance_id,
138 PP_Flash_Clipboard_Type clipboard_type,
139 PP_Flash_Clipboard_Format format);
140 struct PP_Var (*ReadData)(PP_Instance instance_id,
141 PP_Flash_Clipboard_Type clipboard_type,
142 PP_Flash_Clipboard_Format format);
143 int32_t (*WriteData)(PP_Instance instance_id,
144 PP_Flash_Clipboard_Type clipboard_type,
145 uint32_t data_item_count,
146 const PP_Flash_Clipboard_Format formats[],
147 const struct PP_Var data_items[]);
150 * @}
153 #endif /* PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ */