Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 Input Event interfaces. | 7 * This file defines the Input Event interfaces. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 label Chrome { | 10 label Chrome { |
| 11 M13 = 1.0, | 11 M13 = 1.0, |
| 12 M14 = 1.1 | 12 M14 = 1.1, |
| 13 M15 = 1.1, | |
| 14 M16 = 1.2 | |
| 13 }; | 15 }; |
| 14 | 16 |
| 15 /** | 17 /** |
| 16 * This enumeration contains the types of input events. | 18 * This enumeration contains the types of input events. |
| 17 */ | 19 */ |
| 18 [assert_size(4)] | 20 [assert_size(4)] |
| 19 enum PP_InputEvent_Type { | 21 enum PP_InputEvent_Type { |
| 20 PP_INPUTEVENT_TYPE_UNDEFINED = -1, | 22 PP_INPUTEVENT_TYPE_UNDEFINED = -1, |
| 21 | 23 |
| 22 /** | 24 /** |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 * | 95 * |
| 94 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. | 96 * Register for this event using the PP_INPUTEVENT_CLASS_KEYBOARD class. |
| 95 */ | 97 */ |
| 96 PP_INPUTEVENT_TYPE_CHAR = 9, | 98 PP_INPUTEVENT_TYPE_CHAR = 9, |
| 97 | 99 |
| 98 /** | 100 /** |
| 99 * TODO(brettw) when is this used? | 101 * TODO(brettw) when is this used? |
| 100 * | 102 * |
| 101 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. | 103 * Register for this event using the PP_INPUTEVENT_CLASS_MOUSE class. |
| 102 */ | 104 */ |
| 103 PP_INPUTEVENT_TYPE_CONTEXTMENU = 10 | 105 PP_INPUTEVENT_TYPE_CONTEXTMENU = 10, |
| 106 | |
| 107 /** | |
| 108 * Notification that an input method composition process has just started. | |
| 109 * | |
| 110 * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class. | |
| 111 */ | |
| 112 PP_INPUTEVENT_TYPE_COMPOSITION_START = 11, | |
| 113 | |
| 114 /** | |
| 115 * Notification that the input method composition string is updated. | |
| 116 * | |
| 117 * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class. | |
| 118 */ | |
| 119 PP_INPUTEVENT_TYPE_COMPOSITION_UPDATE = 12, | |
| 120 | |
| 121 /** | |
| 122 * Notification that an input method composition process has completed. | |
| 123 * | |
| 124 * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class. | |
| 125 */ | |
| 126 PP_INPUTEVENT_TYPE_COMPOSITION_END = 13, | |
| 127 | |
| 128 /** | |
| 129 * Notification that an input method committed a string. | |
| 130 * | |
| 131 * Register for this event using the PP_INPUTEVENT_CLASS_COMPOSITION class. | |
| 132 */ | |
| 133 PP_INPUTEVENT_TYPE_IME_TEXT = 14 | |
| 104 }; | 134 }; |
| 105 | 135 |
| 106 /** | 136 /** |
| 107 * This enumeration contains event modifier constants. Each modifier is one | 137 * This enumeration contains event modifier constants. Each modifier is one |
| 108 * bit. Retrieve the modifiers from an input event using the GetEventModifiers | 138 * bit. Retrieve the modifiers from an input event using the GetEventModifiers |
| 109 * function on PPB_InputEvent. | 139 * function on PPB_InputEvent. |
| 110 */ | 140 */ |
| 111 [assert_size(4)] | 141 [assert_size(4)] |
| 112 enum PP_InputEvent_Modifier { | 142 enum PP_InputEvent_Modifier { |
| 113 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, | 143 PP_INPUTEVENT_MODIFIER_SHIFTKEY = 1 << 0, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 /** | 215 /** |
| 186 * Identifies touch input events. | 216 * Identifies touch input events. |
| 187 * | 217 * |
| 188 * Request touch events only if you intend to handle them. If the browser | 218 * Request touch events only if you intend to handle them. If the browser |
| 189 * knows you do not need to handle touch events, it can handle them at a | 219 * knows you do not need to handle touch events, it can handle them at a |
| 190 * higher level and achieve higher performance. | 220 * higher level and achieve higher performance. |
| 191 */ | 221 */ |
| 192 PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, | 222 PP_INPUTEVENT_CLASS_TOUCH = 1 << 3, |
| 193 | 223 |
| 194 /** | 224 /** |
| 195 * Identifies IME composition input events. | 225 * Identifies composition input events. |
|
brettw
2011/09/13 22:36:04
Is IME not appropriate here? Sorry if I don't tota
kochi
2011/09/14 02:07:05
I thinks this is in response to Yuzhu's comment ab
kinaba
2011/09/14 08:54:04
I see. I turned the names to _CLASS_IME and IMEInp
| |
| 196 * | 226 * |
| 197 * Request this input event class if you allow on-the-spot IME input. | 227 * Request this input event class if you allow on-the-spot composition. |
| 198 */ | 228 */ |
| 199 PP_INPUTEVENT_CLASS_IME = 1 << 4 | 229 PP_INPUTEVENT_CLASS_COMPOSITION = 1 << 4 |
| 200 }; | 230 }; |
| 201 | 231 |
| 202 /** | 232 /** |
| 203 * The <code>PPB_InputEvent</code> interface contains pointers to several | 233 * The <code>PPB_InputEvent</code> interface contains pointers to several |
| 204 * functions related to generic input events on the browser. | 234 * functions related to generic input events on the browser. |
| 205 */ | 235 */ |
| 206 [version=1.0, macro="PPB_INPUT_EVENT_INTERFACE"] | 236 [version=1.0, macro="PPB_INPUT_EVENT_INTERFACE"] |
| 207 interface PPB_InputEvent { | 237 interface PPB_InputEvent { |
| 208 /** | 238 /** |
| 209 * RequestInputEvent() requests that input events corresponding to the given | 239 * RequestInputEvent() requests that input events corresponding to the given |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 694 * @param[in] character_event A <code>PP_Resource</code> corresponding to a | 724 * @param[in] character_event A <code>PP_Resource</code> corresponding to a |
| 695 * keyboard event. | 725 * keyboard event. |
| 696 * | 726 * |
| 697 * @return A string var representing a single typed character for character | 727 * @return A string var representing a single typed character for character |
| 698 * input events. For non-character input events the return value will be an | 728 * input events. For non-character input events the return value will be an |
| 699 * undefined var. | 729 * undefined var. |
| 700 */ | 730 */ |
| 701 PP_Var GetCharacterText([in] PP_Resource character_event); | 731 PP_Var GetCharacterText([in] PP_Resource character_event); |
| 702 }; | 732 }; |
| 703 | 733 |
| 734 | |
| 735 /** | |
| 736 * The <code>PPB_CompositionInputEvent</code> interface contains pointers to | |
| 737 * several functions related to composition input events. | |
| 738 */ | |
| 739 [version=1.2, macro="PPB_COMPOSITION_INPUT_EVENT_INTERFACE"] | |
| 740 interface PPB_CompositionInputEvent { | |
|
brettw
2011/09/13 22:36:04
Can we put the APIs in the Dev directory (and name
kinaba
2011/09/14 08:54:04
Done.
| |
| 741 /** | |
| 742 * IsCompositionInputEvent() determines if a resource is a composition event. | |
| 743 * | |
| 744 * @param[in] resource A <code>PP_Resource</code> corresponding to an event. | |
| 745 * | |
| 746 * @return <code>PP_TRUE</code> if the given resource is a valid input event. | |
| 747 */ | |
| 748 PP_Bool IsCompositionInputEvent([in] PP_Resource resource); | |
| 749 | |
| 750 /** | |
| 751 * GetText() returns the composition text as a UTF-8 string for the given | |
| 752 * composition event. | |
| 753 * | |
| 754 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a | |
| 755 * composition event. | |
| 756 * | |
| 757 * @return A string var representing the composition text. For non-composition | |
| 758 * input events the return value will be an undefined var. | |
| 759 */ | |
| 760 PP_Var GetText([in] PP_Resource composition_event); | |
| 761 | |
| 762 /** | |
| 763 * GetSegmentNumber() returns the number of segments in the composition text. | |
| 764 * | |
| 765 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a | |
| 766 * composition event. | |
| 767 * | |
| 768 * @return The number of segments. For events other than COMPOSITION_UPDATE, | |
| 769 * returns 0. | |
| 770 */ | |
| 771 uint32_t GetSegmentNumber([in] PP_Resource composition_event); | |
| 772 | |
| 773 /** | |
| 774 * GetSegmentAt() returns the start and the end position of the index-th | |
| 775 * segment in the composition text. The positions are given by byte-indices of | |
| 776 * the string GetText(). They always satisfy 0 <= start < end <= (Length of | |
| 777 * GetText()) and start[index] < start[index+1]. When the event is not | |
| 778 * COMPOSITION_UPDATE or index >= GetSegmentNumber(), nothing happens. | |
| 779 * | |
| 780 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a | |
| 781 * composition event. | |
| 782 * | |
| 783 * @param[in] index An integer indicating a segment. | |
| 784 * | |
| 785 * @param[out] start The start position of the index-th segment. | |
| 786 * | |
| 787 * @param[out] end The end position of the index-th segment. | |
| 788 */ | |
| 789 void GetSegmentAt([in] PP_Resource composition_event, | |
| 790 [in] uint32_t index, | |
| 791 [out] uint32_t start, | |
| 792 [out] uint32_t end); | |
| 793 | |
| 794 /** | |
| 795 * GetTargetSegment() returns the index of the current target segment of | |
| 796 * composition. | |
| 797 * | |
| 798 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a | |
| 799 * composition event. | |
| 800 * | |
| 801 * @return An integer indicating the index of the target segment. When there | |
| 802 * is no active target segment, or the event is not COMPOSITION_UPDATE, | |
| 803 * returns -1. | |
| 804 */ | |
| 805 int32_t GetTargetSegment([in] PP_Resource composition_event); | |
| 806 | |
| 807 /** | |
| 808 * GetSelection() returns the range selected by caret in the composition text. | |
| 809 * | |
| 810 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a | |
| 811 * composition event. | |
| 812 * | |
| 813 * @param[out] start The start position of the current selection. | |
| 814 * | |
| 815 * @param[out] end The end position of the current selection. | |
| 816 */ | |
| 817 void GetSelection([in] PP_Resource composition_event, | |
| 818 [out] uint32_t start, | |
| 819 [out] uint32_t end); | |
| 820 }; | |
| OLD | NEW |