Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_event_rou ter.h" | 5 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou ter.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 void AutomationEventRouter::DispatchAccessibilityEvent( | 55 void AutomationEventRouter::DispatchAccessibilityEvent( |
| 56 const ExtensionMsg_AccessibilityEventParams& params) { | 56 const ExtensionMsg_AccessibilityEventParams& params) { |
| 57 for (const auto& listener : listeners_) { | 57 for (const auto& listener : listeners_) { |
| 58 if (!listener.desktop && | 58 if (!listener.desktop && |
| 59 listener.tree_ids.find(params.tree_id) == listener.tree_ids.end()) { | 59 listener.tree_ids.find(params.tree_id) == listener.tree_ids.end()) { |
| 60 continue; | 60 continue; |
| 61 } | 61 } |
| 62 | 62 |
| 63 content::RenderProcessHost* rph = | 63 content::RenderProcessHost* rph = |
| 64 content::RenderProcessHost::FromID(listener.process_id); | 64 content::RenderProcessHost::FromID(listener.process_id); |
| 65 rph->Send(new ExtensionMsg_AccessibilityEvent(listener.routing_id, params)); | 65 CHECK(rph); |
|
dcheng
2015/06/15 21:36:54
What's the point of this CHECK?
dmazzoni
2015/06/16 18:19:48
Done.
| |
| 66 rph->Send(new ExtensionMsg_AccessibilityEvent(listener.routing_id, | |
| 67 params)); | |
| 66 } | 68 } |
| 67 } | 69 } |
| 68 | 70 |
| 69 void AutomationEventRouter::DispatchTreeDestroyedEvent( | 71 void AutomationEventRouter::DispatchTreeDestroyedEvent( |
| 70 int tree_id, | 72 int tree_id, |
| 71 content::BrowserContext* browser_context) { | 73 content::BrowserContext* browser_context) { |
| 72 std::string event_name( | 74 std::string event_name( |
| 73 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName); | 75 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName); |
| 74 scoped_ptr<base::ListValue> args( | 76 scoped_ptr<base::ListValue> args( |
| 75 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); | 77 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 NOTREACHED(); | 126 NOTREACHED(); |
| 125 return; | 127 return; |
| 126 } | 128 } |
| 127 | 129 |
| 128 content::RenderProcessHost* rph = | 130 content::RenderProcessHost* rph = |
| 129 content::Source<content::RenderProcessHost>(source).ptr(); | 131 content::Source<content::RenderProcessHost>(source).ptr(); |
| 130 int process_id = rph->GetID(); | 132 int process_id = rph->GetID(); |
| 131 std::remove_if( | 133 std::remove_if( |
| 132 listeners_.begin(), | 134 listeners_.begin(), |
| 133 listeners_.end(), | 135 listeners_.end(), |
| 134 [process_id](AutomationListener& item) { | 136 [process_id](AutomationListener& item) { |
|
dcheng
2015/06/15 21:36:55
const AutomationListener& to prevent typos like th
dmazzoni
2015/06/16 18:19:48
Done.
| |
| 135 return item.process_id = process_id; | 137 return item.process_id == process_id; |
| 136 }); | 138 }); |
| 137 } | 139 } |
| 138 | 140 |
| 139 } // namespace extensions | 141 } // namespace extensions |
| OLD | NEW |