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

Side by Side Diff: ui/views/accessibility/ax_aura_obj_cache.cc

Issue 2416103003: Automation should fire focus event on root view of widgets (Closed)
Patch Set: Update spoken feedback browser tests Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/accessibility/ax_aura_obj_cache.h" 5 #include "ui/views/accessibility/ax_aura_obj_cache.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "ui/aura/client/focus_client.h" 9 #include "ui/aura/client/focus_client.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 focused_widget = Widget::GetWidgetForNativeView(focused_window); 144 focused_widget = Widget::GetWidgetForNativeView(focused_window);
145 } 145 }
146 146
147 if (!focused_widget) 147 if (!focused_widget)
148 return nullptr; 148 return nullptr;
149 149
150 FocusManager* focus_manager = focused_widget->GetFocusManager(); 150 FocusManager* focus_manager = focused_widget->GetFocusManager();
151 if (!focus_manager) 151 if (!focus_manager)
152 return nullptr; 152 return nullptr;
153 153
154 return focus_manager->GetFocusedView(); 154 View* focused_view = focus_manager->GetFocusedView();
155 if (focused_view)
156 return focused_view;
157 else
158 return focused_widget->GetRootView();
155 } 159 }
156 160
157 void AXAuraObjCache::OnWindowFocused(aura::Window* gained_focus, 161 void AXAuraObjCache::OnWindowFocused(aura::Window* gained_focus,
158 aura::Window* lost_focus) { 162 aura::Window* lost_focus) {
159 View* view = GetFocusedView(); 163 View* view = GetFocusedView();
160 if (view) 164 if (view)
161 view->NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true); 165 view->NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true);
162 } 166 }
163 167
164 void AXAuraObjCache::OnWindowDestroying(aura::Window* window) { 168 void AXAuraObjCache::OnWindowDestroying(aura::Window* window) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 AuraView* aura_view, 207 AuraView* aura_view,
204 std::map<AuraView*, int32_t>& aura_view_to_id_map) { 208 std::map<AuraView*, int32_t>& aura_view_to_id_map) {
205 int32_t id = GetID(aura_view); 209 int32_t id = GetID(aura_view);
206 if (id == -1) 210 if (id == -1)
207 return; 211 return;
208 aura_view_to_id_map.erase(aura_view); 212 aura_view_to_id_map.erase(aura_view);
209 Remove(id); 213 Remove(id);
210 } 214 }
211 215
212 } // namespace views 216 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698