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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 2341633006: MacViews/a11y: Allow accessibility clients to update the selected text. (Closed)
Patch Set: Review comments. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | ui/accessibility/ax_view_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/omnibox/omnibox_view_views.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 3c2611c6c106caba846897fa0b3a2c57100bff52..880e42f43b371852d28e322dee99e7bb7a494ac3 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -412,8 +412,21 @@ bool OmniboxViewViews::HandleEarlyTabActions(const ui::KeyEvent& event) {
return true;
}
-void OmniboxViewViews::AccessibilitySetValue(const base::string16& new_value) {
- SetUserText(new_value, true);
+void OmniboxViewViews::AccessibilitySetValue(const base::string16& new_value,
+ bool clear_first) {
+ if (read_only())
+ return;
+ if (clear_first) {
+ SetUserText(new_value, true);
+ } else {
+ model()->SetInputInProgress(true);
+ if (saved_selection_for_focus_change_.IsValid()) {
+ SelectRange(saved_selection_for_focus_change_);
+ saved_selection_for_focus_change_ = gfx::Range::InvalidRange();
+ }
+ InsertOrReplaceText(new_value);
+ TextChanged();
+ }
}
void OmniboxViewViews::UpdateSecurityLevel() {
@@ -737,7 +750,14 @@ void OmniboxViewViews::GetAccessibleState(ui::AXViewState* state) {
base::string16::size_type entry_start;
base::string16::size_type entry_end;
- GetSelectionBounds(&entry_start, &entry_end);
+ // Selection information is saved separately when focus is moved off the
+ // current window - use that when there is no focus and it's valid.
+ if (saved_selection_for_focus_change_.IsValid()) {
+ entry_start = saved_selection_for_focus_change_.start();
+ entry_end = saved_selection_for_focus_change_.end();
+ } else {
+ GetSelectionBounds(&entry_start, &entry_end);
+ }
state->selection_start = entry_start;
state->selection_end = entry_end;
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_views.h ('k') | ui/accessibility/ax_view_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698