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

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

Issue 2341633006: MacViews/a11y: Allow accessibility clients to update the selected text. (Closed)
Patch Set: Review comments. 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
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 ui::EF_LEFT_MOUSE_BUTTON, 206 ui::EF_LEFT_MOUSE_BUTTON,
207 ui::EF_LEFT_MOUSE_BUTTON)); 207 ui::EF_LEFT_MOUSE_BUTTON));
208 view_->OnMouseReleased(ui::MouseEvent(ui::ET_MOUSE_RELEASED, 208 view_->OnMouseReleased(ui::MouseEvent(ui::ET_MOUSE_RELEASED,
209 center, 209 center,
210 center, 210 center,
211 ui::EventTimeForNow(), 211 ui::EventTimeForNow(),
212 ui::EF_LEFT_MOUSE_BUTTON, 212 ui::EF_LEFT_MOUSE_BUTTON,
213 ui::EF_LEFT_MOUSE_BUTTON)); 213 ui::EF_LEFT_MOUSE_BUTTON));
214 } 214 }
215 215
216 bool NativeViewAccessibility::SetStringValue(const base::string16& new_value) { 216 bool NativeViewAccessibility::SetStringValue(const base::string16& new_value,
217 bool clear_first) {
217 // Return an error if the view can't set the value. 218 // Return an error if the view can't set the value.
218 if (!CanSetStringValue()) 219 if (!CanSetStringValue())
219 return false; 220 return false;
220 221
221 ui::AXViewState state; 222 ui::AXViewState state;
222 view_->GetAccessibleState(&state); 223 view_->GetAccessibleState(&state);
223 state.set_value_callback.Run(new_value); 224 state.set_value_callback.Run(new_value, clear_first);
224 return true; 225 return true;
225 } 226 }
226 227
227 bool NativeViewAccessibility::CanSetStringValue() { 228 bool NativeViewAccessibility::CanSetStringValue() {
228 ui::AXViewState state; 229 ui::AXViewState state;
229 view_->GetAccessibleState(&state); 230 view_->GetAccessibleState(&state);
230 return !ui::AXViewState::IsFlagSet(GetData().state, ui::AX_STATE_READ_ONLY) && 231 return !ui::AXViewState::IsFlagSet(GetData().state, ui::AX_STATE_READ_ONLY) &&
231 !state.set_value_callback.is_null(); 232 !state.set_value_callback.is_null();
232 } 233 }
233 234
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 child_widget_platform_node->GetDelegate()); 275 child_widget_platform_node->GetDelegate());
275 if (child_widget_view_accessibility->parent_widget() != widget) 276 if (child_widget_view_accessibility->parent_widget() != widget)
276 child_widget_view_accessibility->SetParentWidget(widget); 277 child_widget_view_accessibility->SetParentWidget(widget);
277 } 278 }
278 279
279 result_child_widgets->push_back(child_widget); 280 result_child_widgets->push_back(child_widget);
280 } 281 }
281 } 282 }
282 283
283 } // namespace views 284 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/accessibility/native_view_accessibility.h ('k') | ui/views/accessibility/native_view_accessibility_auralinux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698