| 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 6788f3ab8b250b641ce1aaa2f69874c47ffe05b3..7b3e153743d441e8ddf1a72c9f966277dd83b44a 100644
|
| --- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
|
| @@ -414,8 +414,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,
|
| + const bool& replace) {
|
| + base::string16 new_string = new_value;
|
| + if (replace) {
|
| + gfx::Range selection_range = saved_selection_for_focus_change_.IsValid()
|
| + ? saved_selection_for_focus_change_
|
| + : GetSelectedRange();
|
| + base::string16 current_text = GetText();
|
| + base::string16 new_string =
|
| + current_text.substr(0, selection_range.GetMin()) + new_value +
|
| + current_text.substr(selection_range.GetMax());
|
| + }
|
| + SetUserText(new_string, true);
|
| }
|
|
|
| void OmniboxViewViews::UpdateSecurityLevel() {
|
| @@ -740,7 +751,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;
|
|
|
|
|