OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 WEBKIT_GLUE_WEBACCESSIBILITYMANAGER_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_WEBACCESSIBILITYMANAGER_IMPL_H_ |
6 #define WEBKIT_GLUE_WEBACCESSIBILITYMANAGER_IMPL_H_ | 6 #define WEBKIT_GLUE_WEBACCESSIBILITYMANAGER_IMPL_H_ |
7 | 7 |
8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
9 #include "webkit/glue/webaccessibilitymanager.h" | 9 #include "webkit/glue/webaccessibilitymanager.h" |
10 | 10 |
11 class GlueAccessibilityObject; | 11 class GlueAccessibilityObject; |
12 | 12 |
13 namespace webkit_glue { | |
14 typedef base::hash_map<int, GlueAccessibilityObject*> IntToAccObjMap; | |
15 typedef base::hash_map<GlueAccessibilityObject*, int> AccObjToIntMap; | |
16 | |
17 //////////////////////////////////////////////////////////////////////////////// | 13 //////////////////////////////////////////////////////////////////////////////// |
18 // | 14 // |
19 // WebAccessibilityManagerImpl | 15 // WebAccessibilityManagerImpl |
20 // | 16 // |
21 // | 17 // |
22 // Implements WebAccessibilityManager. | 18 // Implements WebAccessibilityManager. |
23 // Responds to incoming accessibility requests from the browser side. Retrieves | 19 // Responds to incoming accessibility requests from the browser side. Retrieves |
24 // the requested information from the active AccessibilityObject, through the | 20 // the requested information from the active AccessibilityObject, through the |
25 // GlueAccessibilityObject. | 21 // GlueAccessibilityObject. |
26 //////////////////////////////////////////////////////////////////////////////// | 22 //////////////////////////////////////////////////////////////////////////////// |
| 23 |
| 24 namespace webkit_glue { |
| 25 |
27 class WebAccessibilityManagerImpl : public WebAccessibilityManager { | 26 class WebAccessibilityManagerImpl : public WebAccessibilityManager { |
28 public: | 27 public: |
29 // From WebAccessibilityManager. | 28 // From WebAccessibilityManager. |
30 bool GetAccObjInfo(WebView* view, const WebAccessibility::InParams& in_params, | 29 bool GetAccObjInfo(WebView* view, const WebAccessibility::InParams& in_params, |
31 WebAccessibility::OutParams* out_params); | 30 WebAccessibility::OutParams* out_params); |
32 | |
33 // From WebAccessibilityManager. | |
34 bool ClearAccObjMap(int acc_obj_id, bool clear_all); | 31 bool ClearAccObjMap(int acc_obj_id, bool clear_all); |
| 32 int FocusAccObj(WebCore::AccessibilityObject* acc_obj); |
35 | 33 |
36 protected: | 34 protected: |
37 // Needed so WebAccessibilityManager::Create can call our constructor. | 35 // Needed so WebAccessibilityManager::Create can call our constructor. |
38 friend class WebAccessibilityManager; | 36 friend class WebAccessibilityManager; |
39 | 37 |
40 WebAccessibilityManagerImpl(); | 38 WebAccessibilityManagerImpl(); |
41 ~WebAccessibilityManagerImpl() {} | 39 ~WebAccessibilityManagerImpl(); |
42 | 40 |
43 private: | 41 private: |
44 // From WebAccessibilityManager. | 42 // From WebAccessibilityManager. |
45 bool InitAccObjRoot(WebView* view); | 43 bool InitAccObjRoot(WebView* view); |
46 | 44 |
47 // Wrapper around the pointer that holds the root of the AccessibilityObject | 45 // Wrapper around the pointer that holds the root of the AccessibilityObject |
48 // tree, to allow the use of a scoped_refptr. | 46 // tree, to allow the use of a scoped_refptr. |
49 struct GlueAccessibilityObjectRoot; | 47 struct GlueAccessibilityObjectRoot; |
50 GlueAccessibilityObjectRoot* root_; | 48 GlueAccessibilityObjectRoot* root_; |
51 | 49 |
| 50 typedef base::hash_map<int, GlueAccessibilityObject*> IntToGlueAccObjMap; |
| 51 typedef base::hash_map<WebCore::AccessibilityObject*, int> AccObjToIntMap; |
| 52 |
52 // Hashmap for cashing of elements in use by the AT, mapping id (int) to a | 53 // Hashmap for cashing of elements in use by the AT, mapping id (int) to a |
53 // GlueAccessibilityObject pointer. | 54 // GlueAccessibilityObject pointer. |
54 IntToAccObjMap int_to_acc_obj_map_; | 55 IntToGlueAccObjMap int_to_glue_acc_obj_map_; |
55 // Hashmap for cashing of elements in use by the AT, mapping a | 56 // Hashmap for cashing of elements in use by the AT, mapping a |
56 // GlueAccessibilityObject pointer to its id (int). Needed for reverse lookup, | 57 // AccessibilityObject pointer to its id (int). Needed for reverse lookup, |
57 // to ensure unnecessary duplicate entries are not created in the | 58 // to ensure unnecessary duplicate entries are not created in the |
58 // IntToAccObjMap (above). | 59 // IntToGlueAccObjMap (above) and for focus changes in WebKit. |
59 AccObjToIntMap acc_obj_to_int_map_; | 60 AccObjToIntMap acc_obj_to_int_map_; |
60 | 61 |
61 // Unique identifier for retrieving a GlueAccessibilityObject from the page's | 62 // Unique identifier for retrieving an accessibility object from the page's |
62 // hashmaps. | 63 // hashmaps. Id is always 0 for the root of the accessibility object |
| 64 // hierarchy (on a per-renderer process basis). |
63 int acc_obj_id_; | 65 int acc_obj_id_; |
64 | 66 |
65 DISALLOW_COPY_AND_ASSIGN(WebAccessibilityManagerImpl); | 67 DISALLOW_COPY_AND_ASSIGN(WebAccessibilityManagerImpl); |
66 }; | 68 }; |
67 | 69 |
68 } // namespace webkit_glue | 70 } // namespace webkit_glue |
69 | 71 |
70 #endif // WEBKIT_GLUE_WEBACCESSIBILITYMANAGER_IMPL_H_ | 72 #endif // WEBKIT_GLUE_WEBACCESSIBILITYMANAGER_IMPL_H_ |
OLD | NEW |