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_IME 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_IME 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_IME 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_IME 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 580 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 { | |
|
yzshen1
2011/09/13 06:28:34
It seems to me that the naming convention is:
PP_I
kinaba
2011/09/13 09:29:01
Done. Changed the class name to PP_INPUTEVENT_CLAS
| |
| 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 * GetSegments() returns the segmentation information by a list of indices of | |
| 764 * a UTF-8 string returned by GetText. Each segment is numbered from 0 to | |
| 765 * size-1, and the ith segment begins from segments[2*i] and ends with | |
| 766 * segments[2*i+1]. For events other than COMPOSITION_UPDATE, the function | |
|
yzshen1
2011/09/13 06:28:34
It might be good to add more comments about the se
kinaba
2011/09/13 09:29:01
Done.
| |
| 767 * returns an empty array. | |
| 768 * | |
| 769 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a | |
| 770 * composition event. | |
| 771 * | |
| 772 * @param[out] segments A pointer to an array containing segment information. | |
|
yzshen1
2011/09/13 06:28:34
If we decide to use a void* memory block like this
kinaba
2011/09/13 09:29:01
Done. Thanks, it looks much better!
| |
| 773 * | |
| 774 * @param[out] size The number of segments. | |
| 775 */ | |
| 776 void GetSegments([in] PP_Resource composition_event, | |
| 777 [out] mem_t segments, | |
| 778 [out] uint32_t size); | |
| 779 | |
| 780 /** | |
| 781 * GetTargetSegment() returns the number of the current target segment of | |
|
yzshen1
2011/09/13 06:28:34
Minor issue: number -> index?
kinaba
2011/09/13 09:29:01
Done.
| |
| 782 * composition. | |
| 783 * | |
| 784 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a | |
| 785 * composition event. | |
| 786 * | |
| 787 * @return An integer indicating the index of the target segment. When there | |
| 788 * is no active target segment, or the event is not COMPOSITION_UPDATE, | |
| 789 * returns -1. | |
| 790 */ | |
| 791 int32_t GetTargetSegment([in] PP_Resource composition_event); | |
| 792 | |
| 793 /** | |
| 794 * GetSelection() returns the caret position in the current composition text. | |
| 795 * | |
| 796 * @param[in] composition_event A <code>PP_Resource</code> corresponding to a | |
| 797 * composition event. | |
| 798 * | |
| 799 * @param[out] start Start index. | |
| 800 * | |
| 801 * @param[out] end End index. | |
| 802 */ | |
| 803 void GetSelection([in] PP_Resource composition_event, | |
| 804 [out] uint32_t start, | |
| 805 [out] uint32_t end); | |
| 806 }; | |
| OLD | NEW |