OLD | NEW |
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 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 class View; | 16 class View; |
| 17 class Widget; |
17 | 18 |
18 class VIEWS_EXPORT NativeViewAccessibility : public ui::AXPlatformNodeDelegate { | 19 class VIEWS_EXPORT NativeViewAccessibility : public ui::AXPlatformNodeDelegate { |
19 public: | 20 public: |
20 static NativeViewAccessibility* Create(View* view); | 21 static NativeViewAccessibility* Create(View* view); |
21 | 22 |
22 virtual gfx::NativeViewAccessible GetNativeObject(); | 23 gfx::NativeViewAccessible GetNativeObject(); |
23 | 24 |
24 // Call Destroy rather than deleting this, because the subclass may | 25 // Call Destroy rather than deleting this, because the subclass may |
25 // use reference counting. | 26 // use reference counting. |
26 virtual void Destroy(); | 27 virtual void Destroy(); |
27 | 28 |
28 // WebViews need to be registered because they implement their own | 29 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 | 30 |
34 // ui::AXPlatformNodeDelegate | 31 // ui::AXPlatformNodeDelegate |
35 ui::AXNodeData* GetData() override; | 32 const ui::AXNodeData* GetData() override; |
36 int GetChildCount() override; | 33 int GetChildCount() override; |
37 gfx::NativeViewAccessible ChildAtIndex(int index) override; | 34 gfx::NativeViewAccessible ChildAtIndex(int index) override; |
38 gfx::NativeViewAccessible GetParent() override; | 35 gfx::NativeViewAccessible GetParent() override; |
| 36 int GetIndexInParent() override; |
39 gfx::Vector2d GetGlobalCoordinateOffset() override; | 37 gfx::Vector2d GetGlobalCoordinateOffset() override; |
40 void NotifyAccessibilityEvent(ui::AXEvent event_type) override; | 38 gfx::NativeViewAccessible HitTestSync(int x, int y) override; |
| 39 gfx::NativeViewAccessible GetFocus() override; |
| 40 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; |
| 41 void DoDefaultAction() override; |
| 42 bool SetStringValue(const base::string16& new_value) override; |
41 | 43 |
42 protected: | 44 protected: |
43 NativeViewAccessibility(); | 45 NativeViewAccessibility(View* view); |
44 virtual ~NativeViewAccessibility(); | 46 virtual ~NativeViewAccessibility(); |
45 | 47 |
46 void set_view(views::View* view) { view_ = view; } | |
47 const View* view() const { return view_; } | |
48 | |
49 View* view_; // Weak. Owns this. | 48 View* view_; // Weak. Owns this. |
50 | 49 |
51 private: | 50 private: |
| 51 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); |
| 52 |
52 // We own this, but it is reference-counted on some platforms so we can't use | 53 // 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. | 54 // a scoped_ptr. It is dereferenced in the destructor. |
54 ui::AXPlatformNode* ax_node_; | 55 ui::AXPlatformNode* ax_node_; |
55 | 56 |
56 ui::AXNodeData data_; | 57 ui::AXNodeData data_; |
57 | 58 |
58 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); | 59 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); |
59 }; | 60 }; |
60 | 61 |
61 } // namespace views | 62 } // namespace views |
62 | 63 |
63 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ | 64 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ |
OLD | NEW |