Commit 20b47dd1 authored by Daniel Classon's avatar Daniel Classon Committed by Commit Bot

[DevicePage] Fix "Touchpad scroll acceleration" search tag when feature disabled

Fix the "Touchpad scroll acceleration" search tag to only show up when
the corresponding kAllowScrollSettings flag is enabled.

Bug: 1116553
Change-Id: Idc553770da77b33ed7799811798b6bb0e055e0f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2424828Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Daniel Classon <dclasson@google.com>
Cr-Commit-Position: refs/heads/master@{#809506}
parent f830f1eb
......@@ -167,12 +167,6 @@ const std::vector<SearchConcept>& GetTouchpadSearchConcepts() {
mojom::SearchResultType::kSubpage,
{.subpage = mojom::Subpage::kPointers},
{IDS_OS_SETTINGS_TAG_TOUCHPAD_ALT1, SearchConcept::kAltTagEnd}},
{IDS_OS_SETTINGS_TAG_TOUCHPAD_SCROLL_ACCELERATION,
mojom::kPointersSubpagePath,
mojom::SearchResultIcon::kLaptop,
mojom::SearchResultDefaultRank::kMedium,
mojom::SearchResultType::kSetting,
{.setting = mojom::Setting::kTouchpadScrollAcceleration}},
{IDS_OS_SETTINGS_TAG_TOUCHPAD_REVERSE_SCROLLING,
mojom::kPointersSubpagePath,
mojom::SearchResultIcon::kLaptop,
......@@ -189,6 +183,19 @@ const std::vector<SearchConcept>& GetTouchpadSearchConcepts() {
return *tags;
}
const std::vector<SearchConcept>&
GetTouchpadScrollAccelerationSearchConcepts() {
static const base::NoDestructor<std::vector<SearchConcept>> tags({
{IDS_OS_SETTINGS_TAG_TOUCHPAD_SCROLL_ACCELERATION,
mojom::kPointersSubpagePath,
mojom::SearchResultIcon::kLaptop,
mojom::SearchResultDefaultRank::kMedium,
mojom::SearchResultType::kSetting,
{.setting = mojom::Setting::kTouchpadScrollAcceleration}},
});
return *tags;
}
const std::vector<SearchConcept>& GetMouseSearchConcepts() {
static const base::NoDestructor<std::vector<SearchConcept>> tags({
{IDS_OS_SETTINGS_TAG_MOUSE_ACCELERATION,
......@@ -928,11 +935,14 @@ void DeviceSection::RegisterHierarchy(HierarchyGenerator* generator) const {
void DeviceSection::TouchpadExists(bool exists) {
SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate();
updater.RemoveSearchTags(GetTouchpadSearchConcepts());
updater.RemoveSearchTags(GetTouchpadScrollAccelerationSearchConcepts());
if (exists)
if (exists) {
updater.AddSearchTags(GetTouchpadSearchConcepts());
else
updater.RemoveSearchTags(GetTouchpadSearchConcepts());
if (base::FeatureList::IsEnabled(chromeos::features::kAllowScrollSettings))
updater.AddSearchTags(GetTouchpadScrollAccelerationSearchConcepts());
}
}
void DeviceSection::MouseExists(bool exists) {
......
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