Chromium Code Reviews| 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/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #include "chrome/common/extensions/api/automation_internal.h" | 13 #include "chrome/common/extensions/api/automation_internal.h" |
| 14 #include "extensions/browser/event_router.h" | 14 #include "extensions/browser/event_router.h" |
| 15 #include "extensions/browser/extension_system.h" | 15 #include "extensions/browser/extension_system.h" |
|
Devlin
2014/05/16 15:32:53
I think you can safely remove extension_system.h n
limasdf
2014/05/16 16:25:03
Done. I blame myself about forget this :/
Devlin
2014/05/16 17:34:04
Haha don't be so hard on yourself. We all forget.
| |
| 16 #include "ui/accessibility/ax_enums.h" | 16 #include "ui/accessibility/ax_enums.h" |
| 17 #include "ui/accessibility/ax_node_data.h" | 17 #include "ui/accessibility/ax_node_data.h" |
| 18 | 18 |
| 19 namespace extensions { | 19 namespace extensions { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 void PopulateNodeData(const ui::AXNodeData& node_data, | 23 void PopulateNodeData(const ui::AXNodeData& node_data, |
| 24 linked_ptr< api::automation_internal::AXNodeData>& out_node_data) { | 24 linked_ptr< api::automation_internal::AXNodeData>& out_node_data) { |
| 25 out_node_data->id = node_data.id; | 25 out_node_data->id = node_data.id; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 } | 108 } |
| 109 | 109 |
| 110 for (size_t i = 0; i < node_data.child_ids.size(); ++i) { | 110 for (size_t i = 0; i < node_data.child_ids.size(); ++i) { |
| 111 out_node_data->child_ids.push_back(node_data.child_ids[i]); | 111 out_node_data->child_ids.push_back(node_data.child_ids[i]); |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 | 114 |
| 115 void DispatchEventInternal(content::BrowserContext* context, | 115 void DispatchEventInternal(content::BrowserContext* context, |
| 116 const std::string& event_name, | 116 const std::string& event_name, |
| 117 scoped_ptr<base::ListValue> args) { | 117 scoped_ptr<base::ListValue> args) { |
| 118 if (context && ExtensionSystem::Get(context)->event_router()) { | 118 if (context && EventRouter::Get(context)) { |
| 119 scoped_ptr<Event> event(new Event(event_name, args.Pass())); | 119 scoped_ptr<Event> event(new Event(event_name, args.Pass())); |
| 120 event->restrict_to_browser_context = context; | 120 event->restrict_to_browser_context = context; |
| 121 ExtensionSystem::Get(context)->event_router()->BroadcastEvent(event.Pass()); | 121 EventRouter::Get(context)->BroadcastEvent(event.Pass()); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 } //namespace | 125 } //namespace |
| 126 | 126 |
| 127 namespace automation_util { | 127 namespace automation_util { |
| 128 | 128 |
| 129 void DispatchAccessibilityEventsToAutomation( | 129 void DispatchAccessibilityEventsToAutomation( |
| 130 const std::vector<content::AXEventNotificationDetails>& details, | 130 const std::vector<content::AXEventNotificationDetails>& details, |
| 131 content::BrowserContext* browser_context) { | 131 content::BrowserContext* browser_context) { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 160 // |AccessibilityHostMsg_EventParams| and |AccessibilityHostMsg_Events|. | 160 // |AccessibilityHostMsg_EventParams| and |AccessibilityHostMsg_Events|. |
| 161 DispatchEventInternal(browser_context, | 161 DispatchEventInternal(browser_context, |
| 162 api::automation_internal::OnAccessibilityEvent::kEventName, | 162 api::automation_internal::OnAccessibilityEvent::kEventName, |
| 163 api::automation_internal::OnAccessibilityEvent::Create(ax_tree_update)); | 163 api::automation_internal::OnAccessibilityEvent::Create(ax_tree_update)); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 } // namespace automation_util | 167 } // namespace automation_util |
| 168 | 168 |
| 169 } // namespace extensions | 169 } // namespace extensions |
| OLD | NEW |