OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "ui/views/accessibility/native_view_accessibility_auralinux.h" | 5 #include "ui/views/accessibility/native_view_accessibility_auralinux.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // AXPlatformNodeDelegate interface so we can create such an application | 26 // AXPlatformNodeDelegate interface so we can create such an application |
27 // object. Every time we create an accessibility object for a View, we add its | 27 // object. Every time we create an accessibility object for a View, we add its |
28 // top-level widget to a vector so we can return the list of all top-level | 28 // top-level widget to a vector so we can return the list of all top-level |
29 // windows as children of this application object. | 29 // windows as children of this application object. |
30 class AuraLinuxApplication | 30 class AuraLinuxApplication |
31 : public ui::AXPlatformNodeDelegate, | 31 : public ui::AXPlatformNodeDelegate, |
32 public WidgetObserver { | 32 public WidgetObserver { |
33 public: | 33 public: |
34 // Get the single instance of this class. | 34 // Get the single instance of this class. |
35 static AuraLinuxApplication* GetInstance() { | 35 static AuraLinuxApplication* GetInstance() { |
36 return Singleton<AuraLinuxApplication>::get(); | 36 return base::Singleton<AuraLinuxApplication>::get(); |
37 } | 37 } |
38 | 38 |
39 // Called every time we create a new accessibility on a View. | 39 // Called every time we create a new accessibility on a View. |
40 // Add the top-level widget to our registry so that we can enumerate all | 40 // Add the top-level widget to our registry so that we can enumerate all |
41 // top-level widgets. | 41 // top-level widgets. |
42 void RegisterWidget(Widget* widget) { | 42 void RegisterWidget(Widget* widget) { |
43 if (!widget) | 43 if (!widget) |
44 return; | 44 return; |
45 | 45 |
46 widget = widget->GetTopLevelWidget(); | 46 widget = widget->GetTopLevelWidget(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 void DoDefaultAction() override { | 109 void DoDefaultAction() override { |
110 } | 110 } |
111 | 111 |
112 bool SetStringValue(const base::string16& new_value) override { | 112 bool SetStringValue(const base::string16& new_value) override { |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 friend struct DefaultSingletonTraits<AuraLinuxApplication>; | 117 friend struct base::DefaultSingletonTraits<AuraLinuxApplication>; |
118 | 118 |
119 AuraLinuxApplication() | 119 AuraLinuxApplication() |
120 : platform_node_(ui::AXPlatformNode::Create(this)) { | 120 : platform_node_(ui::AXPlatformNode::Create(this)) { |
121 data_.role = ui::AX_ROLE_APPLICATION; | 121 data_.role = ui::AX_ROLE_APPLICATION; |
122 if (ViewsDelegate::GetInstance()) { | 122 if (ViewsDelegate::GetInstance()) { |
123 data_.AddStringAttribute( | 123 data_.AddStringAttribute( |
124 ui::AX_ATTR_NAME, | 124 ui::AX_ATTR_NAME, |
125 ViewsDelegate::GetInstance()->GetApplicationName()); | 125 ViewsDelegate::GetInstance()->GetApplicationName()); |
126 } | 126 } |
127 ui::AXPlatformNodeAuraLinux::SetApplication(platform_node_); | 127 ui::AXPlatformNodeAuraLinux::SetApplication(platform_node_); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 gfx::NativeViewAccessible NativeViewAccessibilityAuraLinux::GetParent() { | 165 gfx::NativeViewAccessible NativeViewAccessibilityAuraLinux::GetParent() { |
166 gfx::NativeViewAccessible parent = NativeViewAccessibility::GetParent(); | 166 gfx::NativeViewAccessible parent = NativeViewAccessibility::GetParent(); |
167 if (!parent) | 167 if (!parent) |
168 parent = AuraLinuxApplication::GetInstance()->GetNativeViewAccessible(); | 168 parent = AuraLinuxApplication::GetInstance()->GetNativeViewAccessible(); |
169 return parent; | 169 return parent; |
170 } | 170 } |
171 | 171 |
172 } // namespace views | 172 } // namespace views |
OLD | NEW |