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

Omnibox: Fix one-click unelide when scheme elision is disabled

Previously, the UnapplySteadyStateElisions method had a wrong early
exit for when ONLY the path was elided.

This CL removes that early exit and replaces it with a more robust
check.

Bug: 912671
Change-Id: I1046d54c678a560f1562ff375aba134c1ad01627
Reviewed-on: https://chromium-review.googlesource.com/c/1372849Reviewed-by: default avatarmanuk hovanesian <manukh@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615966}
parent 79951a21
...@@ -715,19 +715,18 @@ void OmniboxViewViews::SelectAllForUserGesture() { ...@@ -715,19 +715,18 @@ void OmniboxViewViews::SelectAllForUserGesture() {
} }
bool OmniboxViewViews::UnapplySteadyStateElisions(UnelisionGesture gesture) { bool OmniboxViewViews::UnapplySteadyStateElisions(UnelisionGesture gesture) {
// Early exit if no steady state elision features are enabled.
if (!OmniboxFieldTrial::IsHideSteadyStateUrlSchemeEnabled() &&
!OmniboxFieldTrial::IsHideSteadyStateUrlTrivialSubdomainsEnabled()) {
return false;
}
// No need to update the text if the user is already inputting text. // No need to update the text if the user is already inputting text.
if (model()->user_input_in_progress()) if (model()->user_input_in_progress())
return false; return false;
// No need to unelide if we are already displaying the full URL.
LocationBarModel* location_bar_model = controller()->GetLocationBarModel();
base::string16 full_url = location_bar_model->GetFormattedFullURL();
if (text() == full_url)
return false;
// Don't unelide if we are currently displaying Query in Omnibox search terms, // Don't unelide if we are currently displaying Query in Omnibox search terms,
// as otherwise, it would be impossible to refine query terms. // as otherwise, it would be impossible to refine query terms.
LocationBarModel* location_bar_model = controller()->GetLocationBarModel();
if (location_bar_model->GetDisplaySearchTerms(nullptr /* search_terms */)) if (location_bar_model->GetDisplaySearchTerms(nullptr /* search_terms */))
return false; return false;
...@@ -737,7 +736,6 @@ bool OmniboxViewViews::UnapplySteadyStateElisions(UnelisionGesture gesture) { ...@@ -737,7 +736,6 @@ bool OmniboxViewViews::UnapplySteadyStateElisions(UnelisionGesture gesture) {
if (IsSelectAll() && gesture != UnelisionGesture::HOME_KEY_PRESSED) if (IsSelectAll() && gesture != UnelisionGesture::HOME_KEY_PRESSED)
return false; return false;
base::string16 full_url = location_bar_model->GetFormattedFullURL();
size_t start, end; size_t start, end;
GetSelectionBounds(&start, &end); GetSelectionBounds(&start, &end);
......
...@@ -366,6 +366,7 @@ TEST_F(OmniboxViewViewsTest, ScheduledTextEditCommand) { ...@@ -366,6 +366,7 @@ TEST_F(OmniboxViewViewsTest, ScheduledTextEditCommand) {
// Test that Shift+Up and Shift+Down are not captured and let selection mode // Test that Shift+Up and Shift+Down are not captured and let selection mode
// take over. Test for crbug.com/863543 and crbug.com/892216. // take over. Test for crbug.com/863543 and crbug.com/892216.
TEST_F(OmniboxViewViewsTest, SelectWithShift_863543) { TEST_F(OmniboxViewViewsTest, SelectWithShift_863543) {
location_bar_model()->set_url(GURL("http://www.example.com/?query=1"));
const base::string16 text = const base::string16 text =
base::ASCIIToUTF16("http://www.example.com/?query=1"); base::ASCIIToUTF16("http://www.example.com/?query=1");
static_cast<OmniboxView*>(omnibox_view()) static_cast<OmniboxView*>(omnibox_view())
......
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