| 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" |
| 11 #include "base/stl_util.h" |
| 11 #include "ui/accessibility/ax_enums.h" | 12 #include "ui/accessibility/ax_enums.h" |
| 12 #include "ui/accessibility/ax_node_data.h" | 13 #include "ui/accessibility/ax_node_data.h" |
| 13 #include "ui/accessibility/platform/ax_platform_node_auralinux.h" | 14 #include "ui/accessibility/platform/ax_platform_node_auralinux.h" |
| 14 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | 15 #include "ui/accessibility/platform/ax_platform_node_delegate.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 16 #include "ui/views/views_delegate.h" | 17 #include "ui/views/views_delegate.h" |
| 17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| 18 #include "ui/views/widget/widget_observer.h" | 19 #include "ui/views/widget/widget_observer.h" |
| 19 | 20 |
| 20 namespace views { | 21 namespace views { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 } | 38 } |
| 38 | 39 |
| 39 // Called every time we create a new accessibility on a View. | 40 // 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 | 41 // Add the top-level widget to our registry so that we can enumerate all |
| 41 // top-level widgets. | 42 // top-level widgets. |
| 42 void RegisterWidget(Widget* widget) { | 43 void RegisterWidget(Widget* widget) { |
| 43 if (!widget) | 44 if (!widget) |
| 44 return; | 45 return; |
| 45 | 46 |
| 46 widget = widget->GetTopLevelWidget(); | 47 widget = widget->GetTopLevelWidget(); |
| 47 if (std::find(widgets_.begin(), widgets_.end(), widget) != widgets_.end()) | 48 if (ContainsValue(widgets_, widget)) |
| 48 return; | 49 return; |
| 49 | 50 |
| 50 widgets_.push_back(widget); | 51 widgets_.push_back(widget); |
| 51 widget->AddObserver(this); | 52 widget->AddObserver(this); |
| 52 } | 53 } |
| 53 | 54 |
| 54 gfx::NativeViewAccessible GetNativeViewAccessible() { | 55 gfx::NativeViewAccessible GetNativeViewAccessible() { |
| 55 return platform_node_->GetNativeViewAccessible(); | 56 return platform_node_->GetNativeViewAccessible(); |
| 56 } | 57 } |
| 57 | 58 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 164 } |
| 164 | 165 |
| 165 gfx::NativeViewAccessible NativeViewAccessibilityAuraLinux::GetParent() { | 166 gfx::NativeViewAccessible NativeViewAccessibilityAuraLinux::GetParent() { |
| 166 gfx::NativeViewAccessible parent = NativeViewAccessibility::GetParent(); | 167 gfx::NativeViewAccessible parent = NativeViewAccessibility::GetParent(); |
| 167 if (!parent) | 168 if (!parent) |
| 168 parent = AuraLinuxApplication::GetInstance()->GetNativeViewAccessible(); | 169 parent = AuraLinuxApplication::GetInstance()->GetNativeViewAccessible(); |
| 169 return parent; | 170 return parent; |
| 170 } | 171 } |
| 171 | 172 |
| 172 } // namespace views | 173 } // namespace views |
| OLD | NEW |