[email protected] | b2ae783 | 2012-02-11 00:28:00 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | ba1fa65 | 2011-06-25 05:16:22 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ |
6 | #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ | ||||
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 7 | |
[email protected] | 20bb006 | 2010-10-06 21:24:37 | [diff] [blame] | 8 | #include <oleacc.h> |
9 | |||||
[email protected] | f3be3343 | 2013-10-18 03:36:15 | [diff] [blame] | 10 | #include "base/memory/scoped_ptr.h" |
[email protected] | 8ee65ba | 2011-04-12 20:53:23 | [diff] [blame] | 11 | #include "base/win/scoped_comptr.h" |
[email protected] | ba1fa65 | 2011-06-25 05:16:22 | [diff] [blame] | 12 | #include "content/browser/accessibility/browser_accessibility_manager.h" |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 13 | |
[email protected] | e6b3487 | 2012-10-24 20:51:32 | [diff] [blame] | 14 | namespace content { |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 15 | class BrowserAccessibilityWin; |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 16 | |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 17 | // Manages a tree of BrowserAccessibilityWin objects. |
[email protected] | a6120e3 | 2013-03-15 11:07:35 | [diff] [blame] | 18 | class CONTENT_EXPORT BrowserAccessibilityManagerWin |
19 | : public BrowserAccessibilityManager { | ||||
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 20 | public: |
[email protected] | a6120e3 | 2013-03-15 11:07:35 | [diff] [blame] | 21 | BrowserAccessibilityManagerWin( |
[email protected] | d96f384 | 2014-04-21 18:07:29 | [diff] [blame] | 22 | const ui::AXTreeUpdate& initial_tree, |
[email protected] | a6120e3 | 2013-03-15 11:07:35 | [diff] [blame] | 23 | BrowserAccessibilityDelegate* delegate, |
24 | BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); | ||||
25 | |||||
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 26 | virtual ~BrowserAccessibilityManagerWin(); |
27 | |||||
[email protected] | d96f384 | 2014-04-21 18:07:29 | [diff] [blame] | 28 | static ui::AXTreeUpdate GetEmptyDocument(); |
[email protected] | a6120e3 | 2013-03-15 11:07:35 | [diff] [blame] | 29 | |
30 | // Get the closest containing HWND. | ||||
[email protected] | cab97b815 | 2014-07-26 23:34:40 | [diff] [blame] | 31 | HWND GetParentHWND(); |
[email protected] | a6120e3 | 2013-03-15 11:07:35 | [diff] [blame] | 32 | |
[email protected] | afe8375 | 2013-03-20 01:58:41 | [diff] [blame] | 33 | // The IAccessible for the parent window. |
[email protected] | cab97b815 | 2014-07-26 23:34:40 | [diff] [blame] | 34 | IAccessible* GetParentIAccessible(); |
[email protected] | 9dc9d503 | 2014-06-13 06:57:49 | [diff] [blame] | 35 | |
[email protected] | 3144b89 | 2013-05-25 01:14:45 | [diff] [blame] | 36 | // Calls NotifyWinEvent if the parent window's IAccessible pointer is known. |
37 | void MaybeCallNotifyWinEvent(DWORD event, LONG child_id); | ||||
38 | |||||
[email protected] | d96f384 | 2014-04-21 18:07:29 | [diff] [blame] | 39 | // AXTree methods |
anand.ratn | dbd9edd | 2014-10-07 14:36:10 | [diff] [blame] | 40 | virtual void OnNodeWillBeDeleted(ui::AXNode* node) override; |
41 | virtual void OnNodeCreated(ui::AXNode* node) override; | ||||
[email protected] | d96f384 | 2014-04-21 18:07:29 | [diff] [blame] | 42 | |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 43 | // BrowserAccessibilityManager methods |
anand.ratn | dbd9edd | 2014-10-07 14:36:10 | [diff] [blame] | 44 | virtual void OnWindowFocused() override; |
[email protected] | 10760e4a | 2013-09-04 23:32:20 | [diff] [blame] | 45 | virtual void NotifyAccessibilityEvent( |
anand.ratn | dbd9edd | 2014-10-07 14:36:10 | [diff] [blame] | 46 | ui::AXEvent event_type, BrowserAccessibility* node) override; |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 47 | |
[email protected] | b2ae783 | 2012-02-11 00:28:00 | [diff] [blame] | 48 | // Track this object and post a VISIBLE_DATA_CHANGED notification when |
49 | // its container scrolls. | ||||
50 | // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. | ||||
51 | void TrackScrollingObject(BrowserAccessibilityWin* node); | ||||
52 | |||||
[email protected] | d1ba019 | 2013-04-10 04:36:22 | [diff] [blame] | 53 | // Return a pointer to the object corresponding to the given windows-specific |
54 | // unique id, does not make a new reference. | ||||
55 | BrowserAccessibilityWin* GetFromUniqueIdWin(LONG unique_id_win); | ||||
56 | |||||
[email protected] | a6b2aa5 | 2013-11-30 05:16:02 | [diff] [blame] | 57 | // Called when |accessible_hwnd_| is deleted by its parent. |
58 | void OnAccessibleHwndDeleted(); | ||||
59 | |||||
[email protected] | 2aafe92 | 2014-04-08 08:26:50 | [diff] [blame] | 60 | protected: |
61 | // BrowserAccessibilityManager methods | ||||
dmazzoni | a4b4891 | 2015-01-24 00:08:56 | [diff] [blame^] | 62 | void OnAtomicUpdateFinished( |
63 | bool root_changed, | ||||
64 | const std::vector<ui::AXTreeDelegate::Change>& changes) override; | ||||
[email protected] | 2aafe92 | 2014-04-08 08:26:50 | [diff] [blame] | 65 | |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 66 | private: |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 67 | // Give BrowserAccessibilityManager::Create access to our constructor. |
68 | friend class BrowserAccessibilityManager; | ||||
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 69 | |
[email protected] | b2ae783 | 2012-02-11 00:28:00 | [diff] [blame] | 70 | // Track the most recent object that has been asked to scroll and |
71 | // post a notification directly on it when it reaches its destination. | ||||
72 | // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. | ||||
73 | BrowserAccessibilityWin* tracked_scroll_object_; | ||||
74 | |||||
[email protected] | d1ba019 | 2013-04-10 04:36:22 | [diff] [blame] | 75 | // A mapping from the Windows-specific unique IDs (unique within the |
[email protected] | d96f384 | 2014-04-21 18:07:29 | [diff] [blame] | 76 | // browser process) to accessibility ids within this page. |
77 | base::hash_map<long, int32> unique_id_to_ax_id_map_; | ||||
[email protected] | d1ba019 | 2013-04-10 04:36:22 | [diff] [blame] | 78 | |
[email protected] | d2b32fd | 2014-06-19 07:53:45 | [diff] [blame] | 79 | // Set to true if we need to fire a focus event on the root as soon as |
80 | // possible. | ||||
81 | bool focus_event_on_root_needed_; | ||||
82 | |||||
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 83 | DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin); |
84 | }; | ||||
85 | |||||
[email protected] | e6b3487 | 2012-10-24 20:51:32 | [diff] [blame] | 86 | } // namespace content |
87 | |||||
[email protected] | ba1fa65 | 2011-06-25 05:16:22 | [diff] [blame] | 88 | #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ |