blob: 90914dbe6493bc74a4933c83fee76ea10b380c92 [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]d5169a92014-02-07 00:00:3017class LegacyRenderWidgetHostHWND;
[email protected]f3be33432013-10-18 03:36:1518
[email protected]c5c2a672010-10-01 23:28:0419// Manages a tree of BrowserAccessibilityWin objects.
[email protected]a6120e32013-03-15 11:07:3520class CONTENT_EXPORT BrowserAccessibilityManagerWin
21 : public BrowserAccessibilityManager {
[email protected]c5c2a672010-10-01 23:28:0422 public:
[email protected]a6120e32013-03-15 11:07:3523 BrowserAccessibilityManagerWin(
[email protected]d5169a92014-02-07 00:00:3024 content::LegacyRenderWidgetHostHWND* accessible_hwnd,
[email protected]a6120e32013-03-15 11:07:3525 IAccessible* parent_iaccessible,
[email protected]d96f3842014-04-21 18:07:2926 const ui::AXTreeUpdate& initial_tree,
[email protected]a6120e32013-03-15 11:07:3527 BrowserAccessibilityDelegate* delegate,
28 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
29
[email protected]c5c2a672010-10-01 23:28:0430 virtual ~BrowserAccessibilityManagerWin();
31
[email protected]d96f3842014-04-21 18:07:2932 static ui::AXTreeUpdate GetEmptyDocument();
[email protected]a6120e32013-03-15 11:07:3533
34 // Get the closest containing HWND.
[email protected]afe83752013-03-20 01:58:4135 HWND parent_hwnd() { return parent_hwnd_; }
[email protected]a6120e32013-03-15 11:07:3536
[email protected]afe83752013-03-20 01:58:4137 // The IAccessible for the parent window.
38 IAccessible* parent_iaccessible() { return parent_iaccessible_; }
39 void set_parent_iaccessible(IAccessible* parent_iaccessible) {
40 parent_iaccessible_ = parent_iaccessible;
41 }
[email protected]c5c2a672010-10-01 23:28:0442
[email protected]9dc9d5032014-06-13 06:57:4943 void SetAccessibleHWND(LegacyRenderWidgetHostHWND* accessible_hwnd);
44
[email protected]3144b892013-05-25 01:14:4545 // Calls NotifyWinEvent if the parent window's IAccessible pointer is known.
46 void MaybeCallNotifyWinEvent(DWORD event, LONG child_id);
47
[email protected]d96f3842014-04-21 18:07:2948 // AXTree methods
49 virtual void OnNodeWillBeDeleted(ui::AXNode* node) OVERRIDE;
50 virtual void OnNodeCreated(ui::AXNode* node) OVERRIDE;
51
[email protected]f27e81c2010-10-07 05:20:2352 // BrowserAccessibilityManager methods
[email protected]df9784422014-04-03 19:00:2853 virtual void OnWindowFocused() OVERRIDE;
54 virtual void OnWindowBlurred() OVERRIDE;
[email protected]10760e4a2013-09-04 23:32:2055 virtual void NotifyAccessibilityEvent(
[email protected]5eec2f52014-01-06 22:30:5456 ui::AXEvent event_type, BrowserAccessibility* node) OVERRIDE;
[email protected]c5c2a672010-10-01 23:28:0457
[email protected]b2ae7832012-02-11 00:28:0058 // Track this object and post a VISIBLE_DATA_CHANGED notification when
59 // its container scrolls.
60 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed.
61 void TrackScrollingObject(BrowserAccessibilityWin* node);
62
[email protected]d1ba0192013-04-10 04:36:2263 // Return a pointer to the object corresponding to the given windows-specific
64 // unique id, does not make a new reference.
65 BrowserAccessibilityWin* GetFromUniqueIdWin(LONG unique_id_win);
66
[email protected]a6b2aa52013-11-30 05:16:0267 // Called when |accessible_hwnd_| is deleted by its parent.
68 void OnAccessibleHwndDeleted();
69
[email protected]2aafe922014-04-08 08:26:5070 protected:
71 // BrowserAccessibilityManager methods
[email protected]d96f3842014-04-21 18:07:2972 virtual void OnRootChanged(ui::AXNode* new_root) OVERRIDE;
[email protected]2aafe922014-04-08 08:26:5073
[email protected]c5c2a672010-10-01 23:28:0474 private:
[email protected]a6120e32013-03-15 11:07:3575 // The closest ancestor HWND.
76 HWND parent_hwnd_;
[email protected]c5c2a672010-10-01 23:28:0477
[email protected]a6120e32013-03-15 11:07:3578 // The accessibility instance for the parent window.
79 IAccessible* parent_iaccessible_;
[email protected]c5c2a672010-10-01 23:28:0480
[email protected]f27e81c2010-10-07 05:20:2381 // Give BrowserAccessibilityManager::Create access to our constructor.
82 friend class BrowserAccessibilityManager;
[email protected]c5c2a672010-10-01 23:28:0483
[email protected]b2ae7832012-02-11 00:28:0084 // Track the most recent object that has been asked to scroll and
85 // post a notification directly on it when it reaches its destination.
86 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed.
87 BrowserAccessibilityWin* tracked_scroll_object_;
88
[email protected]d1ba0192013-04-10 04:36:2289 // A mapping from the Windows-specific unique IDs (unique within the
[email protected]d96f3842014-04-21 18:07:2990 // browser process) to accessibility ids within this page.
91 base::hash_map<long, int32> unique_id_to_ax_id_map_;
[email protected]d1ba0192013-04-10 04:36:2292
[email protected]a6b2aa52013-11-30 05:16:0293 // Owned by its parent; OnAccessibleHwndDeleted gets called upon deletion.
[email protected]d5169a92014-02-07 00:00:3094 LegacyRenderWidgetHostHWND* accessible_hwnd_;
[email protected]f3be33432013-10-18 03:36:1595
[email protected]c5c2a672010-10-01 23:28:0496 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin);
97};
98
[email protected]e6b34872012-10-24 20:51:3299} // namespace content
100
[email protected]ba1fa652011-06-25 05:16:22101#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_