Commit 02035ae5 authored by Tommy C. Li's avatar Tommy C. Li Committed by Commit Bot

Omnibox: Steady State Elisions - Reset URL unless user has edited it

Currently, if the user has unelided the URL, the URL won't reset on
navigation.

Instead, we should only only preserve the URL if the user has actually
made modifications, rather than merely uneliding the URL.

Bug: 875002
Change-Id: Ie138ee9a0b4cf7d7d903d600a739deb2378de29c
Reviewed-on: https://chromium-review.googlesource.com/1178631Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584056}
parent 6587e83f
...@@ -222,6 +222,12 @@ AutocompleteMatch OmniboxEditModel::CurrentMatch( ...@@ -222,6 +222,12 @@ AutocompleteMatch OmniboxEditModel::CurrentMatch(
bool OmniboxEditModel::ResetDisplayUrls() { bool OmniboxEditModel::ResetDisplayUrls() {
const base::string16 old_current_permanent_url = GetCurrentPermanentUrlText(); const base::string16 old_current_permanent_url = GetCurrentPermanentUrlText();
// Track if the user has modified the text. This is different from
// |user_input_in_progress_| because we care if the user has actually
// modified the text, while |user_input_in_progress_| may be true even if
// the user has merely made a partial selection.
bool user_has_modified_text = view_->GetText() != old_current_permanent_url;
url_for_editing_ = controller()->GetToolbarModel()->GetFormattedFullURL(); url_for_editing_ = controller()->GetToolbarModel()->GetFormattedFullURL();
display_only_url_ = display_only_url_ =
OmniboxFieldTrial::IsHideSteadyStateUrlSchemeAndSubdomainsEnabled() OmniboxFieldTrial::IsHideSteadyStateUrlSchemeAndSubdomainsEnabled()
...@@ -239,7 +245,7 @@ bool OmniboxEditModel::ResetDisplayUrls() { ...@@ -239,7 +245,7 @@ bool OmniboxEditModel::ResetDisplayUrls() {
// URL" (which sounds as if it might be persistent) from seeing just that URL // URL" (which sounds as if it might be persistent) from seeing just that URL
// forever afterwards. // forever afterwards.
return (GetCurrentPermanentUrlText() != old_current_permanent_url) && return (GetCurrentPermanentUrlText() != old_current_permanent_url) &&
(!has_focus() || (!user_input_in_progress_ && !PopupIsOpen())); (!has_focus() || (!user_has_modified_text && !PopupIsOpen()));
} }
GURL OmniboxEditModel::PermanentURL() const { GURL OmniboxEditModel::PermanentURL() const {
......
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