Commit a18f86e2 authored by Gheorghe Comanici's avatar Gheorghe Comanici Committed by Commit Bot

Set permanent text when omnibox_view_views is focused.

See the corresponding bug for situations where this was problematic. In
particular, the omnibox edit model is using this permanent text to
generate an AutocompleteInput object that gets sent to the autocomplete
controller to generate matches. See link below for details:
https://cs.chromium.org/chromium/src/components/omnibox/browser/omnibox_edit_model.cc?l=903

Baseline code does not update this permanent_text and generates an
AutocompleteInput object that is inconsistent with the actual page for
which suggestions are generated. For more details on what are the
consequences of this inconsistency, see examples in the link for the bug.

For the choice of permanent text that is used in the added line, see
https://cs.chromium.org/chromium/src/chrome/browser/ui/views/omnibox/omnibox_view_views.cc?l=220


Bug: 788162
Change-Id: I10a8f088f9c5ba47dd9f0b652599c53ab3c1ecfa
Reviewed-on: https://chromium-review.googlesource.com/797750
Commit-Queue: Gheorghe Comanici <gcomanici@chromium.org>
Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520732}
parent 9cdeda40
...@@ -770,6 +770,8 @@ bool OmniboxViewViews::HandleAccessibleAction( ...@@ -770,6 +770,8 @@ bool OmniboxViewViews::HandleAccessibleAction(
void OmniboxViewViews::OnFocus() { void OmniboxViewViews::OnFocus() {
views::Textfield::OnFocus(); views::Textfield::OnFocus();
model()->SetPermanentText(
controller()->GetToolbarModel()->GetFormattedURL(nullptr));
// TODO(oshima): Get control key state. // TODO(oshima): Get control key state.
model()->OnSetFocus(false); model()->OnSetFocus(false);
// Don't call controller()->OnSetFocus, this view has already acquired focus. // Don't call controller()->OnSetFocus, this view has already acquired focus.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment