Commit 62bb2145 authored by Livvie Lin's avatar Livvie Lin Committed by Commit Bot

Check if context menu feature is enabled in ShouldPreventElision

Makes sure that the URL remains elided if the context menu
option is removed, especially if the "Always Show Full URLs"
pref was previously turned on.

Bug: 1095975
Change-Id: Id5ab1d5c384483286bebb3e3e36cf5880db975d9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2252932Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Livvie Lin <livvielin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780449}
parent 7809f385
......@@ -5,6 +5,7 @@
#include "chrome/browser/ui/toolbar/chrome_location_bar_model_delegate.h"
#include "base/check.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_macros.h"
#include "build/build_config.h"
#include "chrome/browser/autocomplete/autocomplete_classifier_factory.h"
......@@ -20,6 +21,7 @@
#include "components/offline_pages/buildflags/buildflags.h"
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/omnibox_prefs.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
......@@ -76,6 +78,14 @@ bool ChromeLocationBarModelDelegate::GetURL(GURL* url) const {
}
bool ChromeLocationBarModelDelegate::ShouldPreventElision() {
// Don't record a histogram or prevent elision if the user is in a state
// where the show full URLs pref is enabled but the context menu option is
// disabled.
if (!base::FeatureList::IsEnabled(omnibox::kOmniboxContextMenuShowFullUrls) &&
GetElisionConfig() == ELISION_CONFIG_TURNED_OFF_BY_PREF) {
return false;
}
RecordElisionConfig();
if (GetElisionConfig() != ELISION_CONFIG_DEFAULT) {
return true;
......
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