| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/arc/accessibility_helper/ax_tree_source_arc.h" |
| 6 |
| 7 #include "components/exo/shell_surface.h" |
| 8 #include "components/exo/surface.h" |
| 9 #include "ui/aura/window.h" |
| 10 |
| 11 namespace { |
| 12 |
| 13 exo::Surface* GetArcSurface(const aura::Window* window) { |
| 14 exo::Surface* arc_surface = exo::Surface::AsSurface(window); |
| 15 if (!arc_surface) |
| 16 arc_surface = exo::ShellSurface::GetMainSurface(window); |
| 17 return arc_surface; |
| 18 } |
| 19 |
| 20 } // namespace |
| 21 |
| 22 namespace arc { |
| 23 |
| 24 bool AXTreeSourceArc::GetTreeData(ui::AXTreeData* data) const { |
| 25 return false; |
| 26 } |
| 27 |
| 28 ui::AXNode* AXTreeSourceArc::GetRoot() const { |
| 29 return nullptr; |
| 30 } |
| 31 |
| 32 ui::AXNode* AXTreeSourceArc::GetFromId(int32_t id) const { |
| 33 return nullptr; |
| 34 } |
| 35 |
| 36 int32_t AXTreeSourceArc::GetId(ui::AXNode* node) const { |
| 37 return -1; |
| 38 } |
| 39 |
| 40 void AXTreeSourceArc::GetChildren( |
| 41 ui::AXNode* node, |
| 42 std::vector<ui::AXNode*>* out_children) const {} |
| 43 |
| 44 ui::AXNode* AXTreeSourceArc::GetParent(ui::AXNode* node) const { |
| 45 return nullptr; |
| 46 } |
| 47 |
| 48 bool AXTreeSourceArc::IsValid(ui::AXNode* node) const { |
| 49 return false; |
| 50 } |
| 51 |
| 52 bool AXTreeSourceArc::IsEqual(ui::AXNode* node1, ui::AXNode* node2) const { |
| 53 return false; |
| 54 } |
| 55 |
| 56 ui::AXNode* AXTreeSourceArc::GetNull() const { |
| 57 return nullptr; |
| 58 } |
| 59 |
| 60 void AXTreeSourceArc::SerializeNode(ui::AXNode* node, |
| 61 ui::AXNodeData* out_data) const {} |
| 62 |
| 63 void AXTreeSourceArc::Reset() {} |
| 64 |
| 65 void AXTreeSourceArc::OnWindowFocused(aura::Window* gained_focus, |
| 66 aura::Window* lost_focus) { |
| 67 exo::Surface* focused_surface = GetArcSurface(gained_focus); |
| 68 if (gained_focus == lost_focus || !focused_surface) |
| 69 return; |
| 70 |
| 71 exo::Surface* unfocused_surface = GetArcSurface(lost_focus); |
| 72 if (unfocused_surface) { |
| 73 unfocused_surface->set_ax_tree_source(nullptr); |
| 74 } |
| 75 |
| 76 Reset(); |
| 77 |
| 78 focused_surface->set_ax_tree_source(this); |
| 79 } |
| 80 |
| 81 } // namespace arc |
| OLD | NEW |