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 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcom.h> | 9 #include <atlcom.h> |
10 #include <oleacc.h> | 10 #include <oleacc.h> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 COM_INTERFACE_ENTRY(IRawElementProviderSimple) | 79 COM_INTERFACE_ENTRY(IRawElementProviderSimple) |
80 END_COM_MAP() | 80 END_COM_MAP() |
81 | 81 |
82 // Represents a non-static text node in IAccessibleHypertext. This character | 82 // Represents a non-static text node in IAccessibleHypertext. This character |
83 // is embedded in the response to IAccessibleText::get_text, indicating the | 83 // is embedded in the response to IAccessibleText::get_text, indicating the |
84 // position where a non-static text child object appears. | 84 // position where a non-static text child object appears. |
85 CONTENT_EXPORT static const char16 kEmbeddedCharacter[]; | 85 CONTENT_EXPORT static const char16 kEmbeddedCharacter[]; |
86 | 86 |
87 // Mappings from roles and states to human readable strings. Initialize | 87 // Mappings from roles and states to human readable strings. Initialize |
88 // with |InitializeStringMaps|. | 88 // with |InitializeStringMaps|. |
89 static std::map<int32, string16> role_string_map; | 89 static std::map<int32, base::string16> role_string_map; |
90 static std::map<int32, string16> state_string_map; | 90 static std::map<int32, base::string16> state_string_map; |
91 | 91 |
92 CONTENT_EXPORT BrowserAccessibilityWin(); | 92 CONTENT_EXPORT BrowserAccessibilityWin(); |
93 | 93 |
94 CONTENT_EXPORT virtual ~BrowserAccessibilityWin(); | 94 CONTENT_EXPORT virtual ~BrowserAccessibilityWin(); |
95 | 95 |
96 // The Windows-specific unique ID, used as the child ID for MSAA methods | 96 // The Windows-specific unique ID, used as the child ID for MSAA methods |
97 // like NotifyWinEvent, and as the unique ID for IAccessible2 and ISimpleDOM. | 97 // like NotifyWinEvent, and as the unique ID for IAccessible2 and ISimpleDOM. |
98 LONG unique_id_win() const { return unique_id_win_; } | 98 LONG unique_id_win() const { return unique_id_win_; } |
99 | 99 |
100 // | 100 // |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 | 758 |
759 CONTENT_EXPORT HRESULT WINAPI InternalQueryInterface( | 759 CONTENT_EXPORT HRESULT WINAPI InternalQueryInterface( |
760 void* this_ptr, | 760 void* this_ptr, |
761 const _ATL_INTMAP_ENTRY* entries, | 761 const _ATL_INTMAP_ENTRY* entries, |
762 REFIID iid, | 762 REFIID iid, |
763 void** object); | 763 void** object); |
764 | 764 |
765 // Accessors. | 765 // Accessors. |
766 int32 ia_role() const { return ia_role_; } | 766 int32 ia_role() const { return ia_role_; } |
767 int32 ia_state() const { return ia_state_; } | 767 int32 ia_state() const { return ia_state_; } |
768 const string16& role_name() const { return role_name_; } | 768 const base::string16& role_name() const { return role_name_; } |
769 int32 ia2_role() const { return ia2_role_; } | 769 int32 ia2_role() const { return ia2_role_; } |
770 int32 ia2_state() const { return ia2_state_; } | 770 int32 ia2_state() const { return ia2_state_; } |
771 const std::vector<string16>& ia2_attributes() const { | 771 const std::vector<base::string16>& ia2_attributes() const { |
772 return ia2_attributes_; | 772 return ia2_attributes_; |
773 } | 773 } |
774 | 774 |
775 private: | 775 private: |
776 // Add one to the reference count and return the same object. Always | 776 // Add one to the reference count and return the same object. Always |
777 // use this method when returning a BrowserAccessibilityWin object as | 777 // use this method when returning a BrowserAccessibilityWin object as |
778 // an output parameter to a COM interface, never use it otherwise. | 778 // an output parameter to a COM interface, never use it otherwise. |
779 BrowserAccessibilityWin* NewReference(); | 779 BrowserAccessibilityWin* NewReference(); |
780 | 780 |
781 // Many MSAA methods take a var_id parameter indicating that the operation | 781 // Many MSAA methods take a var_id parameter indicating that the operation |
(...skipping 24 matching lines...) Expand all Loading... |
806 void BoolAttributeToIA2(AccessibilityNodeData::BoolAttribute attribute, | 806 void BoolAttributeToIA2(AccessibilityNodeData::BoolAttribute attribute, |
807 const char* ia2_attr); | 807 const char* ia2_attr); |
808 | 808 |
809 // If the int attribute |attribute| is present, add its value as an | 809 // If the int attribute |attribute| is present, add its value as an |
810 // IAccessible2 attribute with the name |ia2_attr|. | 810 // IAccessible2 attribute with the name |ia2_attr|. |
811 void IntAttributeToIA2(AccessibilityNodeData::IntAttribute attribute, | 811 void IntAttributeToIA2(AccessibilityNodeData::IntAttribute attribute, |
812 const char* ia2_attr); | 812 const char* ia2_attr); |
813 | 813 |
814 // Get the value text, which might come from the floating-point | 814 // Get the value text, which might come from the floating-point |
815 // value for some roles. | 815 // value for some roles. |
816 string16 GetValueText(); | 816 base::string16 GetValueText(); |
817 | 817 |
818 // Get the text of this node for the purposes of IAccessibleText - it may | 818 // Get the text of this node for the purposes of IAccessibleText - it may |
819 // be the name, it may be the value, etc. depending on the role. | 819 // be the name, it may be the value, etc. depending on the role. |
820 string16 TextForIAccessibleText(); | 820 base::string16 TextForIAccessibleText(); |
821 | 821 |
822 // If offset is a member of IA2TextSpecialOffsets this function updates the | 822 // If offset is a member of IA2TextSpecialOffsets this function updates the |
823 // value of offset and returns, otherwise offset remains unchanged. | 823 // value of offset and returns, otherwise offset remains unchanged. |
824 void HandleSpecialTextOffset(const string16& text, LONG* offset); | 824 void HandleSpecialTextOffset(const base::string16& text, LONG* offset); |
825 | 825 |
826 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType. | 826 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType. |
827 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type); | 827 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type); |
828 | 828 |
829 // Search forwards (direction == 1) or backwards (direction == -1) | 829 // Search forwards (direction == 1) or backwards (direction == -1) |
830 // from the given offset until the given boundary is found, and | 830 // from the given offset until the given boundary is found, and |
831 // return the offset of that boundary. | 831 // return the offset of that boundary. |
832 LONG FindBoundary(const string16& text, | 832 LONG FindBoundary(const base::string16& text, |
833 IA2TextBoundaryType ia2_boundary, | 833 IA2TextBoundaryType ia2_boundary, |
834 LONG start_offset, | 834 LONG start_offset, |
835 ui::TextBoundaryDirection direction); | 835 ui::TextBoundaryDirection direction); |
836 | 836 |
837 // Return a pointer to the object corresponding to the given renderer_id, | 837 // Return a pointer to the object corresponding to the given renderer_id, |
838 // does not make a new reference. | 838 // does not make a new reference. |
839 BrowserAccessibilityWin* GetFromRendererID(int32 renderer_id); | 839 BrowserAccessibilityWin* GetFromRendererID(int32 renderer_id); |
840 | 840 |
841 // Windows-specific unique ID (unique within the browser process), | 841 // Windows-specific unique ID (unique within the browser process), |
842 // used for get_accChild, NotifyWinEvent, and as the unique ID for | 842 // used for get_accChild, NotifyWinEvent, and as the unique ID for |
843 // IAccessible2 and ISimpleDOM. | 843 // IAccessible2 and ISimpleDOM. |
844 LONG unique_id_win_; | 844 LONG unique_id_win_; |
845 | 845 |
846 // IAccessible role and state. | 846 // IAccessible role and state. |
847 int32 ia_role_; | 847 int32 ia_role_; |
848 int32 ia_state_; | 848 int32 ia_state_; |
849 string16 role_name_; | 849 base::string16 role_name_; |
850 | 850 |
851 // IAccessible2 role and state. | 851 // IAccessible2 role and state. |
852 int32 ia2_role_; | 852 int32 ia2_role_; |
853 int32 ia2_state_; | 853 int32 ia2_state_; |
854 | 854 |
855 // IAccessible2 attributes. | 855 // IAccessible2 attributes. |
856 std::vector<string16> ia2_attributes_; | 856 std::vector<base::string16> ia2_attributes_; |
857 | 857 |
858 // True in Initialize when the object is first created, and false | 858 // True in Initialize when the object is first created, and false |
859 // subsequent times. | 859 // subsequent times. |
860 bool first_time_; | 860 bool first_time_; |
861 | 861 |
862 // The previous text, before the last update to this object. | 862 // The previous text, before the last update to this object. |
863 string16 previous_text_; | 863 base::string16 previous_text_; |
864 | 864 |
865 // The old text to return in IAccessibleText::get_oldText - this is like | 865 // The old text to return in IAccessibleText::get_oldText - this is like |
866 // previous_text_ except that it's NOT updated when the object | 866 // previous_text_ except that it's NOT updated when the object |
867 // is initialized again but the text doesn't change. | 867 // is initialized again but the text doesn't change. |
868 string16 old_text_; | 868 base::string16 old_text_; |
869 | 869 |
870 // The previous state, used to see if there was a state change. | 870 // The previous state, used to see if there was a state change. |
871 int32 old_ia_state_; | 871 int32 old_ia_state_; |
872 | 872 |
873 // Relationships between this node and other nodes. | 873 // Relationships between this node and other nodes. |
874 std::vector<BrowserAccessibilityRelation*> relations_; | 874 std::vector<BrowserAccessibilityRelation*> relations_; |
875 | 875 |
876 // The text of this node including embedded hyperlink characters. | 876 // The text of this node including embedded hyperlink characters. |
877 string16 hypertext_; | 877 base::string16 hypertext_; |
878 | 878 |
879 // Maps the |hypertext_| embedded character offset to an index in | 879 // Maps the |hypertext_| embedded character offset to an index in |
880 // |hyperlinks_|. | 880 // |hyperlinks_|. |
881 std::map<int32, int32> hyperlink_offset_to_index_; | 881 std::map<int32, int32> hyperlink_offset_to_index_; |
882 | 882 |
883 // Collection of non-static text child indicies, each of which corresponds to | 883 // Collection of non-static text child indicies, each of which corresponds to |
884 // a hyperlink. | 884 // a hyperlink. |
885 std::vector<int32> hyperlinks_; | 885 std::vector<int32> hyperlinks_; |
886 | 886 |
887 // The next unique id to use. | 887 // The next unique id to use. |
888 static LONG next_unique_id_win_; | 888 static LONG next_unique_id_win_; |
889 | 889 |
890 // Give BrowserAccessibility::Create access to our constructor. | 890 // Give BrowserAccessibility::Create access to our constructor. |
891 friend class BrowserAccessibility; | 891 friend class BrowserAccessibility; |
892 friend class BrowserAccessibilityRelation; | 892 friend class BrowserAccessibilityRelation; |
893 | 893 |
894 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); | 894 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); |
895 }; | 895 }; |
896 | 896 |
897 } // namespace content | 897 } // namespace content |
898 | 898 |
899 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ | 899 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
OLD | NEW |