Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/extensions/api/automation_internal/automation_util.cc

Issue 1236493004: Final batch adding real histogram values for extension events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments, rebase, dcheck, etc Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 ToString(attr.first), attr.second); 104 ToString(attr.first), attr.second);
105 } 105 }
106 } 106 }
107 107
108 for (size_t i = 0; i < node_data.child_ids.size(); ++i) { 108 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]); 109 out_node_data->child_ids.push_back(node_data.child_ids[i]);
110 } 110 }
111 } 111 }
112 112
113 void DispatchEventInternal(content::BrowserContext* context, 113 void DispatchEventInternal(content::BrowserContext* context,
114 events::HistogramValue histogram_value,
114 const std::string& event_name, 115 const std::string& event_name,
115 scoped_ptr<base::ListValue> args) { 116 scoped_ptr<base::ListValue> args) {
116 if (context && EventRouter::Get(context)) { 117 if (context && EventRouter::Get(context)) {
117 scoped_ptr<Event> event( 118 scoped_ptr<Event> event(
118 new Event(events::UNKNOWN, event_name, args.Pass())); 119 new Event(histogram_value, event_name, args.Pass()));
119 event->restrict_to_browser_context = context; 120 event->restrict_to_browser_context = context;
120 EventRouter::Get(context)->BroadcastEvent(event.Pass()); 121 EventRouter::Get(context)->BroadcastEvent(event.Pass());
121 } 122 }
122 } 123 }
123 124
124 } // namespace 125 } // namespace
125 126
126 namespace automation_util { 127 namespace automation_util {
127 128
128 void DispatchAccessibilityEventsToAutomation( 129 void DispatchAccessibilityEventsToAutomation(
(...skipping 24 matching lines...) Expand all
153 new api::automation_internal::AXNodeData()); 154 new api::automation_internal::AXNodeData());
154 PopulateNodeData(src, out_node); 155 PopulateNodeData(src, out_node);
155 ax_tree_update.nodes.push_back(out_node); 156 ax_tree_update.nodes.push_back(out_node);
156 } 157 }
157 158
158 // TODO(dtseng/aboxhall): Why are we sending only one update at a time? We 159 // TODO(dtseng/aboxhall): Why are we sending only one update at a time? We
159 // should match the behavior from renderer -> browser and send a 160 // should match the behavior from renderer -> browser and send a
160 // collection of tree updates over (to the extension); see 161 // collection of tree updates over (to the extension); see
161 // |AccessibilityHostMsg_EventParams| and |AccessibilityHostMsg_Events|. 162 // |AccessibilityHostMsg_EventParams| and |AccessibilityHostMsg_Events|.
162 DispatchEventInternal( 163 DispatchEventInternal(
163 browser_context, 164 browser_context, events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_EVENT,
164 api::automation_internal::OnAccessibilityEvent::kEventName, 165 api::automation_internal::OnAccessibilityEvent::kEventName,
165 api::automation_internal::OnAccessibilityEvent::Create( 166 api::automation_internal::OnAccessibilityEvent::Create(
166 ax_event_params)); 167 ax_event_params));
167 } 168 }
168 } 169 }
169 170
170 void DispatchTreeDestroyedEventToAutomation( 171 void DispatchTreeDestroyedEventToAutomation(
171 int process_id, 172 int process_id,
172 int routing_id, 173 int routing_id,
173 content::BrowserContext* browser_context) { 174 content::BrowserContext* browser_context) {
174 int tree_id = AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID( 175 int tree_id = AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID(
175 process_id, routing_id); 176 process_id, routing_id);
176 DispatchEventInternal( 177 DispatchEventInternal(
177 browser_context, 178 browser_context,
179 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED,
178 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, 180 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName,
179 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); 181 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id));
180 AXTreeIDRegistry::GetInstance()->RemoveAXTreeID(tree_id); 182 AXTreeIDRegistry::GetInstance()->RemoveAXTreeID(tree_id);
181 } 183 }
182 184
183 } // namespace automation_util 185 } // namespace automation_util
184 186
185 } // namespace extensions 187 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698