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/ui/ash/accessibility/automation_manager_ash.h" | 5 #include "chrome/browser/ui/ash/accessibility/automation_manager_ash.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" |
(...skipping 26 matching lines...) Expand all Loading... |
37 current_tree_serializer_->Reset(); | 37 current_tree_serializer_->Reset(); |
38 } | 38 } |
39 | 39 |
40 void AutomationManagerAsh::HandleEvent(BrowserContext* context, | 40 void AutomationManagerAsh::HandleEvent(BrowserContext* context, |
41 views::View* view, | 41 views::View* view, |
42 ui::AXEvent event_type) { | 42 ui::AXEvent event_type) { |
43 if (!enabled_) { | 43 if (!enabled_) { |
44 return; | 44 return; |
45 } | 45 } |
46 | 46 |
47 // TODO(dtseng): Events should only be delivered to extensions with the | |
48 // desktop permission. | |
49 views::Widget* widget = view->GetWidget(); | 47 views::Widget* widget = view->GetWidget(); |
50 if (!widget) | 48 if (!widget) |
51 return; | 49 return; |
52 | 50 |
53 if (!context && g_browser_process->profile_manager()) { | 51 if (!context && g_browser_process->profile_manager()) { |
54 context = g_browser_process->profile_manager()->GetLastUsedProfile(); | 52 context = g_browser_process->profile_manager()->GetLastUsedProfile(); |
55 } | 53 } |
56 if (!context) { | 54 if (!context) { |
57 LOG(WARNING) << "Accessibility notification but no browser context"; | 55 LOG(WARNING) << "Accessibility notification but no browser context"; |
58 return; | 56 return; |
(...skipping 17 matching lines...) Expand all Loading... |
76 void AutomationManagerAsh::MakeVisible(int32 id) { | 74 void AutomationManagerAsh::MakeVisible(int32 id) { |
77 CHECK(enabled_); | 75 CHECK(enabled_); |
78 current_tree_->MakeVisible(id); | 76 current_tree_->MakeVisible(id); |
79 } | 77 } |
80 | 78 |
81 void AutomationManagerAsh::SetSelection(int32 id, int32 start, int32 end) { | 79 void AutomationManagerAsh::SetSelection(int32 id, int32 start, int32 end) { |
82 CHECK(enabled_); | 80 CHECK(enabled_); |
83 current_tree_->SetSelection(id, start, end); | 81 current_tree_->SetSelection(id, start, end); |
84 } | 82 } |
85 | 83 |
86 AutomationManagerAsh::AutomationManagerAsh() : enabled_(false) {} | 84 AutomationManagerAsh::AutomationManagerAsh() : enabled_(false) { |
| 85 } |
87 | 86 |
88 AutomationManagerAsh::~AutomationManagerAsh() {} | 87 AutomationManagerAsh::~AutomationManagerAsh() {} |
89 | 88 |
90 void AutomationManagerAsh::Reset() { | 89 void AutomationManagerAsh::Reset() { |
91 current_tree_.reset(new AXTreeSourceAsh()); | 90 current_tree_.reset(new AXTreeSourceAsh()); |
92 current_tree_serializer_.reset( | 91 current_tree_serializer_.reset( |
93 new ui::AXTreeSerializer<views::AXAuraObjWrapper*>( | 92 new ui::AXTreeSerializer<views::AXAuraObjWrapper*>( |
94 current_tree_.get())); | 93 current_tree_.get())); |
95 } | 94 } |
96 | 95 |
(...skipping 10 matching lines...) Expand all Loading... |
107 update.nodes, | 106 update.nodes, |
108 event_type, | 107 event_type, |
109 aura_obj->GetID(), | 108 aura_obj->GetID(), |
110 0, /* process_id */ | 109 0, /* process_id */ |
111 0 /* routing_id */); | 110 0 /* routing_id */); |
112 std::vector<content::AXEventNotificationDetails> details; | 111 std::vector<content::AXEventNotificationDetails> details; |
113 details.push_back(detail); | 112 details.push_back(detail); |
114 extensions::automation_util::DispatchAccessibilityEventsToAutomation( | 113 extensions::automation_util::DispatchAccessibilityEventsToAutomation( |
115 details, context, gfx::Vector2d()); | 114 details, context, gfx::Vector2d()); |
116 } | 115 } |
OLD | NEW |