OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h" | 5 #include "chrome/browser/ui/aura/accessibility/ax_tree_source_aura.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" | 9 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
10 #include "content/public/browser/render_frame_host.h" | 10 #include "content/public/browser/render_frame_host.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 AXTreeSourceAura::AXTreeSourceAura() { | 21 AXTreeSourceAura::AXTreeSourceAura() { |
22 root_.reset(new AXRootObjWrapper(AXAuraObjCache::GetInstance()->GetNextID())); | 22 root_.reset(new AXRootObjWrapper(AXAuraObjCache::GetInstance()->GetNextID())); |
23 } | 23 } |
24 | 24 |
25 AXTreeSourceAura::~AXTreeSourceAura() { | 25 AXTreeSourceAura::~AXTreeSourceAura() { |
26 root_.reset(); | 26 root_.reset(); |
27 } | 27 } |
28 | 28 |
29 void AXTreeSourceAura::DoDefault(int32 id) { | 29 void AXTreeSourceAura::DoDefault(int32 id) { |
30 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); | 30 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); |
31 CHECK(obj); | 31 if (obj) |
32 obj->DoDefault(); | 32 obj->DoDefault(); |
33 } | 33 } |
34 | 34 |
35 void AXTreeSourceAura::Focus(int32 id) { | 35 void AXTreeSourceAura::Focus(int32 id) { |
36 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); | 36 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); |
37 CHECK(obj); | 37 if (obj) |
38 obj->Focus(); | 38 obj->Focus(); |
39 } | 39 } |
40 | 40 |
41 void AXTreeSourceAura::MakeVisible(int32 id) { | 41 void AXTreeSourceAura::MakeVisible(int32 id) { |
42 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); | 42 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); |
43 CHECK(obj); | 43 if (obj) |
44 obj->MakeVisible(); | 44 obj->MakeVisible(); |
45 } | 45 } |
46 | 46 |
47 void AXTreeSourceAura::SetSelection(int32 id, int32 start, int32 end) { | 47 void AXTreeSourceAura::SetSelection(int32 id, int32 start, int32 end) { |
48 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); | 48 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); |
49 CHECK(obj); | 49 if (obj) |
50 obj->SetSelection(start, end); | 50 obj->SetSelection(start, end); |
51 } | 51 } |
52 | 52 |
53 void AXTreeSourceAura::ShowContextMenu(int32 id) { | 53 void AXTreeSourceAura::ShowContextMenu(int32 id) { |
54 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); | 54 AXAuraObjWrapper* obj = AXAuraObjCache::GetInstance()->Get(id); |
55 CHECK(obj); | 55 if (obj) |
56 obj->ShowContextMenu(); | 56 obj->ShowContextMenu(); |
57 } | 57 } |
58 | 58 |
59 AXAuraObjWrapper* AXTreeSourceAura::GetRoot() const { | 59 AXAuraObjWrapper* AXTreeSourceAura::GetRoot() const { |
60 return root_.get(); | 60 return root_.get(); |
61 } | 61 } |
62 | 62 |
63 AXAuraObjWrapper* AXTreeSourceAura::GetFromId(int32 id) const { | 63 AXAuraObjWrapper* AXTreeSourceAura::GetFromId(int32 id) const { |
64 if (id == root_->GetID()) | 64 if (id == root_->GetID()) |
65 return root_.get(); | 65 return root_.get(); |
66 return AXAuraObjCache::GetInstance()->Get(id); | 66 return AXAuraObjCache::GetInstance()->Get(id); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 std::vector<AXAuraObjWrapper*> children; | 124 std::vector<AXAuraObjWrapper*> children; |
125 root->GetChildren(&children); | 125 root->GetChildren(&children); |
126 | 126 |
127 prefix += prefix[0]; | 127 prefix += prefix[0]; |
128 for (size_t i = 0; i < children.size(); ++i) | 128 for (size_t i = 0; i < children.size(); ++i) |
129 output += ToString(children[i], prefix); | 129 output += ToString(children[i], prefix); |
130 | 130 |
131 return output; | 131 return output; |
132 } | 132 } |
OLD | NEW |