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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 } | 128 } |
129 | 129 |
130 void AutomationManagerAura::ResetSerializer() { | 130 void AutomationManagerAura::ResetSerializer() { |
131 current_tree_serializer_.reset( | 131 current_tree_serializer_.reset( |
132 new AuraAXTreeSerializer(current_tree_.get())); | 132 new AuraAXTreeSerializer(current_tree_.get())); |
133 } | 133 } |
134 | 134 |
135 void AutomationManagerAura::SendEvent(BrowserContext* context, | 135 void AutomationManagerAura::SendEvent(BrowserContext* context, |
136 views::AXAuraObjWrapper* aura_obj, | 136 views::AXAuraObjWrapper* aura_obj, |
137 ui::AXEvent event_type) { | 137 ui::AXEvent event_type) { |
138 ui::AXNodeData temp1; | |
139 aura_obj->Serialize(&temp1); | |
David Tseng
2016/01/28 02:00:56
nit: Unused/remove.
dmazzoni
2016/01/30 00:02:41
Done.
| |
138 if (processing_events_) { | 140 if (processing_events_) { |
139 pending_events_.push_back(std::make_pair(aura_obj, event_type)); | 141 pending_events_.push_back(std::make_pair(aura_obj, event_type)); |
140 return; | 142 return; |
141 } | 143 } |
142 processing_events_ = true; | 144 processing_events_ = true; |
143 | 145 |
144 ExtensionMsg_AccessibilityEventParams params; | 146 ExtensionMsg_AccessibilityEventParams params; |
145 current_tree_serializer_->SerializeChanges(aura_obj, ¶ms.update); | 147 current_tree_serializer_->SerializeChanges(aura_obj, ¶ms.update); |
148 | |
149 // Make sure the focused node is serialized. | |
150 views::AXAuraObjWrapper* focus = | |
151 views::AXAuraObjCache::GetInstance()->GetFocus(); | |
152 if (focus) | |
153 current_tree_serializer_->SerializeChanges(focus, ¶ms.update); | |
154 | |
146 params.tree_id = 0; | 155 params.tree_id = 0; |
147 params.id = aura_obj->GetID(); | 156 params.id = aura_obj->GetID(); |
148 params.event_type = event_type; | 157 params.event_type = event_type; |
149 AutomationEventRouter* router = AutomationEventRouter::GetInstance(); | 158 AutomationEventRouter* router = AutomationEventRouter::GetInstance(); |
150 router->DispatchAccessibilityEvent(params); | 159 router->DispatchAccessibilityEvent(params); |
151 | 160 |
152 processing_events_ = false; | 161 processing_events_ = false; |
153 auto pending_events_copy = pending_events_; | 162 auto pending_events_copy = pending_events_; |
154 pending_events_.clear(); | 163 pending_events_.clear(); |
155 for (size_t i = 0; i < pending_events_copy.size(); ++i) { | 164 for (size_t i = 0; i < pending_events_copy.size(); ++i) { |
156 SendEvent(context, | 165 SendEvent(context, |
157 pending_events_copy[i].first, | 166 pending_events_copy[i].first, |
158 pending_events_copy[i].second); | 167 pending_events_copy[i].second); |
159 } | 168 } |
160 } | 169 } |
OLD | NEW |