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

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

Issue 2530073002: Add kAccessibilityFocusFallsbackToWidget property (Closed)
Patch Set: Fix AxAuraObjCache Created 4 years 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 | « ui/aura/client/aura_constants.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 "base/strings/string_util.h"
10 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/client/focus_client.h" 11 #include "ui/aura/client/focus_client.h"
10 #include "ui/aura/window.h" 12 #include "ui/aura/window.h"
11 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" 13 #include "ui/views/accessibility/ax_aura_obj_wrapper.h"
12 #include "ui/views/accessibility/ax_view_obj_wrapper.h" 14 #include "ui/views/accessibility/ax_view_obj_wrapper.h"
13 #include "ui/views/accessibility/ax_widget_obj_wrapper.h" 15 #include "ui/views/accessibility/ax_widget_obj_wrapper.h"
14 #include "ui/views/accessibility/ax_window_obj_wrapper.h" 16 #include "ui/views/accessibility/ax_window_obj_wrapper.h"
15 #include "ui/views/view.h" 17 #include "ui/views/view.h"
16 #include "ui/views/widget/widget.h" 18 #include "ui/views/widget/widget.h"
17 19
18 namespace views { 20 namespace views {
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 if (!focused_widget) 155 if (!focused_widget)
154 return nullptr; 156 return nullptr;
155 157
156 FocusManager* focus_manager = focused_widget->GetFocusManager(); 158 FocusManager* focus_manager = focused_widget->GetFocusManager();
157 if (!focus_manager) 159 if (!focus_manager)
158 return nullptr; 160 return nullptr;
159 161
160 View* focused_view = focus_manager->GetFocusedView(); 162 View* focused_view = focus_manager->GetFocusedView();
161 if (focused_view) 163 if (focused_view)
162 return focused_view; 164 return focused_view;
163 else 165
166 if (focused_window->GetProperty(
167 aura::client::kAccessibilityFocusFallsbackToWidgetKey)) {
168 // If no view is focused, falls back to root view.
164 return focused_widget->GetRootView(); 169 return focused_widget->GetRootView();
170 } else {
sky 2016/12/08 16:07:18 chromium style is no else after a return
yawano 2016/12/09 01:40:00 Done.
171 return nullptr;
172 }
165 } 173 }
166 174
167 void AXAuraObjCache::OnWindowFocused(aura::Window* gained_focus, 175 void AXAuraObjCache::OnWindowFocused(aura::Window* gained_focus,
168 aura::Window* lost_focus) { 176 aura::Window* lost_focus) {
169 OnFocusedViewChanged(); 177 OnFocusedViewChanged();
170 } 178 }
171 179
172 void AXAuraObjCache::OnWindowDestroying(aura::Window* window) { 180 void AXAuraObjCache::OnWindowDestroying(aura::Window* window) {
173 focus_client_ = nullptr; 181 focus_client_ = nullptr;
174 } 182 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 AuraView* aura_view, 219 AuraView* aura_view,
212 std::map<AuraView*, int32_t>& aura_view_to_id_map) { 220 std::map<AuraView*, int32_t>& aura_view_to_id_map) {
213 int32_t id = GetID(aura_view); 221 int32_t id = GetID(aura_view);
214 if (id == -1) 222 if (id == -1)
215 return; 223 return;
216 aura_view_to_id_map.erase(aura_view); 224 aura_view_to_id_map.erase(aura_view);
217 Remove(id); 225 Remove(id);
218 } 226 }
219 227
220 } // namespace views 228 } // namespace views
OLDNEW
« no previous file with comments | « ui/aura/client/aura_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698