blob: cbfc877909e4095b1039ecabc8ce093b7d86fcda [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]f3be33432013-10-18 03:36:1517class AccessibleHWND;
18
[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(
24 HWND parent_hwnd,
25 IAccessible* parent_iaccessible,
26 const AccessibilityNodeData& src,
27 BrowserAccessibilityDelegate* delegate,
28 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
29
[email protected]c5c2a672010-10-01 23:28:0430 virtual ~BrowserAccessibilityManagerWin();
31
[email protected]a6120e32013-03-15 11:07:3532 static AccessibilityNodeData GetEmptyDocument();
33
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]3144b892013-05-25 01:14:4543 // Calls NotifyWinEvent if the parent window's IAccessible pointer is known.
44 void MaybeCallNotifyWinEvent(DWORD event, LONG child_id);
45
[email protected]f27e81c2010-10-07 05:20:2346 // BrowserAccessibilityManager methods
[email protected]d1ba0192013-04-10 04:36:2247 virtual void AddNodeToMap(BrowserAccessibility* node);
48 virtual void RemoveNode(BrowserAccessibility* node) OVERRIDE;
[email protected]10760e4a2013-09-04 23:32:2049 virtual void NotifyAccessibilityEvent(
[email protected]180ef242013-11-07 06:50:4650 blink::WebAXEvent event_type, BrowserAccessibility* node) OVERRIDE;
[email protected]c5c2a672010-10-01 23:28:0451
[email protected]b2ae7832012-02-11 00:28:0052 // Track this object and post a VISIBLE_DATA_CHANGED notification when
53 // its container scrolls.
54 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed.
55 void TrackScrollingObject(BrowserAccessibilityWin* node);
56
[email protected]d1ba0192013-04-10 04:36:2257 // Return a pointer to the object corresponding to the given windows-specific
58 // unique id, does not make a new reference.
59 BrowserAccessibilityWin* GetFromUniqueIdWin(LONG unique_id_win);
60
[email protected]a6b2aa52013-11-30 05:16:0261 // Called when |accessible_hwnd_| is deleted by its parent.
62 void OnAccessibleHwndDeleted();
63
[email protected]c5c2a672010-10-01 23:28:0464 private:
[email protected]a6120e32013-03-15 11:07:3565 // The closest ancestor HWND.
66 HWND parent_hwnd_;
[email protected]c5c2a672010-10-01 23:28:0467
[email protected]a6120e32013-03-15 11:07:3568 // The accessibility instance for the parent window.
69 IAccessible* parent_iaccessible_;
[email protected]c5c2a672010-10-01 23:28:0470
[email protected]f27e81c2010-10-07 05:20:2371 // Give BrowserAccessibilityManager::Create access to our constructor.
72 friend class BrowserAccessibilityManager;
[email protected]c5c2a672010-10-01 23:28:0473
[email protected]b2ae7832012-02-11 00:28:0074 // Track the most recent object that has been asked to scroll and
75 // post a notification directly on it when it reaches its destination.
76 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed.
77 BrowserAccessibilityWin* tracked_scroll_object_;
78
[email protected]d1ba0192013-04-10 04:36:2279 // A mapping from the Windows-specific unique IDs (unique within the
80 // browser process) to renderer ids within this page.
81 base::hash_map<long, int32> unique_id_to_renderer_id_map_;
82
[email protected]f3be33432013-10-18 03:36:1583 bool is_chrome_frame_;
84
[email protected]a6b2aa52013-11-30 05:16:0285 // Owned by its parent; OnAccessibleHwndDeleted gets called upon deletion.
86 AccessibleHWND* accessible_hwnd_;
[email protected]f3be33432013-10-18 03:36:1587
[email protected]c5c2a672010-10-01 23:28:0488 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin);
89};
90
[email protected]e6b34872012-10-24 20:51:3291} // namespace content
92
[email protected]ba1fa652011-06-25 05:16:2293#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_