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