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

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

Issue 2746813002: Hide AXPlatformNode on ChromeOS. (Closed)
Patch Set: Renames, cross-platform TabbedPaneTest Created 3 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_BASE_H_
6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_BASE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "ui/accessibility/ax_action_data.h" 12 #include "ui/accessibility/ax_action_data.h"
13 #include "ui/accessibility/ax_node_data.h" 13 #include "ui/accessibility/ax_node_data.h"
14 #include "ui/accessibility/platform/ax_platform_node.h" 14 #include "ui/accessibility/platform/ax_platform_node.h"
15 #include "ui/accessibility/platform/ax_platform_node_delegate.h" 15 #include "ui/accessibility/platform/ax_platform_node_delegate.h"
16 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
17 #include "ui/views/accessibility/native_view_accessibility.h"
17 #include "ui/views/views_export.h" 18 #include "ui/views/views_export.h"
18 #include "ui/views/widget/widget_observer.h" 19 #include "ui/views/widget/widget_observer.h"
19 20
20 // Set PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL if this platform has a
21 // specific implementation of NativeViewAccessibility::Create().
22 #undef PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL
23
24 #if defined(OS_WIN)
25 #define PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL 1
26 #endif
27
28 #if defined(OS_MACOSX)
29 #define PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL 1
30 #endif
31
32 #if defined(OS_LINUX) && defined(USE_X11) && !defined(OS_CHROMEOS)
33 #define PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL 1
34 #endif
35
36 namespace views { 21 namespace views {
37 22
38 class View; 23 class View;
39 class Widget; 24 class Widget;
40 25
41 class VIEWS_EXPORT NativeViewAccessibility 26 class VIEWS_EXPORT NativeViewAccessibilityBase
dmazzoni 2017/03/21 15:42:04 Please add a brief class comment; this is the shar
tapted 2017/03/22 01:47:27 Done.
42 : public ui::AXPlatformNodeDelegate, 27 : public NativeViewAccessibility,
28 public ui::AXPlatformNodeDelegate,
43 public WidgetObserver { 29 public WidgetObserver {
44 public: 30 public:
45 static std::unique_ptr<NativeViewAccessibility> Create(View* view); 31 ~NativeViewAccessibilityBase() override;
46 32
47 ~NativeViewAccessibility() override; 33 // NativeViewAccessibility:
48 34 gfx::NativeViewAccessible GetNativeObject() override;
49 gfx::NativeViewAccessible GetNativeObject(); 35 void NotifyAccessibilityEvent(ui::AXEvent event_type) override;
50
51 void NotifyAccessibilityEvent(ui::AXEvent event_type);
52 36
53 // Focuses or unfocuses a View. 37 // Focuses or unfocuses a View.
54 bool SetFocused(bool focused); 38 bool SetFocused(bool focused);
55 39
56 // ui::AXPlatformNodeDelegate 40 // ui::AXPlatformNodeDelegate
57 const ui::AXNodeData& GetData() override; 41 const ui::AXNodeData& GetData() override;
58 int GetChildCount() override; 42 int GetChildCount() override;
59 gfx::NativeViewAccessible ChildAtIndex(int index) override; 43 gfx::NativeViewAccessible ChildAtIndex(int index) override;
60 gfx::NativeWindow GetTopLevelWidget() override; 44 gfx::NativeWindow GetTopLevelWidget() override;
61 gfx::NativeViewAccessible GetParent() override; 45 gfx::NativeViewAccessible GetParent() override;
62 gfx::Vector2d GetGlobalCoordinateOffset() override; 46 gfx::Vector2d GetGlobalCoordinateOffset() override;
63 gfx::NativeViewAccessible HitTestSync(int x, int y) override; 47 gfx::NativeViewAccessible HitTestSync(int x, int y) override;
64 gfx::NativeViewAccessible GetFocus() override; 48 gfx::NativeViewAccessible GetFocus() override;
65 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; 49 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
66 bool AccessibilityPerformAction(const ui::AXActionData& data) override; 50 bool AccessibilityPerformAction(const ui::AXActionData& data) override;
67 void DoDefaultAction() override; 51 void DoDefaultAction() override;
68 52
69 // WidgetObserver 53 // WidgetObserver
70 void OnWidgetDestroying(Widget* widget) override; 54 void OnWidgetDestroying(Widget* widget) override;
71 55
72 Widget* parent_widget() const { return parent_widget_; } 56 Widget* parent_widget() const { return parent_widget_; }
73 void SetParentWidget(Widget* parent_widget); 57 void SetParentWidget(Widget* parent_widget);
74 58
75 protected: 59 protected:
76 explicit NativeViewAccessibility(View* view); 60 explicit NativeViewAccessibilityBase(View* view);
77 61
78 // Weak. Owns this. 62 // Weak. Owns this.
79 View* view_; 63 View* view_;
80 64
81 // Weak. Uses WidgetObserver to clear. This is set on the root view for 65 // Weak. Uses WidgetObserver to clear. This is set on the root view for
82 // a widget that's owned by another widget, so we can walk back up the 66 // a widget that's owned by another widget, so we can walk back up the
83 // tree. 67 // tree.
84 Widget* parent_widget_; 68 Widget* parent_widget_;
85 69
86 private: 70 private:
87 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); 71 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets);
88 72
89 // We own this, but it is reference-counted on some platforms so we can't use 73 // We own this, but it is reference-counted on some platforms so we can't use
90 // a scoped_ptr. It is dereferenced in the destructor. 74 // a scoped_ptr. It is dereferenced in the destructor.
91 ui::AXPlatformNode* ax_node_; 75 ui::AXPlatformNode* ax_node_;
92 76
93 ui::AXNodeData data_; 77 ui::AXNodeData data_;
94 78
95 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); 79 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibilityBase);
96 }; 80 };
97 81
98 } // namespace views 82 } // namespace views
99 83
100 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 84 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698