Commit 77e6161b authored by Livvie Lin's avatar Livvie Lin Committed by Commit Bot

Remove "Always show full URLs" menu item if pref managed

If the ShowFullUrlsInAddress bar is set by policy, the
"Always show full URLs" context menu item should not appear.

Bug: 1092654
Change-Id: I948e34a53abda81a89820399b26162c5678dac55
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2298324Reviewed-by: default avatarJustin Donnelly <jdonnelly@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Commit-Queue: Livvie Lin <livvielin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#791415}
parent 38f24fc1
...@@ -2199,15 +2199,12 @@ void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) { ...@@ -2199,15 +2199,12 @@ void OmniboxViewViews::UpdateContextMenu(ui::SimpleMenuModel* menu_contents) {
IDS_EDIT_SEARCH_ENGINES); IDS_EDIT_SEARCH_ENGINES);
if (base::FeatureList::IsEnabled(omnibox::kOmniboxContextMenuShowFullUrls)) { if (base::FeatureList::IsEnabled(omnibox::kOmniboxContextMenuShowFullUrls)) {
menu_contents->AddCheckItemWithStringId(IDC_SHOW_FULL_URLS,
IDS_CONTEXT_MENU_SHOW_FULL_URLS);
const PrefService::Preference* show_full_urls_pref = const PrefService::Preference* show_full_urls_pref =
location_bar_view_->profile()->GetPrefs()->FindPreference( location_bar_view_->profile()->GetPrefs()->FindPreference(
omnibox::kPreventUrlElisionsInOmnibox); omnibox::kPreventUrlElisionsInOmnibox);
if (show_full_urls_pref->IsManaged()) { if (!show_full_urls_pref->IsManaged()) {
menu_contents->SetEnabledAt( menu_contents->AddCheckItemWithStringId(IDC_SHOW_FULL_URLS,
menu_contents->GetIndexOfCommandId(IDC_SHOW_FULL_URLS), false); IDS_CONTEXT_MENU_SHOW_FULL_URLS);
} }
} }
} }
......
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