Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: chrome/browser/browser_accessibility_manager.h

Issue 2830005: Rename browser_accessibility to browser_accessibility_win, and same for... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_
6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_
7
8 #include <atlbase.h>
9 #include <atlcom.h>
10 #include <oleacc.h>
11
12 #include <map>
13
14 #include "base/hash_tables.h"
15 #include "base/scoped_comptr_win.h"
16 #include "base/scoped_ptr.h"
17 #include "webkit/glue/webaccessibility.h"
18
19 class BrowserAccessibility;
20 class RenderProcessHost;
21 class RenderWidgetHost;
22
23 class BrowserAccessibilityFactory {
24 public:
25 virtual ~BrowserAccessibilityFactory() {}
26
27 // Create an instance of BrowserAccessibility and return a new
28 // reference to it.
29 virtual BrowserAccessibility* Create();
30 };
31
32 // Class that can perform actions on behalf of the BrowserAccessibilityManager.
33 class BrowserAccessibilityDelegate {
34 public:
35 virtual ~BrowserAccessibilityDelegate() {}
36 virtual void SetAccessibilityFocus(int acc_obj_id) = 0;
37 virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0;
38 };
39
40 // Manages a tree of BrowserAccessibility objects.
41 class BrowserAccessibilityManager {
42 public:
43 BrowserAccessibilityManager(
44 HWND parent_hwnd,
45 const webkit_glue::WebAccessibility& src,
46 BrowserAccessibilityDelegate* delegate,
47 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
48
49 virtual ~BrowserAccessibilityManager();
50
51 // Return a pointer to the root of the tree, does not make a new reference.
52 BrowserAccessibility* GetRoot();
53
54 // Return a pointer to the object corresponding to the given child_id,
55 // does not make a new reference.
56 BrowserAccessibility* GetFromChildID(LONG child_id);
57
58 // Get a the default IAccessible for the parent window, does not make a
59 // new reference.
60 IAccessible* GetParentWindowIAccessible();
61
62 // Get the parent window.
63 HWND GetParentHWND();
64
65 // Return the object that has focus, if it's a descandant of the
66 // given root (inclusive). Does not make a new reference.
67 BrowserAccessibility* GetFocus(BrowserAccessibility* root);
68
69 // Tell the renderer to set focus to this node.
70 void SetFocus(const BrowserAccessibility& node);
71
72 // Tell the renderer to do the default action for this node.
73 void DoDefaultAction(const BrowserAccessibility& node);
74
75 // Called when the renderer process has notified us of a focus or state
76 // change. Send a notification to MSAA clients of the change.
77 void OnAccessibilityFocusChange(int acc_obj_id);
78 void OnAccessibilityObjectStateChange(int acc_obj_id);
79
80 private:
81 // Recursively build a tree of BrowserAccessibility objects from
82 // the WebAccessibility tree received from the renderer process.
83 BrowserAccessibility* CreateAccessibilityTree(
84 BrowserAccessibility* parent,
85 const webkit_glue::WebAccessibility& src,
86 int index_in_parent);
87
88 // The parent window.
89 HWND parent_hwnd_;
90
91 // The object that can perform actions on our behalf.
92 BrowserAccessibilityDelegate* delegate_;
93
94 // Factory to create BrowserAccessibility objects (for dependency injection).
95 scoped_ptr<BrowserAccessibilityFactory> factory_;
96
97 // A default IAccessible instance for the parent window.
98 ScopedComPtr<IAccessible> window_iaccessible_;
99
100 // The root of the tree of IAccessible objects and the element that
101 // currently has focus, if any.
102 BrowserAccessibility* root_;
103 BrowserAccessibility* focus_;
104
105 // A mapping from the IDs of objects in the renderer, to the child IDs
106 // we use internally here.
107 base::hash_map<int, LONG> renderer_id_to_child_id_map_;
108
109 // A mapping from child IDs to BrowserAccessibility objects.
110 base::hash_map<LONG, BrowserAccessibility*> child_id_map_;
111
112 // The next child ID to use; static so that they're global to the process.
113 // Screen readers cache these IDs to see if they've seen the same object
114 // before so we should avoid reusing them within the same project.
115 static LONG next_child_id_;
116
117 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager);
118 };
119
120 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/browser_accessibility.cc ('k') | chrome/browser/browser_accessibility_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698