Commit 7336385f authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] Removing pre-unity code from settings

Removing pre-unity code from settings.

Bug: 951313
Change-Id: I3249ca78d3bf80dd728040912e83afeb97be2369
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1798709Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701048}
parent d9331731
......@@ -222,9 +222,6 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_OPTIONS_IMPORT_DATA_TITLE_SIGNIN" desc="The title of the Import Data settings screen when signing in. [30em]">
Sign in to Chromium
</message>
<message name="IDS_IOS_OPTIONS_PRIVACY_FOOTER" desc="Footer for the clear browsing data dialog [Length: 300em] [iOS only]">
Chromium may use web services to improve your browsing experience. You may optionally disable these services. <ph name="BEGIN_LINK">BEGIN_LINK</ph>Learn more<ph name="END_LINK">END_LINK</ph>
</message>
<message name="IDS_IOS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY" desc="The text of the identity section for iOS.">
Chromium verified that <ph name="ISSUER">$1<ex>VeriSign</ex></ph> issued this website's certificate.
</message>
......@@ -282,9 +279,6 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_UPGRADE_AVAILABLE" desc="Text to inform the user of the presence of a new version of the application">
Chromium just got better! A new version is available.
</message>
<message name="IDS_IOS_SIGNIN_PROMO_SETTINGS" desc="Text to inform the user that they can sign in to get personal settings">
Sign in to Chromium to get your bookmarks, passwords, and more on all your devices.
</message>
</messages>
</release>
</grit>
......@@ -222,9 +222,6 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_OPTIONS_IMPORT_DATA_TITLE_SIGNIN" desc="The title of the Import Data settings screen when signing in. [30em]">
Sign in to Chrome
</message>
<message name="IDS_IOS_OPTIONS_PRIVACY_FOOTER" desc="Footer for the clear browsing data dialog [Length: 300em] [iOS only]">
Google Chrome may use web services to improve your browsing experience. You may optionally disable these services. <ph name="BEGIN_LINK">BEGIN_LINK</ph>Learn more<ph name="END_LINK">END_LINK</ph>
</message>
<message name="IDS_IOS_PAGE_INFO_SECURITY_TAB_SECURE_IDENTITY" desc="The text of the identity section for iOS.">
Chrome verified that <ph name="ISSUER">$1<ex>VeriSign</ex></ph> issued this website's certificate.
</message>
......@@ -282,9 +279,6 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_UPGRADE_AVAILABLE" desc="Text to inform the user of the presence of a new version of the application">
Chrome just got better! A new version is available.
</message>
<message name="IDS_IOS_SIGNIN_PROMO_SETTINGS" desc="Text to inform the user that they can sign in to get personal settings">
Sign in to Chrome to get your bookmarks, passwords, and more on all your devices.
</message>
</messages>
</release>
</grit>
......@@ -1081,12 +1081,6 @@ Handoff must also be enabled in the General section of Settings, and your device
<message name="IDS_IOS_OPTIONS_REPORT_AN_ISSUE" desc="Title for the option on Settings page to report an issue. [Length: 20em] [iOS only]">
Report an Issue
</message>
<message name="IDS_IOS_OPTIONS_SEARCH_URL_SUGGESTIONS" desc="Title for the option to turn on/off search and URL suggestions. [Length: 18em] [iOS only]">
Search and Site Suggestions
</message>
<message name="IDS_IOS_OPTIONS_SEND_USAGE_DATA" desc="Title for opening the setting for if/when to send usage data and crash reports. [Length: 20em] [iOS only]">
Send Usage Data
</message>
<message name="IDS_IOS_OPTIONS_WEB_SERVICES_LABEL" desc="Title for group of web services items in Privacy settings table, including Show Suggestions, Preload Webpages, and Send Usage Data. [Length: 10em] [iOS only]">
Web Services
</message>
......@@ -1600,9 +1594,6 @@ Handoff must also be enabled in the General section of Settings, and your device
<message name="IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SUBTITLE" desc="The subtitle for the setting item to Sign in to Chrome [iOS only]">
Get your bookmarks, history, passwords, and other settings on all your devices
</message>
<message name="IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SYNCING" desc="The subtitle for the setting item of the signed in user [iOS only]">
Syncing to <ph name="EMAIL">$1<ex>john.doe@gmail.com</ex></ph>
</message>
<message name="IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SYNC_OFF" desc="The subtitle for the setting item of the signed in user when sync is off [iOS only]">
Sync is off
</message>
......
......@@ -28,7 +28,6 @@ source_set("settings_root") {
"//ios/chrome/browser/ui/table_view",
"//ios/chrome/browser/ui/table_view:styler",
"//ios/chrome/browser/ui/table_view/cells",
"//ios/chrome/browser/ui/util",
"//ios/chrome/common/colors",
"//ios/chrome/common/ui_util",
"//ios/public/provider/chrome/browser",
......@@ -103,12 +102,10 @@ source_set("settings") {
"//components/content_settings/core/browser",
"//components/content_settings/core/common",
"//components/feature_engagement",
"//components/google/core/common",
"//components/handoff",
"//components/history/core/browser",
"//components/image_fetcher/ios",
"//components/keyed_service/core",
"//components/metrics",
"//components/password_manager/core/browser",
"//components/password_manager/core/common",
"//components/payments/core",
......@@ -120,8 +117,6 @@ source_set("settings") {
"//components/strings",
"//components/translate/core/browser",
"//components/translate/core/common",
"//components/ukm/ios:features",
"//components/unified_consent",
"//components/url_formatter",
"//components/version_info",
"//ios/chrome/app/strings",
......@@ -265,7 +260,6 @@ source_set("unit_tests") {
"//base/test:test_support",
"//components/autofill/core/common",
"//components/content_settings/core/browser",
"//components/google/core/common",
"//components/handoff",
"//components/language/core/browser",
"//components/password_manager/core/browser:test_support",
......@@ -279,8 +273,6 @@ source_set("unit_tests") {
"//components/sync_preferences:test_support",
"//components/translate/core/browser",
"//components/translate/core/common",
"//components/ukm/ios:features",
"//components/unified_consent",
"//ios/chrome/app/strings",
"//ios/chrome/browser",
"//ios/chrome/browser/browser_state",
......@@ -304,7 +296,6 @@ source_set("unit_tests") {
"//ios/chrome/browser/ui/settings/cells",
"//ios/chrome/browser/ui/table_view",
"//ios/chrome/browser/ui/table_view:test_support",
"//ios/chrome/browser/ui/util",
"//ios/chrome/browser/voice",
"//ios/chrome/browser/web",
"//ios/chrome/browser/web:test_support",
......@@ -351,8 +342,6 @@ source_set("eg_tests") {
"//components/prefs",
"//components/search_engines",
"//components/strings",
"//components/ukm/ios:features",
"//components/unified_consent",
"//ios/chrome/app:app_internal",
"//ios/chrome/app/strings",
"//ios/chrome/app/theme",
......@@ -370,8 +359,6 @@ source_set("eg_tests") {
"//ios/chrome/browser/ui/authentication/cells",
"//ios/chrome/browser/ui/settings:test_support",
"//ios/chrome/browser/ui/table_view/cells",
"//ios/chrome/browser/ui/util",
"//ios/chrome/browser/ui/util:util",
"//ios/chrome/test:eg_test_support",
"//ios/chrome/test:test_support",
"//ios/chrome/test/app:test_support",
......
......@@ -6,41 +6,26 @@
#include "base/logging.h"
#import "base/mac/foundation_util.h"
#include "components/google/core/common/google_util.h"
#include "components/handoff/pref_names_ios.h"
#include "components/metrics/metrics_pref_names.h"
#include "components/payments/core/payment_prefs.h"
#import "components/prefs/ios/pref_observer_bridge.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/ukm/ios/features.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/browsing_data/browsing_data_features.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/pref_names.h"
#include "ios/chrome/browser/system_flags.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/settings/cells/settings_cells_constants.h"
#import "ios/chrome/browser/ui/settings/cells/settings_switch_cell.h"
#import "ios/chrome/browser/ui/settings/cells/settings_switch_item.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_local_commands.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/dataplan_usage_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/handoff_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
#import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h"
#import "ios/chrome/browser/ui/settings/utils/settings_utils.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_detail_icon_item.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_detail_text_item.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_link_header_footer_item.h"
#import "ios/chrome/browser/ui/table_view/cells/table_view_text_header_footer_item.h"
#include "ios/chrome/browser/ui/ui_feature_flags.h"
#include "ios/chrome/browser/ui/util/ui_util.h"
#include "ios/chrome/grit/ios_chromium_strings.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -63,9 +48,6 @@ typedef NS_ENUM(NSInteger, SectionIdentifier) {
typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeOtherDevicesHandoff = kItemTypeEnumZero,
ItemTypeWebServicesPaymentSwitch,
ItemTypeWebServicesSendUsageData,
ItemTypeWebServicesShowSuggestions,
ItemTypeWebServicesFooter,
ItemTypeClearBrowsingDataClear,
// Footer to suggest the user to open Sync and Google services settings.
ItemTypeClearBrowsingDataFooter,
......@@ -77,13 +59,9 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
} // namespace
@interface PrivacyTableViewController () <BooleanObserver,
ClearBrowsingDataLocalCommands,
@interface PrivacyTableViewController () <ClearBrowsingDataLocalCommands,
PrefObserverDelegate> {
ios::ChromeBrowserState* _browserState; // weak
PrefBackedBoolean* _suggestionsEnabled;
// The item related to the switch for the show suggestions setting.
SettingsSwitchItem* _showSuggestionsItem;
// Pref observer to track changes to prefs.
std::unique_ptr<PrefObserverBridge> _prefObserverBridge;
......@@ -93,8 +71,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
// Updatable Items
TableViewDetailIconItem* _handoffDetailItem;
TableViewDetailIconItem* _sendUsageDetailItem;
SettingsSwitchItem* _sendUsageToggleSwitchItem;
}
@end
......@@ -114,14 +90,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
_browserState = browserState;
self.title =
l10n_util::GetNSString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY);
if (!unified_consent::IsUnifiedConsentFeatureEnabled()) {
// When unified consent flag is enabled, the suggestion setting is
// available in the "Google Services and sync" settings.
_suggestionsEnabled = [[PrefBackedBoolean alloc]
initWithPrefService:_browserState->GetPrefs()
prefName:prefs::kSearchSuggestEnabled];
[_suggestionsEnabled setObserver:self];
}
PrefService* prefService = _browserState->GetPrefs();
......@@ -133,14 +101,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
// screen.
_prefObserverBridge->ObserveChangesForPreference(
prefs::kIosHandoffToOtherDevices, &_prefChangeRegistrar);
if (!unified_consent::IsUnifiedConsentFeatureEnabled()) {
_prefObserverBridge->ObserveChangesForPreference(
metrics::prefs::kMetricsReportingEnabled,
&_prefChangeRegistrarApplicationContext);
_prefObserverBridge->ObserveChangesForPreference(
prefs::kMetricsReportingWifiOnly,
&_prefChangeRegistrarApplicationContext);
}
}
return self;
}
......@@ -167,34 +127,13 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
toSectionWithIdentifier:SectionIdentifierWebServices];
[model addItem:[self canMakePaymentItem]
toSectionWithIdentifier:SectionIdentifierWebServices];
if (!unified_consent::IsUnifiedConsentFeatureEnabled()) {
// When unified consent flag is enabled, the show suggestions feature and
// metrics reporting feature are available in the "Google Services and sync"
// settings.
if (base::FeatureList::IsEnabled(kUmaCellular)) {
[model addItem:[self sendUsageToggleSwitchItem]
toSectionWithIdentifier:SectionIdentifierWebServices];
} else {
[model addItem:[self sendUsageDetailItem]
toSectionWithIdentifier:SectionIdentifierWebServices];
}
_showSuggestionsItem = [self showSuggestionsSwitchItem];
[model addItem:_showSuggestionsItem
toSectionWithIdentifier:SectionIdentifierWebServices];
[model setFooter:[self showSuggestionsFooterItem]
forSectionWithIdentifier:SectionIdentifierWebServices];
}
// Clear Browsing Section
[model addSectionWithIdentifier:SectionIdentifierClearBrowsingData];
[model addItem:[self clearBrowsingDetailItem]
toSectionWithIdentifier:SectionIdentifierClearBrowsingData];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[model setFooter:[self showClearBrowsingDataFooterItem]
forSectionWithIdentifier:SectionIdentifierClearBrowsingData];
}
[model setFooter:[self showClearBrowsingDataFooterItem]
forSectionWithIdentifier:SectionIdentifierClearBrowsingData];
}
#pragma mark - Model Objects
......@@ -212,29 +151,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
return _handoffDetailItem;
}
- (SettingsSwitchItem*)showSuggestionsSwitchItem {
SettingsSwitchItem* showSuggestionsSwitchItem = [[SettingsSwitchItem alloc]
initWithType:ItemTypeWebServicesShowSuggestions];
showSuggestionsSwitchItem.text =
l10n_util::GetNSString(IDS_IOS_OPTIONS_SEARCH_URL_SUGGESTIONS);
showSuggestionsSwitchItem.on = [_suggestionsEnabled value];
return showSuggestionsSwitchItem;
}
- (TableViewHeaderFooterItem*)showSuggestionsFooterItem {
TableViewLinkHeaderFooterItem* showSuggestionsFooterItem =
[[TableViewLinkHeaderFooterItem alloc]
initWithType:ItemTypeWebServicesFooter];
showSuggestionsFooterItem.text =
l10n_util::GetNSString(IDS_IOS_OPTIONS_PRIVACY_FOOTER);
showSuggestionsFooterItem.linkURL = google_util::AppendGoogleLocaleParam(
GURL(kPrivacyLearnMoreURL),
GetApplicationContext()->GetApplicationLocale());
return showSuggestionsFooterItem;
}
// Creates TableViewHeaderFooterItem instance to show a link to open the Sync
// and Google services settings.
- (TableViewHeaderFooterItem*)showClearBrowsingDataFooterItem {
......@@ -273,31 +189,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
isEnabled);
}
- (TableViewItem*)sendUsageDetailItem {
NSString* detailText = [DataplanUsageTableViewController
currentLabelForPreference:GetApplicationContext()->GetLocalState()
basePref:metrics::prefs::kMetricsReportingEnabled
wifiPref:prefs::kMetricsReportingWifiOnly];
_sendUsageDetailItem =
[self detailItemWithType:ItemTypeWebServicesSendUsageData
titleId:IDS_IOS_OPTIONS_SEND_USAGE_DATA
detailText:detailText];
return _sendUsageDetailItem;
}
- (SettingsSwitchItem*)sendUsageToggleSwitchItem {
_sendUsageToggleSwitchItem = [[SettingsSwitchItem alloc]
initWithType:ItemTypeWebServicesSendUsageData];
_sendUsageToggleSwitchItem.text =
l10n_util::GetNSString(IDS_IOS_OPTIONS_SEND_USAGE_DATA);
_sendUsageToggleSwitchItem.on =
GetApplicationContext()->GetLocalState()->GetBoolean(
metrics::prefs::kMetricsReportingEnabled);
return _sendUsageToggleSwitchItem;
}
- (TableViewDetailIconItem*)detailItemWithType:(NSInteger)type
titleId:(NSInteger)titleId
detailText:(NSString*)detailText {
......@@ -320,25 +211,12 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
NSInteger itemType = [self.tableViewModel itemTypeForIndexPath:indexPath];
if (itemType == ItemTypeWebServicesShowSuggestions) {
SettingsSwitchCell* switchCell =
base::mac::ObjCCastStrict<SettingsSwitchCell>(cell);
[switchCell.switchView addTarget:self
action:@selector(showSuggestionsToggled:)
forControlEvents:UIControlEventValueChanged];
} else if (itemType == ItemTypeWebServicesPaymentSwitch) {
if (itemType == ItemTypeWebServicesPaymentSwitch) {
SettingsSwitchCell* switchCell =
base::mac::ObjCCastStrict<SettingsSwitchCell>(cell);
[switchCell.switchView addTarget:self
action:@selector(canMakePaymentSwitchChanged:)
forControlEvents:UIControlEventValueChanged];
} else if (itemType == ItemTypeWebServicesSendUsageData &&
base::FeatureList::IsEnabled(kUmaCellular)) {
SettingsSwitchCell* switchCell =
base::mac::ObjCCastStrict<SettingsSwitchCell>(cell);
[switchCell.switchView addTarget:self
action:@selector(sendUsageDataToggled:)
forControlEvents:UIControlEventValueChanged];
}
return cell;
}
......@@ -370,16 +248,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
controller = [[HandoffTableViewController alloc]
initWithBrowserState:_browserState];
break;
case ItemTypeWebServicesSendUsageData:
if (!base::FeatureList::IsEnabled(kUmaCellular)) {
controller = [[DataplanUsageTableViewController alloc]
initWithPrefs:GetApplicationContext()->GetLocalState()
basePref:metrics::prefs::kMetricsReportingEnabled
wifiPref:prefs::kMetricsReportingWifiOnly
title:l10n_util::GetNSString(
IDS_IOS_OPTIONS_SEND_USAGE_DATA)];
}
break;
case ItemTypeClearBrowsingDataClear:
if (IsNewClearBrowsingDataUIEnabled()) {
ClearBrowsingDataTableViewController* clearBrowsingDataViewController =
......@@ -393,7 +261,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
}
break;
case ItemTypeWebServicesPaymentSwitch:
case ItemTypeWebServicesShowSuggestions:
default:
break;
}
......@@ -406,18 +273,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
#pragma mark - BooleanObserver
- (void)booleanDidChange:(id<ObservableBoolean>)observableBoolean {
DCHECK_EQ(observableBoolean, _suggestionsEnabled);
// Update the item.
_showSuggestionsItem.on = [_suggestionsEnabled value];
// Update the cell.
[self reconfigureCellsForItems:@[ _showSuggestionsItem ]];
}
#pragma mark - ClearBrowsingDataLocalCommands
- (void)openURL:(const GURL&)URL {
......@@ -435,24 +290,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
#pragma mark - Actions
- (void)showSuggestionsToggled:(UISwitch*)sender {
NSIndexPath* switchPath = [self.tableViewModel
indexPathForItemType:ItemTypeWebServicesShowSuggestions
sectionIdentifier:SectionIdentifierWebServices];
SettingsSwitchItem* switchItem =
base::mac::ObjCCastStrict<SettingsSwitchItem>(
[self.tableViewModel itemAtIndexPath:switchPath]);
SettingsSwitchCell* switchCell =
base::mac::ObjCCastStrict<SettingsSwitchCell>(
[self.tableView cellForRowAtIndexPath:switchPath]);
DCHECK_EQ(switchCell.switchView, sender);
BOOL isOn = switchCell.switchView.isOn;
switchItem.on = isOn;
[_suggestionsEnabled setValue:isOn];
}
- (void)canMakePaymentSwitchChanged:(UISwitch*)sender {
NSIndexPath* switchPath =
[self.tableViewModel indexPathForItemType:ItemTypeWebServicesPaymentSwitch
......@@ -470,20 +307,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
[self setCanMakePaymentEnabled:sender.isOn];
}
- (void)sendUsageDataToggled:(UISwitch*)sender {
NSIndexPath* switchPath =
[self.tableViewModel indexPathForItem:_sendUsageToggleSwitchItem];
SettingsSwitchCell* switchCell =
base::mac::ObjCCastStrict<SettingsSwitchCell>(
[self.tableView cellForRowAtIndexPath:switchPath]);
DCHECK_EQ(switchCell.switchView, sender);
_sendUsageToggleSwitchItem.on = sender.isOn;
GetApplicationContext()->GetLocalState()->SetBoolean(
metrics::prefs::kMetricsReportingEnabled, sender.isOn);
}
#pragma mark - PrefObserverDelegate
- (void)onPreferenceChanged:(const std::string&)preferenceName {
......@@ -496,28 +319,6 @@ GURL kGoogleServicesSettingsURL("settings://open_google_services");
[self reconfigureCellsForItems:@[ _handoffDetailItem ]];
return;
}
if (preferenceName == metrics::prefs::kMetricsReportingEnabled ||
preferenceName == prefs::kMetricsReportingWifiOnly) {
DCHECK(!unified_consent::IsUnifiedConsentFeatureEnabled());
if (base::FeatureList::IsEnabled(kUmaCellular)) {
bool isOn = GetApplicationContext()->GetLocalState()->GetBoolean(
metrics::prefs::kMetricsReportingEnabled);
_sendUsageToggleSwitchItem.on = isOn;
[self reconfigureCellsForItems:@[ _sendUsageToggleSwitchItem ]];
return;
} else {
NSString* detailText = [DataplanUsageTableViewController
currentLabelForPreference:GetApplicationContext()->GetLocalState()
basePref:metrics::prefs::kMetricsReportingEnabled
wifiPref:prefs::kMetricsReportingWifiOnly];
_sendUsageDetailItem.detailText = detailText;
[self reconfigureCellsForItems:@[ _sendUsageDetailItem ]];
return;
}
}
}
#pragma mark - TableViewLinkHeaderFooterItemDelegate
......
......@@ -14,8 +14,6 @@
#include "components/strings/grit/components_strings.h"
#include "components/sync_preferences/pref_service_mock_factory.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "components/ukm/ios/features.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#include "ios/chrome/browser/pref_names.h"
......@@ -95,9 +93,7 @@ TEST_F(PrivacyTableViewControllerTest, TestModel) {
EXPECT_EQ(2, NumberOfSections());
// Sections[0].
const int kExpectedNumberOfItermsInSection0 =
unified_consent::IsUnifiedConsentFeatureEnabled() ? 2 : 4;
EXPECT_EQ(kExpectedNumberOfItermsInSection0, NumberOfItemsInSection(0));
EXPECT_EQ(2, NumberOfItemsInSection(0));
NSString* handoffSubtitle = chrome_browser_state_->GetPrefs()->GetBoolean(
prefs::kIosHandoffToOtherDevices)
? l10n_util::GetNSString(IDS_IOS_SETTING_ON)
......@@ -109,19 +105,6 @@ TEST_F(PrivacyTableViewControllerTest, TestModel) {
NO, l10n_util::GetNSString(IDS_SETTINGS_CAN_MAKE_PAYMENT_TOGGLE_LABEL), 0,
1);
if (!unified_consent::IsUnifiedConsentFeatureEnabled()) {
if (base::FeatureList::IsEnabled(kUmaCellular)) {
CheckSwitchCellStateAndTextWithId(NO, IDS_IOS_OPTIONS_SEND_USAGE_DATA, 0,
2);
} else {
CheckDetailItemTextWithIds(IDS_IOS_OPTIONS_SEND_USAGE_DATA,
IDS_IOS_OPTIONS_DATA_USAGE_NEVER, 0, 2);
}
CheckSwitchCellStateAndTextWithId(
YES, IDS_IOS_OPTIONS_SEARCH_URL_SUGGESTIONS, 0, 3);
CheckSectionFooterWithId(IDS_IOS_OPTIONS_PRIVACY_FOOTER, 0);
}
// Sections[1].
EXPECT_EQ(1, NumberOfItemsInSection(1));
CheckTextCellText(l10n_util::GetNSString(IDS_IOS_CLEAR_BROWSING_DATA_TITLE),
......
......@@ -19,7 +19,6 @@
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h"
#include "components/unified_consent/feature.h"
#import "ios/chrome/app/main_controller.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/content_settings/host_content_settings_map_factory.h"
......@@ -75,10 +74,6 @@ enum MetricsServiceType {
kBreakpadFirstLaunch,
};
// Matcher for the Send Usage Data cell on the Privacy screen.
id<GREYMatcher> SendUsageDataButton() {
return ButtonWithAccessibilityLabelId(IDS_IOS_OPTIONS_SEND_USAGE_DATA);
}
// Matcher for the Clear Browsing Data cell on the Privacy screen.
id<GREYMatcher> ClearBrowsingDataCell() {
return ButtonWithAccessibilityLabelId(IDS_IOS_CLEAR_BROWSING_DATA_TITLE);
......@@ -721,20 +716,11 @@ id<GREYMatcher> BandwidthSettingsButton() {
GREYAssertNil(settings.keyCommands,
@"Settings should not register key commands when presented.");
// Dismiss the Sign-in UI.
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
// Cancel the sign-in operation.
[[EarlGrey selectElementWithMatcher:
grey_buttonTitle([l10n_util::GetNSString(
IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON)
uppercaseString])] performAction:grey_tap()];
} else {
// Cancel the add account operation.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_buttonTitle(@"Cancel"),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
}
// Cancel the sign-in operation.
[[EarlGrey selectElementWithMatcher:
grey_buttonTitle([l10n_util::GetNSString(
IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON)
uppercaseString])] performAction:grey_tap()];
// Wait for UI to finish closing the Sign-in screen.
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
......@@ -744,20 +730,4 @@ id<GREYMatcher> BandwidthSettingsButton() {
@"Settings should register key commands when presented.");
}
// Verifies the UI elements are accessible on the Send Usage Data page.
- (void)testAccessibilityOnSendUsageData {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
EARL_GREY_TEST_DISABLED(
@"Privacy switch for ContentSuggestion was moved to the Sync and "
"Google services settings screen, so it is no longer present in the "
"privacy section. This test is now covered by "
"-[GoogleServicesSettingsTestCase testOpeningServices].");
}
[ChromeEarlGreyUI openSettingsMenu];
[ChromeEarlGreyUI tapSettingsMenuButton:SettingsMenuPrivacyButton()];
[ChromeEarlGreyUI tapPrivacyMenuButton:SendUsageDataButton()];
[ChromeEarlGrey verifyAccessibilityForCurrentScreen];
[self closeSubSettingsMenu];
}
@end
......@@ -22,7 +22,6 @@
#import "components/signin/public/identity_manager/objc/identity_manager_observer_bridge.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/driver/sync_service.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h"
......@@ -383,15 +382,13 @@ NSString* kDevViewSourceKey = @"DevViewSource";
[model addItem:[self accountCellItem]
toSectionWithIdentifier:SectionIdentifierAccount];
}
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
if (![model hasSectionForSectionIdentifier:SectionIdentifierAccount]) {
// Add the Account section for the Google services cell, if the user is
// signed-out.
[model addSectionWithIdentifier:SectionIdentifierAccount];
}
[model addItem:[self googleServicesCellItem]
toSectionWithIdentifier:SectionIdentifierAccount];
if (![model hasSectionForSectionIdentifier:SectionIdentifierAccount]) {
// Add the Account section for the Google services cell, if the user is
// signed-out.
[model addSectionWithIdentifier:SectionIdentifierAccount];
}
[model addItem:[self googleServicesCellItem]
toSectionWithIdentifier:SectionIdentifierAccount];
// Basics section
[model addSectionWithIdentifier:SectionIdentifierBasics];
......@@ -454,13 +451,8 @@ NSString* kDevViewSourceKey = @"DevViewSource";
if (_signinPromoViewMediator) {
TableViewSigninPromoItem* signinPromoItem =
[[TableViewSigninPromoItem alloc] initWithType:ItemTypeSigninPromo];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
signinPromoItem.text =
l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_SETTINGS_WITH_UNITY);
} else {
signinPromoItem.text =
l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_SETTINGS);
}
signinPromoItem.text =
l10n_util::GetNSString(IDS_IOS_SIGNIN_PROMO_SETTINGS_WITH_UNITY);
signinPromoItem.configurator =
[_signinPromoViewMediator createConfigurator];
signinPromoItem.delegate = _signinPromoViewMediator;
......@@ -969,33 +961,7 @@ NSString* kDevViewSourceKey = @"DevViewSource";
}
identityAccountItem.image = [self userAccountImage];
identityAccountItem.text = [_identity userFullName];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
identityAccountItem.detailText = _identity.userEmail;
return;
}
SyncSetupService* syncSetupService =
SyncSetupServiceFactory::GetForBrowserState(_browserState);
if (!syncSetupService->HasFinishedInitialSetup()) {
identityAccountItem.detailText =
l10n_util::GetNSString(IDS_IOS_SYNC_SETUP_IN_PROGRESS);
identityAccountItem.shouldDisplayError = NO;
return;
}
identityAccountItem.shouldDisplayError =
!IsTransientSyncError(syncSetupService->GetSyncServiceState());
if (identityAccountItem.shouldDisplayError) {
identityAccountItem.detailText =
GetSyncErrorDescriptionForSyncSetupService(syncSetupService);
} else {
identityAccountItem.detailText =
syncSetupService->IsSyncEnabled()
? l10n_util::GetNSStringF(
IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SYNCING,
base::SysNSStringToUTF16([_identity userEmail]))
: l10n_util::GetNSString(
IDS_IOS_SIGN_IN_TO_CHROME_SETTING_SYNC_OFF);
}
identityAccountItem.detailText = _identity.userEmail;
}
- (void)reloadAccountCell {
......@@ -1138,11 +1104,7 @@ NSString* kDevViewSourceKey = @"DevViewSource";
#pragma mark SyncObserverModelBridge
- (void)onSyncStateChanged {
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[self reloadGoogleServicesCell];
} else {
[self reloadAccountCell];
}
[self reloadGoogleServicesCell];
}
#pragma mark - IdentityRefreshLogic
......
......@@ -6,7 +6,6 @@
#include "base/strings/sys_string_conversions.h"
#include "components/prefs/pref_service.h"
#include "components/unified_consent/feature.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/browser/ui/authentication/signin_earl_grey_ui.h"
......@@ -43,19 +42,11 @@ using chrome_test_util::ButtonWithAccessibilityLabelId;
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState];
[ChromeEarlGreyUI tapSettingsMenuButton:PrimarySignInButton()];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
// Cancel the sign-in operation.
[[EarlGrey selectElementWithMatcher:
grey_buttonTitle([l10n_util::GetNSString(
IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON)
uppercaseString])] performAction:grey_tap()];
} else {
// Cancel the add account operation.
[[EarlGrey
selectElementWithMatcher:grey_allOf(grey_buttonTitle(@"Cancel"),
grey_sufficientlyVisible(), nil)]
performAction:grey_tap()];
}
// Cancel the sign-in operation.
[[EarlGrey selectElementWithMatcher:
grey_buttonTitle([l10n_util::GetNSString(
IDS_IOS_ACCOUNT_CONSISTENCY_SETUP_SKIP_BUTTON)
uppercaseString])] performAction:grey_tap()];
[SigninEarlGreyUI
checkSigninPromoVisibleWithMode:SigninPromoViewModeColdState];
}
......
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