| OLD | NEW |
| 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 /** | 6 /** |
| 7 * This file defines the private <code>PPB_Flash_Clipboard</code> API used by | 7 * This file defines the private <code>PPB_Flash_Clipboard</code> API used by |
| 8 * Pepper Flash for reading and writing to the clipboard. | 8 * Pepper Flash for reading and writing to the clipboard. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 label Chrome { | 11 label Chrome { |
| 12 M17 = 3.0, | 12 M19 = 4.0, |
| 13 M19 = 4.0 | 13 M24 = 5.0 |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 #inline c | |
| 17 /** | |
| 18 * The old version string for this interface, equivalent to version 3.0. | |
| 19 * TODO(viettrungluu): Remove this when enough time has passed. crbug.com/104184 | |
| 20 */ | |
| 21 #define PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY "PPB_Flash_Clipboard;3" | |
| 22 #endinl | |
| 23 | |
| 24 /** | 16 /** |
| 25 * This enumeration contains the types of clipboards that can be accessed. | 17 * This enumeration contains the types of clipboards that can be accessed. |
| 26 * These types correspond to clipboard types in WebKit. | 18 * These types correspond to clipboard types in WebKit. |
| 27 */ | 19 */ |
| 28 [assert_size(4)] | 20 [assert_size(4)] |
| 29 enum PP_Flash_Clipboard_Type { | 21 enum PP_Flash_Clipboard_Type { |
| 30 /** The standard clipboard. */ | 22 /** The standard clipboard. */ |
| 31 PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0, | 23 PP_FLASH_CLIPBOARD_TYPE_STANDARD = 0, |
| 32 /** The selection clipboard (e.g., on Linux). */ | 24 /** The selection clipboard (e.g., on Linux). */ |
| 33 PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1 | 25 PP_FLASH_CLIPBOARD_TYPE_SELECTION = 1 |
| 34 }; | 26 }; |
| 35 | 27 |
| 36 /** | 28 /** |
| 37 * This enumeration contains the supported clipboard data formats. | 29 * This enumeration contains the predfined clipboard data formats. |
| 38 */ | 30 */ |
| 39 [assert_size(4)] | 31 [assert_size(4)] |
| 40 enum PP_Flash_Clipboard_Format { | 32 enum PP_Flash_Clipboard_Format { |
| 41 /** Indicates an invalid or unsupported clipboard data format. */ | 33 /** Indicates an invalid or unsupported clipboard data format. */ |
| 42 PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0, | 34 PP_FLASH_CLIPBOARD_FORMAT_INVALID = 0, |
| 43 /** | 35 /** |
| 44 * Indicates plaintext clipboard data. The format expected/returned is a | 36 * Indicates plaintext clipboard data. The format expected/returned is a |
| 45 * <code>PP_VARTYPE_STRING</code>. | 37 * <code>PP_VARTYPE_STRING</code>. |
| 46 */ | 38 */ |
| 47 PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1, | 39 PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT = 1, |
| 48 /** | 40 /** |
| 49 * Indicates HTML clipboard data. The format expected/returned is a | 41 * Indicates HTML clipboard data. The format expected/returned is a |
| 50 * <code>PP_VARTYPE_STRING</code>. | 42 * <code>PP_VARTYPE_STRING</code>. |
| 51 */ | 43 */ |
| 52 PP_FLASH_CLIPBOARD_FORMAT_HTML = 2, | 44 PP_FLASH_CLIPBOARD_FORMAT_HTML = 2, |
| 53 /** | 45 /** |
| 54 * Indicates RTF clipboard data. The format expected/returned is a | 46 * Indicates RTF clipboard data. The format expected/returned is a |
| 55 * <code>PP_VARTYPE_ARRAY_BUFFER</code>. | 47 * <code>PP_VARTYPE_ARRAY_BUFFER</code>. |
| 56 */ | 48 */ |
| 57 PP_FLASH_CLIPBOARD_FORMAT_RTF = 3 | 49 PP_FLASH_CLIPBOARD_FORMAT_RTF = 3 |
| 58 }; | 50 }; |
| 59 | 51 |
| 60 /** | 52 /** |
| 61 * The <code>PPB_Flash_Clipboard</code> interface contains pointers to functions | 53 * The <code>PPB_Flash_Clipboard</code> interface contains pointers to functions |
| 62 * used by Pepper Flash to access the clipboard. | 54 * used by Pepper Flash to access the clipboard. |
| 63 * | 55 * |
| 64 */ | 56 */ |
| 65 interface PPB_Flash_Clipboard { | 57 interface PPB_Flash_Clipboard { |
| 66 /** | 58 /** |
| 67 * Checks whether a given data format is available from the given clipboard. | 59 * Deprecated in 5.0. |
| 68 * Returns true if the given format is available from the given clipboard. | |
| 69 */ | 60 */ |
| 61 [version=4.0, deprecate=5.0] |
| 70 PP_Bool IsFormatAvailable( | 62 PP_Bool IsFormatAvailable( |
| 71 [in] PP_Instance instance_id, | 63 [in] PP_Instance instance_id, |
| 72 [in] PP_Flash_Clipboard_Type clipboard_type, | 64 [in] PP_Flash_Clipboard_Type clipboard_type, |
| 73 [in] PP_Flash_Clipboard_Format format); | 65 [in] PP_Flash_Clipboard_Format format); |
| 74 | 66 |
| 75 /** | 67 /** |
| 76 * Deprecated in 4.0. | 68 * Deprecated in 5.0. |
| 77 */ | 69 */ |
| 78 [version=3.0, deprecate=4.0] | 70 [version=4.0, deprecate=5.0] |
| 79 PP_Var ReadPlainText( | 71 PP_Var ReadData([in] PP_Instance instance_id, |
| 80 [in] PP_Instance instance_id, | 72 [in] PP_Flash_Clipboard_Type clipboard_type, |
| 81 [in] PP_Flash_Clipboard_Type clipboard_type); | 73 [in] PP_Flash_Clipboard_Format format); |
| 82 | 74 |
| 83 /** | 75 /** |
| 84 * Deprecated in 4.0. | 76 * Deprecated in 5.0. |
| 85 */ | 77 */ |
| 86 [version=3.0, deprecate=4.0] | 78 [version=4.0, deprecate=5.0] |
| 87 int32_t WritePlainText( | 79 int32_t WriteData([in] PP_Instance instance_id, |
| 80 [in] PP_Flash_Clipboard_Type clipboard_type, |
| 81 [in] uint32_t data_item_count, |
| 82 [in, size_is(data_item_count)] PP_Flash_Clipboard_Format[] formats, |
| 83 [in, size_is(data_item_count)] PP_Var[] data_items); |
| 84 |
| 85 /** |
| 86 * Registers a custom clipboard format. The format is identified by a |
| 87 * string. An id identifying the format will be returned if the format is |
| 88 * successfully registered, which can be used to read/write data of that |
| 89 * format. If the format has already been registered, the id associated with |
| 90 * that format will be returned. If the format fails to be registered |
| 91 * <code>PP_FLASH_CLIPBOARD_FORMAT_INVALID</code> will be returned. |
| 92 * |
| 93 * All custom data should be read/written as <code>PP_Var</code> array |
| 94 * buffers. The clipboard format is pepper-specific meaning that although the |
| 95 * data will be stored on the system clipboard, it can only be accessed in a |
| 96 * sensible way by using the pepper API. Data stored in custom formats can |
| 97 * be safely shared between different applications that use pepper. |
| 98 */ |
| 99 [version=5.0] |
| 100 uint32_t RegisterCustomFormat( |
| 101 [in] PP_Instance instance_id, |
| 102 [in] str_t format_name); |
| 103 |
| 104 /** |
| 105 * Checks whether a given data format is available from the given clipboard. |
| 106 * Returns true if the given format is available from the given clipboard. |
| 107 */ |
| 108 [version=5.0] |
| 109 PP_Bool IsFormatAvailable( |
| 88 [in] PP_Instance instance_id, | 110 [in] PP_Instance instance_id, |
| 89 [in] PP_Flash_Clipboard_Type clipboard_type, | 111 [in] PP_Flash_Clipboard_Type clipboard_type, |
| 90 [in] PP_Var text); | 112 [in] uint32_t format); |
| 91 | 113 |
| 92 /** | 114 /** |
| 93 * Reads data in the given <code>format</code> from the clipboard. An | 115 * Reads data in the given <code>format</code> from the clipboard. An |
| 94 * undefined <code>PP_Var</code> is returned if there is an error in reading | 116 * undefined <code>PP_Var</code> is returned if there is an error in reading |
| 95 * the clipboard data and a null <code>PP_Var</code> is returned if there is | 117 * the clipboard data and a null <code>PP_Var</code> is returned if there is |
| 96 * no data of the specified <code>format</code> to read. | 118 * no data of the specified <code>format</code> to read. |
| 97 */ | 119 */ |
| 98 [version=4.0] | 120 [version=5.0] |
| 99 PP_Var ReadData([in] PP_Instance instance_id, | 121 PP_Var ReadData([in] PP_Instance instance_id, |
| 100 [in] PP_Flash_Clipboard_Type clipboard_type, | 122 [in] PP_Flash_Clipboard_Type clipboard_type, |
| 101 [in] PP_Flash_Clipboard_Format format); | 123 [in] uint32_t format); |
| 102 | 124 |
| 103 /** | 125 /** |
| 104 * Writes the given array of data items to the clipboard. All existing | 126 * 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, | 127 * 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 | 128 * 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 | 129 * 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 | 130 * <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. | 131 * 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 | 132 * 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. | 133 * 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 | 134 * 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 | 135 * 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> | 136 * cannot be converted into the format supplied or <code>PP_FAILED</code> |
| 115 * if the format is not supported. | 137 * if the format is not supported. |
| 116 */ | 138 */ |
| 117 [version=4.0] | 139 [version=5.0] |
| 118 int32_t WriteData([in] PP_Instance instance_id, | 140 int32_t WriteData([in] PP_Instance instance_id, |
| 119 [in] PP_Flash_Clipboard_Type clipboard_type, | 141 [in] PP_Flash_Clipboard_Type clipboard_type, |
| 120 [in] uint32_t data_item_count, | 142 [in] uint32_t data_item_count, |
| 121 [in, size_is(data_item_count)] PP_Flash_Clipboard_Format[] formats, | 143 [in, size_is(data_item_count)] uint32_t[] formats, |
| 122 [in, size_is(data_item_count)] PP_Var[] data_items); | 144 [in, size_is(data_item_count)] PP_Var[] data_items); |
| 123 }; | 145 }; |
| OLD | NEW |