Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_win.h

Issue 415633002: Simplify access to LegacyRenderWidgetHostHWND. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render_frame_ax_4
Patch Set: Rebase and fix style issue Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
7 7
8 #include <oleacc.h> 8 #include <oleacc.h>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/win/scoped_comptr.h" 11 #include "base/win/scoped_comptr.h"
12 #include "content/browser/accessibility/browser_accessibility_manager.h" 12 #include "content/browser/accessibility/browser_accessibility_manager.h"
13 13
14 namespace content { 14 namespace content {
15 class BrowserAccessibilityWin; 15 class BrowserAccessibilityWin;
16 16
17 class LegacyRenderWidgetHostHWND;
18
19 // Manages a tree of BrowserAccessibilityWin objects. 17 // Manages a tree of BrowserAccessibilityWin objects.
20 class CONTENT_EXPORT BrowserAccessibilityManagerWin 18 class CONTENT_EXPORT BrowserAccessibilityManagerWin
21 : public BrowserAccessibilityManager { 19 : public BrowserAccessibilityManager {
22 public: 20 public:
23 BrowserAccessibilityManagerWin( 21 BrowserAccessibilityManagerWin(
24 content::LegacyRenderWidgetHostHWND* accessible_hwnd,
25 IAccessible* parent_iaccessible,
26 const ui::AXTreeUpdate& initial_tree, 22 const ui::AXTreeUpdate& initial_tree,
27 BrowserAccessibilityDelegate* delegate, 23 BrowserAccessibilityDelegate* delegate,
28 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); 24 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory());
29 25
30 virtual ~BrowserAccessibilityManagerWin(); 26 virtual ~BrowserAccessibilityManagerWin();
31 27
32 static ui::AXTreeUpdate GetEmptyDocument(); 28 static ui::AXTreeUpdate GetEmptyDocument();
33 29
34 // Get the closest containing HWND. 30 // Get the closest containing HWND.
35 HWND parent_hwnd() { return parent_hwnd_; } 31 HWND GetParentHWND();
36 32
37 // The IAccessible for the parent window. 33 // The IAccessible for the parent window.
38 IAccessible* parent_iaccessible() { return parent_iaccessible_; } 34 IAccessible* GetParentIAccessible();
39 void set_parent_iaccessible(IAccessible* parent_iaccessible) {
40 parent_iaccessible_ = parent_iaccessible;
41 }
42
43 void SetAccessibleHWND(LegacyRenderWidgetHostHWND* accessible_hwnd);
44 35
45 // Calls NotifyWinEvent if the parent window's IAccessible pointer is known. 36 // Calls NotifyWinEvent if the parent window's IAccessible pointer is known.
46 void MaybeCallNotifyWinEvent(DWORD event, LONG child_id); 37 void MaybeCallNotifyWinEvent(DWORD event, LONG child_id);
47 38
48 // AXTree methods 39 // AXTree methods
49 virtual void OnNodeWillBeDeleted(ui::AXNode* node) OVERRIDE; 40 virtual void OnNodeWillBeDeleted(ui::AXNode* node) OVERRIDE;
50 virtual void OnNodeCreated(ui::AXNode* node) OVERRIDE; 41 virtual void OnNodeCreated(ui::AXNode* node) OVERRIDE;
51 42
52 // BrowserAccessibilityManager methods 43 // BrowserAccessibilityManager methods
53 virtual void OnWindowFocused() OVERRIDE; 44 virtual void OnWindowFocused() OVERRIDE;
(...skipping 10 matching lines...) Expand all
64 BrowserAccessibilityWin* GetFromUniqueIdWin(LONG unique_id_win); 55 BrowserAccessibilityWin* GetFromUniqueIdWin(LONG unique_id_win);
65 56
66 // Called when |accessible_hwnd_| is deleted by its parent. 57 // Called when |accessible_hwnd_| is deleted by its parent.
67 void OnAccessibleHwndDeleted(); 58 void OnAccessibleHwndDeleted();
68 59
69 protected: 60 protected:
70 // BrowserAccessibilityManager methods 61 // BrowserAccessibilityManager methods
71 virtual void OnRootChanged(ui::AXNode* new_root) OVERRIDE; 62 virtual void OnRootChanged(ui::AXNode* new_root) OVERRIDE;
72 63
73 private: 64 private:
74 // The closest ancestor HWND.
75 HWND parent_hwnd_;
76
77 // The accessibility instance for the parent window.
78 IAccessible* parent_iaccessible_;
79
80 // Give BrowserAccessibilityManager::Create access to our constructor. 65 // Give BrowserAccessibilityManager::Create access to our constructor.
81 friend class BrowserAccessibilityManager; 66 friend class BrowserAccessibilityManager;
82 67
83 // Track the most recent object that has been asked to scroll and 68 // Track the most recent object that has been asked to scroll and
84 // post a notification directly on it when it reaches its destination. 69 // post a notification directly on it when it reaches its destination.
85 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed. 70 // TODO(dmazzoni): remove once http://crbug.com/113483 is fixed.
86 BrowserAccessibilityWin* tracked_scroll_object_; 71 BrowserAccessibilityWin* tracked_scroll_object_;
87 72
88 // A mapping from the Windows-specific unique IDs (unique within the 73 // A mapping from the Windows-specific unique IDs (unique within the
89 // browser process) to accessibility ids within this page. 74 // browser process) to accessibility ids within this page.
90 base::hash_map<long, int32> unique_id_to_ax_id_map_; 75 base::hash_map<long, int32> unique_id_to_ax_id_map_;
91 76
92 // Owned by its parent; OnAccessibleHwndDeleted gets called upon deletion.
93 LegacyRenderWidgetHostHWND* accessible_hwnd_;
94
95 // Set to true if we need to fire a focus event on the root as soon as 77 // Set to true if we need to fire a focus event on the root as soon as
96 // possible. 78 // possible.
97 bool focus_event_on_root_needed_; 79 bool focus_event_on_root_needed_;
98 80
99 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin); 81 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerWin);
100 }; 82 };
101 83
102 } // namespace content 84 } // namespace content
103 85
104 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_ 86 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698