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