1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "base/win/scoped_comptr.h"
12 #include "content/browser/accessibility/browser_accessibility_manager.h"
15 class BrowserAccessibilityWin
;
17 class LegacyRenderWidgetHostHWND
;
19 // Manages a tree of BrowserAccessibilityWin objects.
20 class CONTENT_EXPORT BrowserAccessibilityManagerWin
21 : public BrowserAccessibilityManager
{
23 BrowserAccessibilityManagerWin(
24 content::LegacyRenderWidgetHostHWND
* accessible_hwnd
,
25 IAccessible
* parent_iaccessible
,
26 const ui::AXNodeData
& src
,
27 BrowserAccessibilityDelegate
* delegate
,
28 BrowserAccessibilityFactory
* factory
= new BrowserAccessibilityFactory());
30 virtual ~BrowserAccessibilityManagerWin();
32 static ui::AXNodeData
GetEmptyDocument();
34 // Get the closest containing HWND.
35 HWND
parent_hwnd() { return parent_hwnd_
; }
37 // 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
;
43 // Calls NotifyWinEvent if the parent window's IAccessible pointer is known.
44 void MaybeCallNotifyWinEvent(DWORD event
, LONG child_id
);
46 // BrowserAccessibilityManager methods
47 virtual void AddNodeToMap(BrowserAccessibility
* node
);
48 virtual void RemoveNode(BrowserAccessibility
* node
) OVERRIDE
;
49 virtual void NotifyAccessibilityEvent(
50 ui::AXEvent event_type
, BrowserAccessibility
* node
) OVERRIDE
;
52 // 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
);
57 // 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
);
61 // Called when |accessible_hwnd_| is deleted by its parent.
62 void OnAccessibleHwndDeleted();
65 // The closest ancestor HWND.
68 // The accessibility instance for the parent window.
69 IAccessible
* parent_iaccessible_
;
71 // Give BrowserAccessibilityManager::Create access to our constructor.
72 friend class BrowserAccessibilityManager
;
74 // 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_
;
79 // 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_
;
83 // Owned by its parent; OnAccessibleHwndDeleted gets called upon deletion.
84 LegacyRenderWidgetHostHWND
* accessible_hwnd_
;
86 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin
);
89 } // namespace content
91 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_