blob: 24c0b77ee7bc4610dab7e62c4a130dcafb643f5d [file] [log] [blame]
[email protected]b2ae7832012-02-11 00:28:001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]c5c2a672010-10-01 23:28:042// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]ba1fa652011-06-25 05:16:225#ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
6#define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
[email protected]c5c2a672010-10-01 23:28:047
[email protected]20bb0062010-10-06 21:24:378#include <oleacc.h>
9
[email protected]f3be33432013-10-18 03:36:1510#include "base/memory/scoped_ptr.h"
[email protected]8ee65ba2011-04-12 20:53:2311#include "base/win/scoped_comptr.h"
[email protected]ba1fa652011-06-25 05:16:2212#include "content/browser/accessibility/browser_accessibility_manager.h"
[email protected]c5c2a672010-10-01 23:28:0413
[email protected]e6b34872012-10-24 20:51:3214namespace content {
[email protected]c5c2a672010-10-01 23:28:0415class BrowserAccessibilityWin;
[email protected]c5c2a672010-10-01 23:28:0416
[email protected]c5c2a672010-10-01 23:28:0417// Manages a tree of BrowserAccessibilityWin objects.
[email protected]a6120e32013-03-15 11:07:3518class CONTENT_EXPORT BrowserAccessibilityManagerWin
19 : public BrowserAccessibilityManager {
[email protected]c5c2a672010-10-01 23:28:0420 public:
[email protected]a6120e32013-03-15 11:07:3521 BrowserAccessibilityManagerWin(
[email protected]d96f3842014-04-21 18:07:2922 const ui::AXTreeUpdate& initial_tree,
[email protected]a6120e32013-03-15 11:07:3523 BrowserAccessibilityDelegate* delegate,
24 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
25
[email protected]c5c2a672010-10-01 23:28:0426 virtual ~BrowserAccessibilityManagerWin();
27
[email protected]d96f3842014-04-21 18:07:2928 static ui::AXTreeUpdate GetEmptyDocument();
[email protected]a6120e32013-03-15 11:07:3529
30 // Get the closest containing HWND.
[email protected]cab97b8152014-07-26 23:34:4031 HWND GetParentHWND();
[email protected]a6120e32013-03-15 11:07:3532
[email protected]afe83752013-03-20 01:58:4133 // The IAccessible for the parent window.
[email protected]cab97b8152014-07-26 23:34:4034 IAccessible* GetParentIAccessible();
[email protected]9dc9d5032014-06-13 06:57:4935
[email protected]3144b892013-05-25 01:14:4536 // Calls NotifyWinEvent if the parent window's IAccessible pointer is known.
dmazzoni9b381f32015-01-27 00:34:0837 void MaybeCallNotifyWinEvent(DWORD event, BrowserAccessibility* node);
[email protected]3144b892013-05-25 01:14:4538
[email protected]d96f3842014-04-21 18:07:2939 // AXTree methods
anand.ratndbd9edd2014-10-07 14:36:1040 virtual void OnNodeWillBeDeleted(ui::AXNode* node) override;
41 virtual void OnNodeCreated(ui::AXNode* node) override;
[email protected]d96f3842014-04-21 18:07:2942
[email protected]f27e81c2010-10-07 05:20:2343 // BrowserAccessibilityManager methods
dmazzonibf8cec42015-02-08 08:28:0844 void OnWindowFocused() override;
45 void UserIsReloading() override;
46 void NotifyAccessibilityEvent(
anand.ratndbd9edd2014-10-07 14:36:1047 ui::AXEvent event_type, BrowserAccessibility* node) override;
[email protected]c5c2a672010-10-01 23:28:0448
[email protected]b2ae7832012-02-11 00:28:0049 // 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]d1ba0192013-04-10 04:36:2254 // 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]a6b2aa52013-11-30 05:16:0258 // Called when |accessible_hwnd_| is deleted by its parent.
59 void OnAccessibleHwndDeleted();
60
[email protected]2aafe922014-04-08 08:26:5061 protected:
62 // BrowserAccessibilityManager methods
dmazzonia4b48912015-01-24 00:08:5663 void OnAtomicUpdateFinished(
64 bool root_changed,
65 const std::vector<ui::AXTreeDelegate::Change>& changes) override;
[email protected]2aafe922014-04-08 08:26:5066
[email protected]c5c2a672010-10-01 23:28:0467 private:
[email protected]f27e81c2010-10-07 05:20:2368 // Give BrowserAccessibilityManager::Create access to our constructor.
69 friend class BrowserAccessibilityManager;
[email protected]c5c2a672010-10-01 23:28:0470
[email protected]b2ae7832012-02-11 00:28:0071 // 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]d1ba0192013-04-10 04:36:2276 // A mapping from the Windows-specific unique IDs (unique within the
[email protected]d96f3842014-04-21 18:07:2977 // browser process) to accessibility ids within this page.
78 base::hash_map<long, int32> unique_id_to_ax_id_map_;
[email protected]d1ba0192013-04-10 04:36:2279
[email protected]d2b32fd2014-06-19 07:53:4580 // 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]c5c2a672010-10-01 23:28:0484 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin);
85};
86
[email protected]e6b34872012-10-24 20:51:3287} // namespace content
88
[email protected]ba1fa652011-06-25 05:16:2289#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_