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

Side by Side Diff: ui/views/accessibility/native_view_accessibility.h

Issue 909143003: Re-land: Implement NativeViewAccessibilityWin using AXPlatformNodeWin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update GN build Created 5 years, 9 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 5 #ifndef UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
7 7
8 #include "ui/accessibility/ax_node_data.h" 8 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/accessibility/platform/ax_platform_node.h" 9 #include "ui/accessibility/platform/ax_platform_node.h"
10 #include "ui/accessibility/platform/ax_platform_node_delegate.h" 10 #include "ui/accessibility/platform/ax_platform_node_delegate.h"
11 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
12 #include "ui/views/views_export.h" 12 #include "ui/views/views_export.h"
13 #include "ui/views/widget/widget_observer.h"
13 14
14 namespace views { 15 namespace views {
15 16
16 class View; 17 class View;
18 class Widget;
17 19
18 class VIEWS_EXPORT NativeViewAccessibility : public ui::AXPlatformNodeDelegate { 20 class VIEWS_EXPORT NativeViewAccessibility
21 : public ui::AXPlatformNodeDelegate,
22 public WidgetObserver {
19 public: 23 public:
20 static NativeViewAccessibility* Create(View* view); 24 static NativeViewAccessibility* Create(View* view);
21 25
22 virtual gfx::NativeViewAccessible GetNativeObject(); 26 gfx::NativeViewAccessible GetNativeObject();
23 27
24 // Call Destroy rather than deleting this, because the subclass may 28 // Call Destroy rather than deleting this, because the subclass may
25 // use reference counting. 29 // use reference counting.
26 virtual void Destroy(); 30 virtual void Destroy();
27 31
28 // WebViews need to be registered because they implement their own 32 void NotifyAccessibilityEvent(ui::AXEvent event_type);
29 // tree of accessibility objects, and we need to check them when
30 // mapping a child id to a NativeViewAccessible.
31 static void RegisterWebView(View* web_view);
32 static void UnregisterWebView(View* web_view);
33 33
34 // ui::AXPlatformNodeDelegate 34 // ui::AXPlatformNodeDelegate
35 ui::AXNodeData* GetData() override; 35 const ui::AXNodeData& GetData() override;
36 int GetChildCount() override; 36 int GetChildCount() override;
37 gfx::NativeViewAccessible ChildAtIndex(int index) override; 37 gfx::NativeViewAccessible ChildAtIndex(int index) override;
38 gfx::NativeViewAccessible GetParent() override; 38 gfx::NativeViewAccessible GetParent() override;
39 gfx::Vector2d GetGlobalCoordinateOffset() override; 39 gfx::Vector2d GetGlobalCoordinateOffset() override;
40 void NotifyAccessibilityEvent(ui::AXEvent event_type) override; 40 gfx::NativeViewAccessible HitTestSync(int x, int y) override;
41 gfx::NativeViewAccessible GetFocus() override;
42 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
43 void DoDefaultAction() override;
44 bool SetStringValue(const base::string16& new_value) override;
45
46 // WidgetObserver
47 void OnWidgetDestroying(Widget* widget) override;
48
49 Widget* parent_widget() const { return parent_widget_; }
50 void SetParentWidget(Widget* parent_widget);
41 51
42 protected: 52 protected:
43 NativeViewAccessibility(); 53 NativeViewAccessibility(View* view);
44 virtual ~NativeViewAccessibility(); 54 ~NativeViewAccessibility() override;
45 55
46 void set_view(views::View* view) { view_ = view; } 56 // Weak. Owns this.
47 const View* view() const { return view_; } 57 View* view_;
48 58
49 View* view_; // Weak. Owns this. 59 // Weak. Uses WidgetObserver to clear. This is set on the root view for
60 // a widget that's owned by another widget, so we can walk back up the
61 // tree.
62 Widget* parent_widget_;
50 63
51 private: 64 private:
65 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets);
66
52 // We own this, but it is reference-counted on some platforms so we can't use 67 // We own this, but it is reference-counted on some platforms so we can't use
53 // a scoped_ptr. It is dereferenced in the destructor. 68 // a scoped_ptr. It is dereferenced in the destructor.
54 ui::AXPlatformNode* ax_node_; 69 ui::AXPlatformNode* ax_node_;
55 70
56 ui::AXNodeData data_; 71 ui::AXNodeData data_;
57 72
58 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); 73 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility);
59 }; 74 };
60 75
61 } // namespace views 76 } // namespace views
62 77
63 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 78 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « ui/accessibility/platform/test_ax_node_wrapper.cc ('k') | ui/views/accessibility/native_view_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698