[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. |
dmazzoni | 9b381f3 | 2015-01-27 00:34:08 | [diff] [blame] | 37 | void MaybeCallNotifyWinEvent(DWORD event, BrowserAccessibility* node); |
[email protected] | 3144b89 | 2013-05-25 01:14:45 | [diff] [blame] | 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 |
dmazzoni | bf8cec4 | 2015-02-08 08:28:08 | [diff] [blame] | 44 | void OnWindowFocused() override; |
45 | void UserIsReloading() override; | ||||
46 | void NotifyAccessibilityEvent( | ||||
anand.ratn | dbd9edd | 2014-10-07 14:36:10 | [diff] [blame] | 47 | ui::AXEvent event_type, BrowserAccessibility* node) override; |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 48 | |
[email protected] | b2ae783 | 2012-02-11 00:28:00 | [diff] [blame] | 49 | // Track this object and post a VISIBLE_DATA_CHANGED notification when |
50 | // its container scrolls. | ||||
51 | // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. | ||||
52 | void TrackScrollingObject(BrowserAccessibilityWin* node); | ||||
53 | |||||
[email protected] | d1ba019 | 2013-04-10 04:36:22 | [diff] [blame] | 54 | // Return a pointer to the object corresponding to the given windows-specific |
55 | // unique id, does not make a new reference. | ||||
56 | BrowserAccessibilityWin* GetFromUniqueIdWin(LONG unique_id_win); | ||||
57 | |||||
[email protected] | a6b2aa5 | 2013-11-30 05:16:02 | [diff] [blame] | 58 | // Called when |accessible_hwnd_| is deleted by its parent. |
59 | void OnAccessibleHwndDeleted(); | ||||
60 | |||||
[email protected] | 2aafe92 | 2014-04-08 08:26:50 | [diff] [blame] | 61 | protected: |
62 | // BrowserAccessibilityManager methods | ||||
dmazzoni | a4b4891 | 2015-01-24 00:08:56 | [diff] [blame] | 63 | void OnAtomicUpdateFinished( |
64 | bool root_changed, | ||||
65 | const std::vector<ui::AXTreeDelegate::Change>& changes) override; | ||||
[email protected] | 2aafe92 | 2014-04-08 08:26:50 | [diff] [blame] | 66 | |
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 67 | private: |
[email protected] | f27e81c | 2010-10-07 05:20:23 | [diff] [blame] | 68 | // Give BrowserAccessibilityManager::Create access to our constructor. |
69 | friend class BrowserAccessibilityManager; | ||||
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 70 | |
[email protected] | b2ae783 | 2012-02-11 00:28:00 | [diff] [blame] | 71 | // Track the most recent object that has been asked to scroll and |
72 | // post a notification directly on it when it reaches its destination. | ||||
73 | // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. | ||||
74 | BrowserAccessibilityWin* tracked_scroll_object_; | ||||
75 | |||||
[email protected] | d1ba019 | 2013-04-10 04:36:22 | [diff] [blame] | 76 | // A mapping from the Windows-specific unique IDs (unique within the |
[email protected] | d96f384 | 2014-04-21 18:07:29 | [diff] [blame] | 77 | // browser process) to accessibility ids within this page. |
78 | base::hash_map<long, int32> unique_id_to_ax_id_map_; | ||||
[email protected] | d1ba019 | 2013-04-10 04:36:22 | [diff] [blame] | 79 | |
[email protected] | d2b32fd | 2014-06-19 07:53:45 | [diff] [blame] | 80 | // Set to true if we need to fire a focus event on the root as soon as |
81 | // possible. | ||||
82 | bool focus_event_on_root_needed_; | ||||
83 | |||||
[email protected] | c5c2a67 | 2010-10-01 23:28:04 | [diff] [blame] | 84 | DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin); |
85 | }; | ||||
86 | |||||
[email protected] | e6b3487 | 2012-10-24 20:51:32 | [diff] [blame] | 87 | } // namespace content |
88 | |||||
[email protected] | ba1fa65 | 2011-06-25 05:16:22 | [diff] [blame] | 89 | #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ |