| 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_GLUE_ACCESSIBILITY_H_ | |
| 6 #define WEBKIT_GLUE_GLUE_ACCESSIBILITY_H_ | |
| 7 | |
| 8 #if defined(OS_WIN) | |
| 9 #include <oleacc.h> | |
| 10 #else | |
| 11 // TODO(port): need an equivalent of | |
| 12 // http://msdn.microsoft.com/en-us/library/accessibility.iaccessible.aspx | |
| 13 class IAccessible; | |
| 14 #endif | |
| 15 | |
| 16 #include "base/hash_tables.h" | |
| 17 #include "base/ref_counted.h" | |
| 18 #include "chrome/common/accessibility.h" | |
| 19 | |
| 20 class WebView; | |
| 21 | |
| 22 template <typename T> class COMPtr; | |
| 23 | |
| 24 typedef base::hash_map<int, scoped_refptr<IAccessible> > IntToIAccessibleMap; | |
| 25 typedef base::hash_map<IAccessible*, int> IAccessibleToIntMap; | |
| 26 | |
| 27 //////////////////////////////////////////////////////////////////////////////// | |
| 28 // | |
| 29 // GlueAccessibility | |
| 30 // | |
| 31 // Operations that access the underlying WebKit DOM directly, exposing | |
| 32 // accessibility information. | |
| 33 //////////////////////////////////////////////////////////////////////////////// | |
| 34 class GlueAccessibility { | |
| 35 public: | |
| 36 GlueAccessibility(); | |
| 37 ~GlueAccessibility(); | |
| 38 | |
| 39 // Retrieves the IAccessible information as requested in in_params, by calling | |
| 40 // into WebKit's implementation of IAccessible. Maintains a hashmap of the | |
| 41 // currently active (browser ref count not zero) IAccessibles. Returns true if | |
| 42 // successful, false otherwise. | |
| 43 bool GetAccessibilityInfo(WebView* view, | |
| 44 const AccessibilityInParams& in_params, | |
| 45 AccessibilityOutParams* out_params); | |
| 46 | |
| 47 // Erases the entry identified by the |iaccessible_id| from the hash map. If | |
| 48 // |clear_all| is true, all entries are erased. Returns true if successful, | |
| 49 // false otherwise. | |
| 50 bool ClearIAccessibleMap(int iaccessible_id, bool clear_all); | |
| 51 | |
| 52 private: | |
| 53 // Retrieves the RenderObject associated with this WebView, and uses it to | |
| 54 // initialize the root of the render-side MSAA tree with the associated | |
| 55 // accessibility information. Returns true if successful, false otherwise. | |
| 56 bool InitAccessibilityRoot(WebView* view); | |
| 57 | |
| 58 // Wrapper around the COM pointer that holds the root of the MSAA tree, to | |
| 59 // ensure that we are not requiring WebKit includes outside of glue. | |
| 60 struct GlueAccessibilityRoot; | |
| 61 GlueAccessibilityRoot* root_; | |
| 62 | |
| 63 // Hashmap for cashing of elements in use by the AT, mapping id (int) to an | |
| 64 // IAccessible pointer. | |
| 65 IntToIAccessibleMap int_to_iaccessible_map_; | |
| 66 // Hashmap for cashing of elements in use by the AT, mapping an IAccessible | |
| 67 // pointer to its id (int). Needed for reverse lookup, to ensure unnecessary | |
| 68 // duplicate entries are not created in the IntToIAccessibleMap (above). | |
| 69 IAccessibleToIntMap iaccessible_to_int_map_; | |
| 70 | |
| 71 // Unique identifier for retrieving an IAccessible from the page's hashmap. | |
| 72 int iaccessible_id_; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(GlueAccessibility); | |
| 75 }; | |
| 76 | |
| 77 #endif // WEBKIT_GLUE_GLUE_ACCESSIBILITY_H_ | |
| OLD | NEW |