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

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

Issue 3117036: Update browser cache of accessibility tree on renderer sub-tree changes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Updating from comments. Created 10 years, 3 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
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 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 CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ 5 #ifndef CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ 6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <atlbase.h> 9 #include <atlbase.h>
10 #include <atlcom.h> 10 #include <atlcom.h>
11 #include <oleacc.h> 11 #include <oleacc.h>
12 12
13 #include <hash_map>
14 #include <vector>
15
13 #include "base/hash_tables.h" 16 #include "base/hash_tables.h"
14 #include "base/scoped_comptr_win.h" 17 #include "base/scoped_comptr_win.h"
15 #include "base/scoped_ptr.h" 18 #include "base/scoped_ptr.h"
16 #include "webkit/glue/webaccessibility.h" 19 #include "webkit/glue/webaccessibility.h"
17 20
18 class BrowserAccessibility; 21 class BrowserAccessibility;
19 22
20 class BrowserAccessibilityFactory { 23 class BrowserAccessibilityFactory {
21 public: 24 public:
22 virtual ~BrowserAccessibilityFactory() {} 25 virtual ~BrowserAccessibilityFactory() {}
23 26
24 // Create an instance of BrowserAccessibility and return a new 27 // Create an instance of BrowserAccessibility and return a new
25 // reference to it. 28 // reference to it.
26 virtual BrowserAccessibility* Create(); 29 virtual BrowserAccessibility* Create();
27 }; 30 };
28 31
29 // Class that can perform actions on behalf of the BrowserAccessibilityManager. 32 // Class that can perform actions on behalf of the BrowserAccessibilityManager.
30 class BrowserAccessibilityDelegate { 33 class BrowserAccessibilityDelegate {
31 public: 34 public:
32 virtual ~BrowserAccessibilityDelegate() {} 35 virtual ~BrowserAccessibilityDelegate() {}
33 virtual void SetAccessibilityFocus(int acc_obj_id) = 0; 36 virtual void SetAccessibilityFocus(int acc_obj_id) = 0;
34 virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0; 37 virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0;
38 virtual void AccessibilityObjectChildrenChangeAck() = 0;
35 }; 39 };
36 40
37 // Manages a tree of BrowserAccessibility objects. 41 // Manages a tree of BrowserAccessibility objects.
38 class BrowserAccessibilityManager { 42 class BrowserAccessibilityManager {
39 public: 43 public:
40 BrowserAccessibilityManager( 44 BrowserAccessibilityManager(
41 HWND parent_hwnd, 45 HWND parent_hwnd,
42 const webkit_glue::WebAccessibility& src, 46 const webkit_glue::WebAccessibility& src,
43 BrowserAccessibilityDelegate* delegate, 47 BrowserAccessibilityDelegate* delegate,
44 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); 48 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
45 49
46 virtual ~BrowserAccessibilityManager(); 50 virtual ~BrowserAccessibilityManager();
47 51
48 // Return a pointer to the root of the tree, does not make a new reference. 52 // Return a pointer to the root of the tree, does not make a new reference.
49 BrowserAccessibility* GetRoot(); 53 BrowserAccessibility* GetRoot();
50 54
55 // Removes the BrowserAccessibility child_id from the manager.
56 void Remove(LONG child_id);
57
51 // Return a pointer to the object corresponding to the given child_id, 58 // Return a pointer to the object corresponding to the given child_id,
52 // does not make a new reference. 59 // does not make a new reference.
53 BrowserAccessibility* GetFromChildID(LONG child_id); 60 BrowserAccessibility* GetFromChildID(LONG child_id);
54 61
55 // Get a the default IAccessible for the parent window, does not make a 62 // Get a the default IAccessible for the parent window, does not make a
56 // new reference. 63 // new reference.
57 IAccessible* GetParentWindowIAccessible(); 64 IAccessible* GetParentWindowIAccessible();
58 65
59 // Get the parent window. 66 // Get the parent window.
60 HWND GetParentHWND(); 67 HWND GetParentHWND();
61 68
62 // Return the object that has focus, if it's a descandant of the 69 // Return the object that has focus, if it's a descandant of the
63 // given root (inclusive). Does not make a new reference. 70 // given root (inclusive). Does not make a new reference.
64 BrowserAccessibility* GetFocus(BrowserAccessibility* root); 71 BrowserAccessibility* GetFocus(BrowserAccessibility* root);
65 72
66 // Tell the renderer to set focus to this node. 73 // Tell the renderer to set focus to this node.
67 void SetFocus(const BrowserAccessibility& node); 74 void SetFocus(const BrowserAccessibility& node);
68 75
69 // Tell the renderer to do the default action for this node. 76 // Tell the renderer to do the default action for this node.
70 void DoDefaultAction(const BrowserAccessibility& node); 77 void DoDefaultAction(const BrowserAccessibility& node);
71 78
72 // Called when the renderer process has notified us of a focus or state 79 // Called when the renderer process has notified us of a focus, state,
73 // change. Send a notification to MSAA clients of the change. 80 // or children change. Send a notification to MSAA clients of the change.
74 void OnAccessibilityFocusChange(int acc_obj_id); 81 void OnAccessibilityFocusChange(int acc_obj_id);
75 void OnAccessibilityObjectStateChange(int acc_obj_id); 82 void OnAccessibilityObjectStateChange(int acc_obj_id);
83 void OnAccessibilityObjectChildrenChange(
84 const std::vector<webkit_glue::WebAccessibility>& acc_changes);
76 85
77 private: 86 private:
87 // Returns the next MSAA child id.
88 static LONG GetNextChildID();
89
78 // Recursively build a tree of BrowserAccessibility objects from 90 // Recursively build a tree of BrowserAccessibility objects from
79 // the WebAccessibility tree received from the renderer process. 91 // the WebAccessibility tree received from the renderer process.
80 BrowserAccessibility* CreateAccessibilityTree( 92 BrowserAccessibility* CreateAccessibilityTree(
81 BrowserAccessibility* parent, 93 BrowserAccessibility* parent,
94 int child_id,
82 const webkit_glue::WebAccessibility& src, 95 const webkit_glue::WebAccessibility& src,
83 int index_in_parent); 96 int index_in_parent);
84 97
85 // The parent window. 98 // The parent window.
86 HWND parent_hwnd_; 99 HWND parent_hwnd_;
87 100
88 // The object that can perform actions on our behalf. 101 // The object that can perform actions on our behalf.
89 BrowserAccessibilityDelegate* delegate_; 102 BrowserAccessibilityDelegate* delegate_;
90 103
91 // Factory to create BrowserAccessibility objects (for dependency injection). 104 // Factory to create BrowserAccessibility objects (for dependency injection).
(...skipping 16 matching lines...) Expand all
108 121
109 // The next child ID to use; static so that they're global to the process. 122 // The next child ID to use; static so that they're global to the process.
110 // Screen readers cache these IDs to see if they've seen the same object 123 // Screen readers cache these IDs to see if they've seen the same object
111 // before so we should avoid reusing them within the same project. 124 // before so we should avoid reusing them within the same project.
112 static LONG next_child_id_; 125 static LONG next_child_id_;
113 126
114 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); 127 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager);
115 }; 128 };
116 129
117 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ 130 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
OLDNEW
« no previous file with comments | « chrome/browser/accessibility_win_browsertest.cc ('k') | chrome/browser/browser_accessibility_manager_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698