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

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

Issue 2803823002: Fix Chrome OS virtual keyboard accessibility (Closed)
Patch Set: Rebase on dependent change Created 3 years, 8 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 "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" 9 #include "base/strings/string_util.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return GetOrCreate(focused_view); 117 return GetOrCreate(focused_view);
118 return nullptr; 118 return nullptr;
119 } 119 }
120 120
121 void AXAuraObjCache::OnFocusedViewChanged() { 121 void AXAuraObjCache::OnFocusedViewChanged() {
122 View* view = GetFocusedView(); 122 View* view = GetFocusedView();
123 if (view) 123 if (view)
124 view->NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true); 124 view->NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true);
125 } 125 }
126 126
127 void AXAuraObjCache::FireEvent(AXAuraObjWrapper* aura_obj,
128 ui::AXEvent event_type) {
129 if (delegate_)
130 delegate_->OnEvent(aura_obj, event_type);
131 }
132
127 AXAuraObjCache::AXAuraObjCache() 133 AXAuraObjCache::AXAuraObjCache()
128 : current_id_(1), 134 : current_id_(1),
129 focus_client_(nullptr), 135 focus_client_(nullptr),
130 is_destroying_(false), 136 is_destroying_(false),
131 delegate_(nullptr) {} 137 delegate_(nullptr) {}
132 138
133 AXAuraObjCache::~AXAuraObjCache() { 139 AXAuraObjCache::~AXAuraObjCache() {
134 is_destroying_ = true; 140 is_destroying_ = true;
135 cache_.clear(); 141 cache_.clear();
136 } 142 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 180
175 void AXAuraObjCache::OnWindowFocused(aura::Window* gained_focus, 181 void AXAuraObjCache::OnWindowFocused(aura::Window* gained_focus,
176 aura::Window* lost_focus) { 182 aura::Window* lost_focus) {
177 OnFocusedViewChanged(); 183 OnFocusedViewChanged();
178 } 184 }
179 185
180 void AXAuraObjCache::OnWindowDestroying(aura::Window* window) { 186 void AXAuraObjCache::OnWindowDestroying(aura::Window* window) {
181 focus_client_ = nullptr; 187 focus_client_ = nullptr;
182 } 188 }
183 189
190 void AXAuraObjCache::OnWindowHierarchyChanged(
David Tseng 2017/04/17 15:39:54 I don't know if this is what you really want. This
dmazzoni 2017/04/19 18:07:34 So on Chrome OS, there's only one root window for
David Tseng 2017/04/19 19:21:31 Please add a comment when we call root_window->Add
dmazzoni 2017/04/19 21:37:02 Done.
191 const HierarchyChangeParams& params) {
192 aura::Window* window = params.target;
193 if (window->parent()) {
194 delegate_->OnEvent(GetOrCreate(window->parent()),
195 ui::AX_EVENT_CHILDREN_CHANGED);
196 }
197 }
198
184 template <typename AuraViewWrapper, typename AuraView> 199 template <typename AuraViewWrapper, typename AuraView>
185 AXAuraObjWrapper* AXAuraObjCache::CreateInternal( 200 AXAuraObjWrapper* AXAuraObjCache::CreateInternal(
186 AuraView* aura_view, 201 AuraView* aura_view,
187 std::map<AuraView*, int32_t>& aura_view_to_id_map) { 202 std::map<AuraView*, int32_t>& aura_view_to_id_map) {
188 if (!aura_view) 203 if (!aura_view)
189 return nullptr; 204 return nullptr;
190 205
191 auto it = aura_view_to_id_map.find(aura_view); 206 auto it = aura_view_to_id_map.find(aura_view);
192 207
193 if (it != aura_view_to_id_map.end()) 208 if (it != aura_view_to_id_map.end())
(...skipping 25 matching lines...) Expand all
219 AuraView* aura_view, 234 AuraView* aura_view,
220 std::map<AuraView*, int32_t>& aura_view_to_id_map) { 235 std::map<AuraView*, int32_t>& aura_view_to_id_map) {
221 int32_t id = GetID(aura_view); 236 int32_t id = GetID(aura_view);
222 if (id == -1) 237 if (id == -1)
223 return; 238 return;
224 aura_view_to_id_map.erase(aura_view); 239 aura_view_to_id_map.erase(aura_view);
225 Remove(id); 240 Remove(id);
226 } 241 }
227 242
228 } // namespace views 243 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessibility/ax_aura_obj_cache.h ('k') | ui/views/accessibility/ax_window_obj_wrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698