blob: 9b37eb31b3bf0328629f519765ef4d84aae8fb3e [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(
50 WebKit::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]c5c2a672010-10-01 23:28:0461 private:
[email protected]a6120e32013-03-15 11:07:3562 // The closest ancestor HWND.
63 HWND parent_hwnd_;
[email protected]c5c2a672010-10-01 23:28:0464
[email protected]a6120e32013-03-15 11:07:3565 // The accessibility instance for the parent window.
66 IAccessible* parent_iaccessible_;
[email protected]c5c2a672010-10-01 23:28:0467
[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
77 // browser process) to renderer ids within this page.
78 base::hash_map<long, int32> unique_id_to_renderer_id_map_;
79
[email protected]f3be33432013-10-18 03:36:1580 bool is_chrome_frame_;
81
82 scoped_ptr<AccessibleHWND> accessible_hwnd_;
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_