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

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

Issue 2255093005: Pass accessible location change messages to the automation API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Speculative fix to cast_shell Created 4 years, 4 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_internal_ api.h" 5 #include "chrome/browser/extensions/api/automation_internal/automation_internal_ api.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 class AutomationWebContentsObserver 196 class AutomationWebContentsObserver
197 : public content::WebContentsObserver, 197 : public content::WebContentsObserver,
198 public content::WebContentsUserData<AutomationWebContentsObserver> { 198 public content::WebContentsUserData<AutomationWebContentsObserver> {
199 public: 199 public:
200 ~AutomationWebContentsObserver() override {} 200 ~AutomationWebContentsObserver() override {}
201 201
202 // content::WebContentsObserver overrides. 202 // content::WebContentsObserver overrides.
203 void AccessibilityEventReceived( 203 void AccessibilityEventReceived(
204 const std::vector<content::AXEventNotificationDetails>& details) 204 const std::vector<content::AXEventNotificationDetails>& details)
205 override { 205 override {
206 std::vector<content::AXEventNotificationDetails>::const_iterator iter = 206 for (const auto& event : details) {
207 details.begin();
208 for (; iter != details.end(); ++iter) {
209 const content::AXEventNotificationDetails& event = *iter;
210 ExtensionMsg_AccessibilityEventParams params; 207 ExtensionMsg_AccessibilityEventParams params;
211 params.tree_id = event.ax_tree_id; 208 params.tree_id = event.ax_tree_id;
212 params.id = event.id; 209 params.id = event.id;
213 params.event_type = event.event_type; 210 params.event_type = event.event_type;
214 params.update = event.update; 211 params.update = event.update;
215 params.location_offset = 212 params.location_offset =
216 web_contents()->GetContainerBounds().OffsetFromOrigin(); 213 web_contents()->GetContainerBounds().OffsetFromOrigin();
217 214
218 AutomationEventRouter* router = AutomationEventRouter::GetInstance(); 215 AutomationEventRouter* router = AutomationEventRouter::GetInstance();
219 router->DispatchAccessibilityEvent(params); 216 router->DispatchAccessibilityEvent(params);
220 } 217 }
221 } 218 }
222 219
220 void AccessibilityLocationChangesReceived(
221 const std::vector<content::AXLocationChangeNotificationDetails>& details)
222 override {
223 for (const auto& src : details) {
224 ExtensionMsg_AccessibilityLocationChangeParams dst;
225 dst.id = src.id;
226 dst.tree_id = src.ax_tree_id;
227 dst.new_location = src.new_location;
228 AutomationEventRouter* router = AutomationEventRouter::GetInstance();
229 router->DispatchAccessibilityLocationChange(dst);
230 }
231 }
232
223 void RenderFrameDeleted( 233 void RenderFrameDeleted(
224 content::RenderFrameHost* render_frame_host) override { 234 content::RenderFrameHost* render_frame_host) override {
225 int tree_id = render_frame_host->GetAXTreeID(); 235 int tree_id = render_frame_host->GetAXTreeID();
226 AutomationEventRouter::GetInstance()->DispatchTreeDestroyedEvent( 236 AutomationEventRouter::GetInstance()->DispatchTreeDestroyedEvent(
227 tree_id, 237 tree_id,
228 browser_context_); 238 browser_context_);
229 } 239 }
230 240
231 private: 241 private:
232 friend class content::WebContentsUserData<AutomationWebContentsObserver>; 242 friend class content::WebContentsUserData<AutomationWebContentsObserver>;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (!error.empty()) { 461 if (!error.empty()) {
452 Respond(Error(error)); 462 Respond(Error(error));
453 return; 463 return;
454 } 464 }
455 465
456 Respond( 466 Respond(
457 OneArgument(base::MakeUnique<base::FundamentalValue>(result_acc_obj_id))); 467 OneArgument(base::MakeUnique<base::FundamentalValue>(result_acc_obj_id)));
458 } 468 }
459 469
460 } // namespace extensions 470 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698