OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 // Notify the accessibility manager about page navigation. | 165 // Notify the accessibility manager about page navigation. |
166 void UserIsNavigatingAway(); | 166 void UserIsNavigatingAway(); |
167 virtual void UserIsReloading(); | 167 virtual void UserIsReloading(); |
168 void NavigationSucceeded(); | 168 void NavigationSucceeded(); |
169 void NavigationFailed(); | 169 void NavigationFailed(); |
170 | 170 |
171 // Called to notify the accessibility manager that a mouse down event | 171 // Called to notify the accessibility manager that a mouse down event |
172 // occurred in the tab. | 172 // occurred in the tab. |
173 void GotMouseDown(); | 173 void GotMouseDown(); |
174 | 174 |
175 // Update the focused node to |node|, which may be null. | 175 // Send a message to the renderer to set focus to this node. |
176 // If |notify| is true, send a message to the renderer to set focus | 176 void SetFocus(const BrowserAccessibility& node); |
177 // to this node. | |
178 void SetFocus(ui::AXNode* node, bool notify); | |
179 void SetFocus(BrowserAccessibility* node, bool notify); | |
180 | 177 |
181 // Tell the renderer to do the default action for this node. | 178 // Tell the renderer to do the default action for this node. |
182 void DoDefaultAction(const BrowserAccessibility& node); | 179 void DoDefaultAction(const BrowserAccessibility& node); |
183 | 180 |
184 // Tell the renderer to scroll to make |node| visible. | 181 // Tell the renderer to scroll to make |node| visible. |
185 // In addition, if it's not possible to make the entire object visible, | 182 // In addition, if it's not possible to make the entire object visible, |
186 // scroll so that the |subfocus| rect is visible at least. The subfocus | 183 // scroll so that the |subfocus| rect is visible at least. The subfocus |
187 // rect is in local coordinates of the object itself. | 184 // rect is in local coordinates of the object itself. |
188 void ScrollToMakeVisible( | 185 void ScrollToMakeVisible( |
189 const BrowserAccessibility& node, gfx::Rect subfocus); | 186 const BrowserAccessibility& node, gfx::Rect subfocus); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 | 238 |
242 #if defined(OS_ANDROID) | 239 #if defined(OS_ANDROID) |
243 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); | 240 BrowserAccessibilityManagerAndroid* ToBrowserAccessibilityManagerAndroid(); |
244 #endif | 241 #endif |
245 | 242 |
246 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) | 243 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) |
247 BrowserAccessibilityManagerAuraLinux* | 244 BrowserAccessibilityManagerAuraLinux* |
248 ToBrowserAccessibilityManagerAuraLinux(); | 245 ToBrowserAccessibilityManagerAuraLinux(); |
249 #endif | 246 #endif |
250 | 247 |
251 // Return the object that has focus, if it's a descendant of the | 248 // Return the object that has focus. |
252 // given root (inclusive). Does not make a new reference. | 249 virtual BrowserAccessibility* GetFocus(); |
253 virtual BrowserAccessibility* GetFocus(BrowserAccessibility* root); | |
254 | 250 |
255 // Return the descentant of the given root that has focus, or that object's | 251 // Return the descentant of the given root that has focus, or that object's |
256 // active descendant if it has one. | 252 // active descendant if it has one. |
257 BrowserAccessibility* GetActiveDescendantFocus(BrowserAccessibility* root); | 253 BrowserAccessibility* GetActiveDescendantFocus(); |
258 | 254 |
259 // Returns true if native focus is anywhere in this WebContents or not. | 255 // Returns true if native focus is anywhere in this WebContents or not. |
260 bool NativeViewHasFocus(); | 256 bool NativeViewHasFocus(); |
261 | 257 |
262 // True by default, but some platforms want to treat the root | 258 // True by default, but some platforms want to treat the root |
263 // scroll offsets separately. | 259 // scroll offsets separately. |
264 virtual bool UseRootScrollOffsetsWhenComputingBounds(); | 260 virtual bool UseRootScrollOffsetsWhenComputingBounds(); |
265 | 261 |
266 // Walk the tree. | 262 // Walk the tree. |
267 BrowserAccessibility* NextInTreeOrder(BrowserAccessibility* node) const; | 263 BrowserAccessibility* NextInTreeOrder(BrowserAccessibility* node) const; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 protected: | 329 protected: |
334 // The object that can perform actions on our behalf. | 330 // The object that can perform actions on our behalf. |
335 BrowserAccessibilityDelegate* delegate_; | 331 BrowserAccessibilityDelegate* delegate_; |
336 | 332 |
337 // Factory to create BrowserAccessibility objects (for dependency injection). | 333 // Factory to create BrowserAccessibility objects (for dependency injection). |
338 scoped_ptr<BrowserAccessibilityFactory> factory_; | 334 scoped_ptr<BrowserAccessibilityFactory> factory_; |
339 | 335 |
340 // The underlying tree of accessibility objects. | 336 // The underlying tree of accessibility objects. |
341 scoped_ptr<ui::AXSerializableTree> tree_; | 337 scoped_ptr<ui::AXSerializableTree> tree_; |
342 | 338 |
343 // The node that currently has focus. | |
344 ui::AXNode* focus_; | |
345 | |
346 // A mapping from a node id to its wrapper of type BrowserAccessibility. | 339 // A mapping from a node id to its wrapper of type BrowserAccessibility. |
347 base::hash_map<int32_t, BrowserAccessibility*> id_wrapper_map_; | 340 base::hash_map<int32_t, BrowserAccessibility*> id_wrapper_map_; |
348 | 341 |
349 // True if the user has initiated a navigation to another page. | 342 // True if the user has initiated a navigation to another page. |
350 bool user_is_navigating_away_; | 343 bool user_is_navigating_away_; |
351 | 344 |
352 // The on-screen keyboard state. | 345 // The on-screen keyboard state. |
353 OnScreenKeyboardState osk_state_; | 346 OnScreenKeyboardState osk_state_; |
354 | 347 |
355 BrowserAccessibilityFindInPageInfo find_in_page_info_; | 348 BrowserAccessibilityFindInPageInfo find_in_page_info_; |
356 | 349 |
357 // The global ID of this accessibility tree. | 350 // The global ID of this accessibility tree. |
358 AXTreeIDRegistry::AXTreeID ax_tree_id_; | 351 AXTreeIDRegistry::AXTreeID ax_tree_id_; |
359 | 352 |
360 // If this tree has a parent tree, this is the cached ID of the parent | 353 // If this tree has a parent tree, this is the cached ID of the parent |
361 // node within that parent tree. It's computed as needed and cached for | 354 // node within that parent tree. It's computed as needed and cached for |
362 // speed so that it can be accessed quickly if it hasn't changed. | 355 // speed so that it can be accessed quickly if it hasn't changed. |
363 int parent_node_id_from_parent_tree_; | 356 int parent_node_id_from_parent_tree_; |
364 | 357 |
365 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); | 358 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManager); |
366 }; | 359 }; |
367 | 360 |
368 } // namespace content | 361 } // namespace content |
369 | 362 |
370 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ | 363 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_H_ |
OLD | NEW |