blob: 8eaa9490c85c94bd426f90446cf9d538c367264c [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.
37 void MaybeCallNotifyWinEvent(DWORD event, LONG child_id);
38
[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
anand.ratndbd9edd2014-10-07 14:36:1044 virtual void OnWindowFocused() override;
[email protected]10760e4a2013-09-04 23:32:2045 virtual void NotifyAccessibilityEvent(
anand.ratndbd9edd2014-10-07 14:36:1046 ui::AXEvent event_type, BrowserAccessibility* node) override;
[email protected]c5c2a672010-10-01 23:28:0447
[email protected]b2ae7832012-02-11 00:28:0048 // 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]d1ba0192013-04-10 04:36:2253 // 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]a6b2aa52013-11-30 05:16:0257 // Called when |accessible_hwnd_| is deleted by its parent.
58 void OnAccessibleHwndDeleted();
59
[email protected]2aafe922014-04-08 08:26:5060 protected:
61 // BrowserAccessibilityManager methods
anand.ratndbd9edd2014-10-07 14:36:1062 virtual void OnRootChanged(ui::AXNode* new_root) override;
[email protected]2aafe922014-04-08 08:26:5063
[email protected]c5c2a672010-10-01 23:28:0464 private:
[email protected]f27e81c2010-10-07 05:20:2365 // Give BrowserAccessibilityManager::Create access to our constructor.
66 friend class BrowserAccessibilityManager;
[email protected]c5c2a672010-10-01 23:28:0467
[email protected]b2ae7832012-02-11 00:28:0068 // Track the most recent object that has been asked to scroll and
69 // post a notification directly on it when it reaches its destination.
70 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed.
71 BrowserAccessibilityWin* tracked_scroll_object_;
72
[email protected]d1ba0192013-04-10 04:36:2273 // A mapping from the Windows-specific unique IDs (unique within the
[email protected]d96f3842014-04-21 18:07:2974 // browser process) to accessibility ids within this page.
75 base::hash_map<long, int32> unique_id_to_ax_id_map_;
[email protected]d1ba0192013-04-10 04:36:2276
[email protected]d2b32fd2014-06-19 07:53:4577 // Set to true if we need to fire a focus event on the root as soon as
78 // possible.
79 bool focus_event_on_root_needed_;
80
[email protected]c5c2a672010-10-01 23:28:0481 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin);
82};
83
[email protected]e6b34872012-10-24 20:51:3284} // namespace content
85
[email protected]ba1fa652011-06-25 05:16:2286#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_