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/automation_manager_aura.h" | 5 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Reset the serializer to save memory. | 61 // Reset the serializer to save memory. |
62 current_tree_serializer_->Reset(); | 62 current_tree_serializer_->Reset(); |
63 } | 63 } |
64 | 64 |
65 void AutomationManagerAura::HandleEvent(BrowserContext* context, | 65 void AutomationManagerAura::HandleEvent(BrowserContext* context, |
66 views::View* view, | 66 views::View* view, |
67 ui::AXEvent event_type) { | 67 ui::AXEvent event_type) { |
68 if (!enabled_) | 68 if (!enabled_) |
69 return; | 69 return; |
70 | 70 |
71 views::AXAuraObjWrapper* aura_obj = | 71 views::AXAuraObjWrapper* aura_obj = view ? |
72 views::AXAuraObjCache::GetInstance()->GetOrCreate(view); | 72 views::AXAuraObjCache::GetInstance()->GetOrCreate(view) : |
| 73 current_tree_->GetRoot(); |
73 SendEvent(nullptr, aura_obj, event_type); | 74 SendEvent(nullptr, aura_obj, event_type); |
74 } | 75 } |
75 | 76 |
76 void AutomationManagerAura::HandleAlert(content::BrowserContext* context, | 77 void AutomationManagerAura::HandleAlert(content::BrowserContext* context, |
77 const std::string& text) { | 78 const std::string& text) { |
78 if (!enabled_) | 79 if (!enabled_) |
79 return; | 80 return; |
80 | 81 |
81 views::AXAuraObjWrapper* obj = | 82 views::AXAuraObjWrapper* obj = |
82 static_cast<AXRootObjWrapper*>(current_tree_->GetRoot()) | 83 static_cast<AXRootObjWrapper*>(current_tree_->GetRoot()) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 193 |
193 processing_events_ = false; | 194 processing_events_ = false; |
194 auto pending_events_copy = pending_events_; | 195 auto pending_events_copy = pending_events_; |
195 pending_events_.clear(); | 196 pending_events_.clear(); |
196 for (size_t i = 0; i < pending_events_copy.size(); ++i) { | 197 for (size_t i = 0; i < pending_events_copy.size(); ++i) { |
197 SendEvent(context, | 198 SendEvent(context, |
198 pending_events_copy[i].first, | 199 pending_events_copy[i].first, |
199 pending_events_copy[i].second); | 200 pending_events_copy[i].second); |
200 } | 201 } |
201 } | 202 } |
OLD | NEW |