Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1329)

Side by Side Diff: ppapi/c/private/ppb_flash_clipboard.h

Issue 11225021: Move flash clipboard to the new proxy and add custom format support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/api/private/ppb_flash_clipboard.idl ('k') | ppapi/cpp/private/flash_clipboard.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 /* From private/ppb_flash_clipboard.idl modified Wed Mar 28 16:49:38 2012. */ 6 /* From private/ppb_flash_clipboard.idl modified Mon Oct 29 12:51:16 2012. */
7 7
8 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ 8 #ifndef PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
9 #define PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ 9 #define PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_
10 10
11 #include "ppapi/c/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_instance.h" 12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_macros.h" 13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_stdint.h" 14 #include "ppapi/c/pp_stdint.h"
15 #include "ppapi/c/pp_var.h" 15 #include "ppapi/c/pp_var.h"
16 16
17 #define PPB_FLASH_CLIPBOARD_INTERFACE_3_0 "PPB_Flash_Clipboard;3.0"
18 #define PPB_FLASH_CLIPBOARD_INTERFACE_4_0 "PPB_Flash_Clipboard;4.0" 17 #define PPB_FLASH_CLIPBOARD_INTERFACE_4_0 "PPB_Flash_Clipboard;4.0"
19 #define PPB_FLASH_CLIPBOARD_INTERFACE PPB_FLASH_CLIPBOARD_INTERFACE_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
20 20
21 /** 21 /**
22 * @file 22 * @file
23 * This file defines the private <code>PPB_Flash_Clipboard</code> API used by 23 * This file defines the private <code>PPB_Flash_Clipboard</code> API used by
24 * Pepper Flash for reading and writing to the clipboard. 24 * Pepper Flash for reading and writing to the clipboard.
25 */ 25 */
26 26
27 27
28 /** 28 /**
29 * The old version string for this interface, equivalent to version 3.0.
30 * TODO(viettrungluu): Remove this when enough time has passed. crbug.com/104184
31 */
32 #define PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY "PPB_Flash_Clipboard;3"
33
34 /**
35 * @addtogroup Enums 29 * @addtogroup Enums
36 * @{ 30 * @{
37 */ 31 */
38 /** 32 /**
39 * This enumeration contains the types of clipboards that can be accessed. 33 * This enumeration contains the types of clipboards that can be accessed.
40 * These types correspond to clipboard types in WebKit. 34 * These types correspond to clipboard types in WebKit.
41 */ 35 */
42 typedef enum { 36 typedef enum {
43 /** The standard clipboard. */ 37 /** The standard clipboard. */
44 PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0, 38 PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0,
45 /** The selection clipboard (e.g., on Linux). */ 39 /** The selection clipboard (e.g., on Linux). */
46 PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1 40 PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1
47 } PP_Flash_Clipboard_Type; 41 } PP_Flash_Clipboard_Type;
48 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Type, 4); 42 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Flash_Clipboard_Type, 4);
49 43
50 /** 44 /**
51 * This enumeration contains the supported clipboard data formats. 45 * This enumeration contains the predfined clipboard data formats.
52 */ 46 */
53 typedef enum { 47 typedef enum {
54 /** Indicates an invalid or unsupported clipboard data format. */ 48 /** Indicates an invalid or unsupported clipboard data format. */
55 PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0, 49 PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0,
56 /** 50 /**
57 * Indicates plaintext clipboard data. The format expected/returned is a 51 * Indicates plaintext clipboard data. The format expected/returned is a
58 * <code>PP_VARTYPE_STRING</code>. 52 * <code>PP_VARTYPE_STRING</code>.
59 */ 53 */
60 PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1, 54 PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1,
61 /** 55 /**
(...skipping 14 matching lines...) Expand all
76 70
77 /** 71 /**
78 * @addtogroup Interfaces 72 * @addtogroup Interfaces
79 * @{ 73 * @{
80 */ 74 */
81 /** 75 /**
82 * The <code>PPB_Flash_Clipboard</code> interface contains pointers to functions 76 * The <code>PPB_Flash_Clipboard</code> interface contains pointers to functions
83 * used by Pepper Flash to access the clipboard. 77 * used by Pepper Flash to access the clipboard.
84 * 78 *
85 */ 79 */
86 struct PPB_Flash_Clipboard_4_0 { 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.
88 *
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.
94 */
95 uint32_t (*RegisterCustomFormat)(PP_Instance instance_id,
96 const char* format_name);
87 /** 97 /**
88 * Checks whether a given data format is available from the given clipboard. 98 * Checks whether a given data format is available from the given clipboard.
89 * Returns true if the given format is available from the given clipboard. 99 * Returns true if the given format is available from the given clipboard.
90 */ 100 */
91 PP_Bool (*IsFormatAvailable)(PP_Instance instance_id, 101 PP_Bool (*IsFormatAvailable)(PP_Instance instance_id,
92 PP_Flash_Clipboard_Type clipboard_type, 102 PP_Flash_Clipboard_Type clipboard_type,
93 PP_Flash_Clipboard_Format format); 103 uint32_t format);
94 /** 104 /**
95 * Reads data in the given <code>format</code> from the clipboard. An 105 * Reads data in the given <code>format</code> from the clipboard. An
96 * undefined <code>PP_Var</code> is returned if there is an error in reading 106 * undefined <code>PP_Var</code> is returned if there is an error in reading
97 * the clipboard data and a null <code>PP_Var</code> is returned if there is 107 * the clipboard data and a null <code>PP_Var</code> is returned if there is
98 * no data of the specified <code>format</code> to read. 108 * no data of the specified <code>format</code> to read.
99 */ 109 */
100 struct PP_Var (*ReadData)(PP_Instance instance_id, 110 struct PP_Var (*ReadData)(PP_Instance instance_id,
101 PP_Flash_Clipboard_Type clipboard_type, 111 PP_Flash_Clipboard_Type clipboard_type,
102 PP_Flash_Clipboard_Format format); 112 uint32_t format);
103 /** 113 /**
104 * Writes the given array of data items to the clipboard. All existing 114 * Writes the given array of data items to the clipboard. All existing
105 * clipboard data in any format is erased before writing this data. Thus, 115 * clipboard data in any format is erased before writing this data. Thus,
106 * passing an array of size 0 has the effect of clearing the clipboard without 116 * passing an array of size 0 has the effect of clearing the clipboard without
107 * writing any data. Each data item in the array should have a different 117 * writing any data. Each data item in the array should have a different
108 * <code>PP_Flash_Clipboard_Format</code>. If multiple data items have the 118 * <code>PP_Flash_Clipboard_Format</code>. If multiple data items have the
109 * same format, only the last item with that format will be written. 119 * same format, only the last item with that format will be written.
110 * If there is an error writing any of the items in the array to the 120 * If there is an error writing any of the items in the array to the
111 * clipboard, none will be written and an error code is returned. 121 * clipboard, none will be written and an error code is returned.
112 * The error code will be <code>PP_ERROR_NOSPACE</code> if the value is 122 * The error code will be <code>PP_ERROR_NOSPACE</code> if the value is
113 * too large to be written, <code>PP_ERROR_BADARGUMENT</code> if a PP_Var 123 * too large to be written, <code>PP_ERROR_BADARGUMENT</code> if a PP_Var
114 * cannot be converted into the format supplied or <code>PP_FAILED</code> 124 * cannot be converted into the format supplied or <code>PP_FAILED</code>
115 * if the format is not supported. 125 * if the format is not supported.
116 */ 126 */
117 int32_t (*WriteData)(PP_Instance instance_id, 127 int32_t (*WriteData)(PP_Instance instance_id,
118 PP_Flash_Clipboard_Type clipboard_type, 128 PP_Flash_Clipboard_Type clipboard_type,
119 uint32_t data_item_count, 129 uint32_t data_item_count,
130 const uint32_t formats[],
131 const struct PP_Var data_items[]);
132 };
133
134 typedef struct PPB_Flash_Clipboard_5_0 PPB_Flash_Clipboard;
135
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,
120 const PP_Flash_Clipboard_Format formats[], 146 const PP_Flash_Clipboard_Format formats[],
121 const struct PP_Var data_items[]); 147 const struct PP_Var data_items[]);
122 }; 148 };
123
124 typedef struct PPB_Flash_Clipboard_4_0 PPB_Flash_Clipboard;
125
126 struct PPB_Flash_Clipboard_3_0 {
127 PP_Bool (*IsFormatAvailable)(PP_Instance instance_id,
128 PP_Flash_Clipboard_Type clipboard_type,
129 PP_Flash_Clipboard_Format format);
130 struct PP_Var (*ReadPlainText)(PP_Instance instance_id,
131 PP_Flash_Clipboard_Type clipboard_type);
132 int32_t (*WritePlainText)(PP_Instance instance_id,
133 PP_Flash_Clipboard_Type clipboard_type,
134 struct PP_Var text);
135 };
136 /** 149 /**
137 * @} 150 * @}
138 */ 151 */
139 152
140 #endif /* PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ */ 153 #endif /* PPAPI_C_PRIVATE_PPB_FLASH_CLIPBOARD_H_ */
141 154
OLDNEW
« no previous file with comments | « ppapi/api/private/ppb_flash_clipboard.idl ('k') | ppapi/cpp/private/flash_clipboard.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698