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

Side by Side Diff: chrome/browser/ui/aura/accessibility/automation_manager_aura.cc

Issue 1198613002: Revert of Reimplement automation API on top of C++-backed AXTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@automation_faster_2
Patch Set: Created 5 years, 6 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/ui/aura/accessibility/automation_manager_aura.h" 5 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou ter.h" 11 #include "chrome/browser/extensions/api/automation_internal/automation_util.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/common/extensions/chrome_extension_messages.h"
14 #include "content/public/browser/ax_event_notification_details.h" 13 #include "content/public/browser/ax_event_notification_details.h"
15 #include "content/public/browser/browser_context.h" 14 #include "content/public/browser/browser_context.h"
16 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
17 #include "ui/views/accessibility/ax_aura_obj_cache.h" 16 #include "ui/views/accessibility/ax_aura_obj_cache.h"
18 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" 17 #include "ui/views/accessibility/ax_aura_obj_wrapper.h"
19 #include "ui/views/view.h" 18 #include "ui/views/view.h"
20 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
21 20
22 using content::BrowserContext; 21 using content::BrowserContext;
23 using extensions::AutomationEventRouter;
24 22
25 // static 23 // static
26 AutomationManagerAura* AutomationManagerAura::GetInstance() { 24 AutomationManagerAura* AutomationManagerAura::GetInstance() {
27 return Singleton<AutomationManagerAura>::get(); 25 return Singleton<AutomationManagerAura>::get();
28 } 26 }
29 27
30 void AutomationManagerAura::Enable(BrowserContext* context) { 28 void AutomationManagerAura::Enable(BrowserContext* context) {
31 enabled_ = true; 29 enabled_ = true;
32 if (!current_tree_.get()) 30 if (!current_tree_.get())
33 current_tree_.reset(new AXTreeSourceAura()); 31 current_tree_.reset(new AXTreeSourceAura());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 122 }
125 123
126 void AutomationManagerAura::ResetSerializer() { 124 void AutomationManagerAura::ResetSerializer() {
127 current_tree_serializer_.reset( 125 current_tree_serializer_.reset(
128 new ui::AXTreeSerializer<views::AXAuraObjWrapper*>(current_tree_.get())); 126 new ui::AXTreeSerializer<views::AXAuraObjWrapper*>(current_tree_.get()));
129 } 127 }
130 128
131 void AutomationManagerAura::SendEvent(BrowserContext* context, 129 void AutomationManagerAura::SendEvent(BrowserContext* context,
132 views::AXAuraObjWrapper* aura_obj, 130 views::AXAuraObjWrapper* aura_obj,
133 ui::AXEvent event_type) { 131 ui::AXEvent event_type) {
134 ExtensionMsg_AccessibilityEventParams params; 132 ui::AXTreeUpdate update;
135 current_tree_serializer_->SerializeChanges(aura_obj, &params.update); 133 current_tree_serializer_->SerializeChanges(aura_obj, &update);
136 params.tree_id = 0; 134
137 params.id = aura_obj->GetID(); 135 // Route this event to special process/routing ids recognized by the
138 params.event_type = event_type; 136 // Automation API as the desktop tree.
139 AutomationEventRouter* router = AutomationEventRouter::GetInstance(); 137 // TODO(dtseng): Would idealy define these special desktop constants in idl.
140 router->DispatchAccessibilityEvent(params); 138 content::AXEventNotificationDetails detail(
139 update.node_id_to_clear, update.nodes, event_type, aura_obj->GetID(),
140 0, /* process_id */
141 0 /* routing_id */);
142 std::vector<content::AXEventNotificationDetails> details;
143 details.push_back(detail);
144 extensions::automation_util::DispatchAccessibilityEventsToAutomation(
145 details, context, gfx::Vector2d());
141 } 146 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698