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/extensions/api/automation_internal/automation_util.h" | 5 #include "chrome/browser/extensions/api/automation_internal/automation_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/common/extensions/api/automation_internal.h" | 11 #include "chrome/common/extensions/api/automation_internal.h" |
12 #include "extensions/browser/event_router.h" | 12 #include "extensions/browser/event_router.h" |
13 #include "extensions/browser/extension_system.h" | |
14 #include "ui/accessibility/ax_enums.h" | 13 #include "ui/accessibility/ax_enums.h" |
15 #include "ui/accessibility/ax_node_data.h" | 14 #include "ui/accessibility/ax_node_data.h" |
16 | 15 |
17 namespace extensions { | 16 namespace extensions { |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 void PopulateNodeData(const ui::AXNodeData& node_data, | 20 void PopulateNodeData(const ui::AXNodeData& node_data, |
22 linked_ptr< api::automation_internal::AXNodeData>& out_node_data) { | 21 linked_ptr< api::automation_internal::AXNodeData>& out_node_data) { |
23 out_node_data->id = node_data.id; | 22 out_node_data->id = node_data.id; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } | 105 } |
107 | 106 |
108 for (size_t i = 0; i < node_data.child_ids.size(); ++i) { | 107 for (size_t i = 0; i < node_data.child_ids.size(); ++i) { |
109 out_node_data->child_ids.push_back(node_data.child_ids[i]); | 108 out_node_data->child_ids.push_back(node_data.child_ids[i]); |
110 } | 109 } |
111 } | 110 } |
112 | 111 |
113 void DispatchEventInternal(content::BrowserContext* context, | 112 void DispatchEventInternal(content::BrowserContext* context, |
114 const std::string& event_name, | 113 const std::string& event_name, |
115 scoped_ptr<base::ListValue> args) { | 114 scoped_ptr<base::ListValue> args) { |
116 if (context && ExtensionSystem::Get(context)->event_router()) { | 115 if (context && EventRouter::Get(context)) { |
117 scoped_ptr<Event> event(new Event(event_name, args.Pass())); | 116 scoped_ptr<Event> event(new Event(event_name, args.Pass())); |
118 event->restrict_to_browser_context = context; | 117 event->restrict_to_browser_context = context; |
119 ExtensionSystem::Get(context)->event_router()->BroadcastEvent(event.Pass()); | 118 EventRouter::Get(context)->BroadcastEvent(event.Pass()); |
120 } | 119 } |
121 } | 120 } |
122 | 121 |
123 } // namespace | 122 } // namespace |
124 | 123 |
125 namespace automation_util { | 124 namespace automation_util { |
126 | 125 |
127 void DispatchAccessibilityEventsToAutomation( | 126 void DispatchAccessibilityEventsToAutomation( |
128 const std::vector<content::AXEventNotificationDetails>& details, | 127 const std::vector<content::AXEventNotificationDetails>& details, |
129 content::BrowserContext* browser_context) { | 128 content::BrowserContext* browser_context) { |
(...skipping 23 matching lines...) Expand all Loading... |
153 // |AccessibilityHostMsg_EventParams| and |AccessibilityHostMsg_Events|. | 152 // |AccessibilityHostMsg_EventParams| and |AccessibilityHostMsg_Events|. |
154 DispatchEventInternal(browser_context, | 153 DispatchEventInternal(browser_context, |
155 api::automation_internal::OnAccessibilityEvent::kEventName, | 154 api::automation_internal::OnAccessibilityEvent::kEventName, |
156 api::automation_internal::OnAccessibilityEvent::Create(ax_tree_update)); | 155 api::automation_internal::OnAccessibilityEvent::Create(ax_tree_update)); |
157 } | 156 } |
158 } | 157 } |
159 | 158 |
160 } // namespace automation_util | 159 } // namespace automation_util |
161 | 160 |
162 } // namespace extensions | 161 } // namespace extensions |
OLD | NEW |