Commit b458963f authored by Claude van der Merwe's avatar Claude van der Merwe Committed by Chromium LUCI CQ

Do not show Wifi Sync in search if phone not supported

Bug: 1162307
Change-Id: Ia52ba4e2866832c22243b1b001b4cfe88921f440
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616355Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Reviewed-by: default avatarJon Mann <jonmann@chromium.org>
Commit-Queue: Claude van der Merwe <cvandermerwe@google.com>
Cr-Commit-Position: refs/heads/master@{#842142}
parent 56001795
...@@ -553,13 +553,10 @@ void MultiDeviceSection::OnHostStatusChanged( ...@@ -553,13 +553,10 @@ void MultiDeviceSection::OnHostStatusChanged(
host_status_with_device) { host_status_with_device) {
SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate(); SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate();
updater.RemoveSearchTags(GetMultiDeviceOptedOutSearchConcepts()); updater.RemoveSearchTags(GetMultiDeviceOptedOutSearchConcepts());
updater.RemoveSearchTags(GetMultiDeviceOptedInWifiSyncSearchConcepts());
updater.RemoveSearchTags(GetMultiDeviceOptedInSearchConcepts()); updater.RemoveSearchTags(GetMultiDeviceOptedInSearchConcepts());
if (IsOptedIn(host_status_with_device.first)) { if (IsOptedIn(host_status_with_device.first)) {
updater.AddSearchTags(GetMultiDeviceOptedInSearchConcepts()); updater.AddSearchTags(GetMultiDeviceOptedInSearchConcepts());
if (features::IsWifiSyncAndroidEnabled())
updater.AddSearchTags(GetMultiDeviceOptedInWifiSyncSearchConcepts());
} else { } else {
updater.AddSearchTags(GetMultiDeviceOptedOutSearchConcepts()); updater.AddSearchTags(GetMultiDeviceOptedOutSearchConcepts());
} }
...@@ -571,13 +568,16 @@ void MultiDeviceSection::OnFeatureStatesChanged( ...@@ -571,13 +568,16 @@ void MultiDeviceSection::OnFeatureStatesChanged(
SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate(); SearchTagRegistry::ScopedTagUpdater updater = registry()->StartUpdate();
updater.RemoveSearchTags(GetSmartLockOptionsSearchConcepts()); updater.RemoveSearchTags(GetSmartLockOptionsSearchConcepts());
updater.RemoveSearchTags(GetMultiDeviceOptedInPhoneHubSearchConcepts()); updater.RemoveSearchTags(GetMultiDeviceOptedInPhoneHubSearchConcepts());
updater.RemoveSearchTags(GetMultiDeviceOptedInWifiSyncSearchConcepts());
if (feature_states_map.at(multidevice_setup::mojom::Feature::kSmartLock) == if (feature_states_map.at(multidevice_setup::mojom::Feature::kSmartLock) ==
multidevice_setup::mojom::FeatureState::kEnabledByUser) { multidevice_setup::mojom::FeatureState::kEnabledByUser) {
updater.AddSearchTags(GetSmartLockOptionsSearchConcepts()); updater.AddSearchTags(GetSmartLockOptionsSearchConcepts());
} }
if (IsPhoneHubSupported()) if (IsFeatureSupported(multidevice_setup::mojom::Feature::kPhoneHub))
updater.AddSearchTags(GetMultiDeviceOptedInPhoneHubSearchConcepts()); updater.AddSearchTags(GetMultiDeviceOptedInPhoneHubSearchConcepts());
if (IsFeatureSupported(multidevice_setup::mojom::Feature::kWifiSync))
updater.AddSearchTags(GetMultiDeviceOptedInWifiSyncSearchConcepts());
} }
void MultiDeviceSection::OnNearbySharingEnabledChanged() { void MultiDeviceSection::OnNearbySharingEnabledChanged() {
...@@ -592,9 +592,10 @@ void MultiDeviceSection::OnNearbySharingEnabledChanged() { ...@@ -592,9 +592,10 @@ void MultiDeviceSection::OnNearbySharingEnabledChanged() {
} }
} }
bool MultiDeviceSection::IsPhoneHubSupported() { bool MultiDeviceSection::IsFeatureSupported(
const FeatureState feature_state = multidevice_setup_client_->GetFeatureState( multidevice_setup::mojom::Feature feature) {
multidevice_setup::mojom::Feature::kPhoneHub); const FeatureState feature_state =
multidevice_setup_client_->GetFeatureState(feature);
return feature_state != FeatureState::kNotSupportedByPhone && return feature_state != FeatureState::kNotSupportedByPhone &&
feature_state != FeatureState::kNotSupportedByChromebook; feature_state != FeatureState::kNotSupportedByChromebook;
} }
......
...@@ -68,7 +68,7 @@ class MultiDeviceSection ...@@ -68,7 +68,7 @@ class MultiDeviceSection
// Nearby Share enabled pref change observer. // Nearby Share enabled pref change observer.
void OnNearbySharingEnabledChanged(); void OnNearbySharingEnabledChanged();
bool IsPhoneHubSupported(); bool IsFeatureSupported(multidevice_setup::mojom::Feature feature);
multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_; multidevice_setup::MultiDeviceSetupClient* multidevice_setup_client_;
phonehub::PhoneHubManager* phone_hub_manager_; phonehub::PhoneHubManager* phone_hub_manager_;
......
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