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

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

Issue 2230093002: MacViews a11y: Allow accessibility clients to set the AXValue on some controls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't show attributes are writable if there is not callback provided to change its value. Created 4 years, 4 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/native_view_accessibility.h" 5 #include "ui/views/accessibility/native_view_accessibility.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ui/accessibility/ax_view_state.h" 9 #include "ui/accessibility/ax_view_state.h"
10 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Return an error if the view can't set the value. 208 // Return an error if the view can't set the value.
209 ui::AXViewState state; 209 ui::AXViewState state;
210 view_->GetAccessibleState(&state); 210 view_->GetAccessibleState(&state);
211 if (state.set_value_callback.is_null()) 211 if (state.set_value_callback.is_null())
212 return false; 212 return false;
213 213
214 state.set_value_callback.Run(new_value); 214 state.set_value_callback.Run(new_value);
215 return true; 215 return true;
216 } 216 }
217 217
218 bool NativeViewAccessibility::CanSetStringValue() {
tapted 2016/08/11 04:23:25 Can/should this be enforced by ui::AX_STATE_READ_O
Patti Lor 2016/08/12 01:57:42 I think that's a good idea - AXViewState is meant
219 ui::AXViewState state;
220 view_->GetAccessibleState(&state);
221 return !state.set_value_callback.is_null();
222 }
223
218 void NativeViewAccessibility::OnWidgetDestroying(Widget* widget) { 224 void NativeViewAccessibility::OnWidgetDestroying(Widget* widget) {
219 if (parent_widget_ == widget) { 225 if (parent_widget_ == widget) {
220 parent_widget_->RemoveObserver(this); 226 parent_widget_->RemoveObserver(this);
221 parent_widget_ = nullptr; 227 parent_widget_ = nullptr;
222 } 228 }
223 } 229 }
224 230
225 void NativeViewAccessibility::SetParentWidget(Widget* parent_widget) { 231 void NativeViewAccessibility::SetParentWidget(Widget* parent_widget) {
226 if (parent_widget_) 232 if (parent_widget_)
227 parent_widget_->RemoveObserver(this); 233 parent_widget_->RemoveObserver(this);
(...skipping 30 matching lines...) Expand all
258 child_widget_platform_node->GetDelegate()); 264 child_widget_platform_node->GetDelegate());
259 if (child_widget_view_accessibility->parent_widget() != widget) 265 if (child_widget_view_accessibility->parent_widget() != widget)
260 child_widget_view_accessibility->SetParentWidget(widget); 266 child_widget_view_accessibility->SetParentWidget(widget);
261 } 267 }
262 268
263 result_child_widgets->push_back(child_widget); 269 result_child_widgets->push_back(child_widget);
264 } 270 }
265 } 271 }
266 272
267 } // namespace views 273 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698