Chromium Code Reviews| 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..cd648941b1b4a2993dad5fc18b50350ebac66544 100644 |
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc |
| @@ -412,8 +412,19 @@ 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 { |
| + SelectRange(saved_selection_for_focus_change_); |
|
msw
2016/10/27 17:55:09
Should this check if saved_selection_for_focus_cha
Patti Lor
2016/10/31 00:35:05
Yes - thanks for picking that up!
|
| + saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); |
| + InsertOrReplaceText(new_value); |
| + model()->SetInputInProgress(true); |
|
msw
2016/10/27 17:55:08
nit: call this at the top of the block, to match S
Patti Lor
2016/10/31 00:35:05
Done.
|
| + TextChanged(); |
| + } |
| } |
| void OmniboxViewViews::UpdateSecurityLevel() { |
| @@ -737,7 +748,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; |