Commit 2a10770c authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Local NTP, Realbox: show suggestion removal UI only if omnibox does

Conjoins omnibox's transparency UI and the NTP realbox's removal UI on
omnibox::kOmniboxSuggestionTransparencyOptions.

Note: this leaves the keyboard shortcut (Shift+Delete) intentionally
enabled, as this is what Omnibox does.

R=mahmadi@chromium.org

Bug: 1002689
Change-Id: Iffdbd7a94567fce3352c0b7611229f9ddb4846b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1861275Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Commit-Queue: Dan Beam <dbeam@chromium.org>
Auto-Submit: Dan Beam <dbeam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705813}
parent dd13939b
...@@ -32,6 +32,7 @@ let MostVisitedData; ...@@ -32,6 +32,7 @@ let MostVisitedData;
* isGooglePage: boolean, * isGooglePage: boolean,
* realboxEnabled: boolean, * realboxEnabled: boolean,
* richerPicker: boolean, * richerPicker: boolean,
* suggestionTransparencyEnabled: boolean,
* translatedStrings: Object<string>}} * translatedStrings: Object<string>}}
*/ */
let configData; let configData;
......
...@@ -1462,7 +1462,7 @@ function populateAutocompleteMatches(matches) { ...@@ -1462,7 +1462,7 @@ function populateAutocompleteMatches(matches) {
col.forEach(colEl => matchEl.appendChild(colEl)); col.forEach(colEl => matchEl.appendChild(colEl));
} }
if (match.supportsDeletion) { if (match.supportsDeletion && configData.suggestionTransparencyEnabled) {
const icon = document.createElement('button'); const icon = document.createElement('button');
icon.title = configData.translatedStrings.removeSuggestion; icon.title = configData.translatedStrings.removeSuggestion;
icon.classList.add(CLASSES.REMOVE_ICON); icon.classList.add(CLASSES.REMOVE_ICON);
......
...@@ -619,6 +619,10 @@ class LocalNtpSource::SearchConfigurationProvider ...@@ -619,6 +619,10 @@ class LocalNtpSource::SearchConfigurationProvider
base::FeatureList::IsEnabled( base::FeatureList::IsEnabled(
features::kChromeColorsCustomColorPicker)); features::kChromeColorsCustomColorPicker));
config_data.SetBoolean("realboxEnabled", features::IsNtpRealboxEnabled()); config_data.SetBoolean("realboxEnabled", features::IsNtpRealboxEnabled());
config_data.SetBoolean(
"suggestionTransparencyEnabled",
base::FeatureList::IsEnabled(
omnibox::kOmniboxSuggestionTransparencyOptions));
} }
// Serialize the dictionary. // Serialize the dictionary.
......
...@@ -100,6 +100,7 @@ test.realbox.setUp = function() { ...@@ -100,6 +100,7 @@ test.realbox.setUp = function() {
setUpPage('local-ntp-template'); setUpPage('local-ntp-template');
configData.realboxEnabled = true; configData.realboxEnabled = true;
configData.suggestionTransparencyEnabled = true;
chrome.embeddedSearch = { chrome.embeddedSearch = {
newTabPage: {}, newTabPage: {},
......
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