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

Unified Diff: chrome/browser/chromeos/arc/accessibility_helper/ax_tree_source_arc.cc

Issue 2640123004: Initial support for native accessibility in ARC (Closed)
Patch Set: m Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/accessibility_helper/ax_tree_source_arc.cc
diff --git a/chrome/browser/chromeos/arc/accessibility_helper/ax_tree_source_arc.cc b/chrome/browser/chromeos/arc/accessibility_helper/ax_tree_source_arc.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4377df5e04d550f244b43a274c2404db88646fb7
--- /dev/null
+++ b/chrome/browser/chromeos/arc/accessibility_helper/ax_tree_source_arc.cc
@@ -0,0 +1,79 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/arc/accessibility_helper/ax_tree_source_arc.h"
+
+#include "components/exo/shell_surface.h"
+#include "components/exo/surface.h"
+#include "ui/aura/window.h"
+
+namespace {
+
+exo::Surface* GetArcSurface(const aura::Window* window) {
+ exo::Surface* arc_surface = exo::Surface::AsSurface(window);
+ if (!arc_surface)
+ arc_surface = exo::ShellSurface::GetMainSurface(window);
+ return arc_surface;
+}
+
+} // namespace
+
+namespace arc {
+
+bool AXTreeSourceArc::GetTreeData(ui::AXTreeData* data) const {
+ return false;
+}
+
+ui::AXNode* AXTreeSourceArc::GetRoot() const {
+ return nullptr;
+}
+
+ui::AXNode* AXTreeSourceArc::GetFromId(int32_t id) const {
+ return nullptr;
+}
+
+int32_t AXTreeSourceArc::GetId(ui::AXNode* node) const {
+ return -1;
+}
+
+void AXTreeSourceArc::GetChildren(
+ ui::AXNode* node,
+ std::vector<ui::AXNode*>* out_children) const {}
+
+ui::AXNode* AXTreeSourceArc::GetParent(ui::AXNode* node) const {
+ return nullptr;
+}
+
+bool AXTreeSourceArc::IsValid(ui::AXNode* node) const {
+ return false;
+}
+
+bool AXTreeSourceArc::IsEqual(ui::AXNode* node1, ui::AXNode* node2) const {
+ return false;
+}
+
+ui::AXNode* AXTreeSourceArc::GetNull() const {
+ return nullptr;
+}
+
+void AXTreeSourceArc::SerializeNode(ui::AXNode* node,
+ ui::AXNodeData* out_data) const {}
+
+void AXTreeSourceArc::Reset() {}
+
+void AXTreeSourceArc::OnWindowFocused(aura::Window* gained_focus,
+ aura::Window* lost_focus) {
+ if (gained_focus == lost_focus || !GetArcSurface(gained_focus))
+ return;
+
+ if (GetArcSurface(lost_focus)) {
+ exo::Surface* surface = GetArcSurface(lost_focus);
+ surface->set_ax_tree_source(nullptr);
yawano 2017/01/20 07:47:49 Might we need to call AxTreeSourceArc::Reset here
David Tseng 2017/01/20 23:00:56 Done.
+ }
+
+ exo::Surface* focused_surface = GetArcSurface(gained_focus);
yawano 2017/01/20 07:47:49 nit: how about to move this line at the first line
David Tseng 2017/01/20 23:00:56 Done.
+ focused_surface->set_ax_tree_source(this);
+}
+
+} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698