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

[iOS] Removing UI for 'Do not track' setting

Bug: 493368
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: Iff0a4e01d2202899927e226886d2d54eee006a29
Reviewed-on: https://chromium-review.googlesource.com/1194223
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587105}
parent 7292da3b
...@@ -245,8 +245,6 @@ source_set("app_internal") { ...@@ -245,8 +245,6 @@ source_set("app_internal") {
"//ios/public/provider/chrome/browser/user_feedback", "//ios/public/provider/chrome/browser/user_feedback",
"//ios/testing/perf:startup", "//ios/testing/perf:startup",
"//ios/third_party/material_roboto_font_loader_ios", "//ios/third_party/material_roboto_font_loader_ios",
"//ios/web",
"//ios/web/public/app",
"//mojo/core/embedder", "//mojo/core/embedder",
"//net", "//net",
"//skia", "//skia",
......
...@@ -155,7 +155,6 @@ ...@@ -155,7 +155,6 @@
#include "ios/web/net/request_tracker_impl.h" #include "ios/web/net/request_tracker_impl.h"
#include "ios/web/net/web_http_protocol_handler_delegate.h" #include "ios/web/net/web_http_protocol_handler_delegate.h"
#import "ios/web/public/navigation_manager.h" #import "ios/web/public/navigation_manager.h"
#include "ios/web/public/web_capabilities.h"
#import "ios/web/public/web_state/web_state.h" #import "ios/web/public/web_state/web_state.h"
#import "ios/web/public/web_view_creation_util.h" #import "ios/web/public/web_view_creation_util.h"
#include "ios/web/public/webui/web_ui_ios_controller_factory.h" #include "ios/web/public/webui/web_ui_ios_controller_factory.h"
......
...@@ -993,14 +993,6 @@ locale. The strings in this file are specific to iOS. ...@@ -993,14 +993,6 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_OPTIONS_DATA_USAGE_ONLY_WIFI" desc="Title for the option to only send usage data and/or preload webpages when on wifi. [Length: 20em] [iOS only]"> <message name="IDS_IOS_OPTIONS_DATA_USAGE_ONLY_WIFI" desc="Title for the option to only send usage data and/or preload webpages when on wifi. [Length: 20em] [iOS only]">
Only on Wi-Fi Only on Wi-Fi
</message> </message>
<message name="IDS_IOS_OPTIONS_DO_NOT_TRACK_MOBILE" desc="Title for opening the setting for the 'Do Not Track' header. [Length: 15em]">
‘Do Not Track’
</message>
<message name="IDS_IOS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TEXT_MOBILE" desc="The text of a confirmation dialog that confirms that the user want to send the 'Do Not Track' header">
Enabling ‘Do Not Track’ means that a request will be included with your browsing traffic. Any effect depends on whether a website responds to the request, and how the request is interpreted.
For example, some websites may respond to this request by showing you ads that aren't based on other websites you've visited. Many websites will still collect and use your browsing data - for example to improve security, to provide content, services, ads and recommendations on their websites, and to generate reporting statistics. <ph name="BEGIN_LINK">BEGIN_LINK</ph>Learn more<ph name="END_LINK">END_LINK</ph>
</message>
<message name="IDS_IOS_OPTIONS_ENABLE_HANDOFF_TO_OTHER_DEVICES" desc="Title for the option to enable Handoff. [Length: 20em] [iOS only]"> <message name="IDS_IOS_OPTIONS_ENABLE_HANDOFF_TO_OTHER_DEVICES" desc="Title for the option to enable Handoff. [Length: 20em] [iOS only]">
Handoff Handoff
</message> </message>
......
...@@ -42,8 +42,6 @@ source_set("settings") { ...@@ -42,8 +42,6 @@ source_set("settings") {
"content_settings_collection_view_controller.mm", "content_settings_collection_view_controller.mm",
"dataplan_usage_collection_view_controller.h", "dataplan_usage_collection_view_controller.h",
"dataplan_usage_collection_view_controller.mm", "dataplan_usage_collection_view_controller.mm",
"do_not_track_collection_view_controller.h",
"do_not_track_collection_view_controller.mm",
"google_services_settings_consumer.h", "google_services_settings_consumer.h",
"google_services_settings_coordinator.h", "google_services_settings_coordinator.h",
"google_services_settings_coordinator.mm", "google_services_settings_coordinator.mm",
...@@ -206,7 +204,6 @@ source_set("settings") { ...@@ -206,7 +204,6 @@ source_set("settings") {
"//ios/public/provider/chrome/browser/voice", "//ios/public/provider/chrome/browser/voice",
"//ios/third_party/material_components_ios", "//ios/third_party/material_components_ios",
"//ios/third_party/material_roboto_font_loader_ios", "//ios/third_party/material_roboto_font_loader_ios",
"//ios/web",
"//net", "//net",
"//ui/base", "//ui/base",
"//url", "//url",
...@@ -276,7 +273,6 @@ source_set("unit_tests") { ...@@ -276,7 +273,6 @@ source_set("unit_tests") {
"compose_email_handler_collection_view_controller_unittest.mm", "compose_email_handler_collection_view_controller_unittest.mm",
"content_settings_collection_view_controller_unittest.mm", "content_settings_collection_view_controller_unittest.mm",
"dataplan_usage_collection_view_controller_unittest.mm", "dataplan_usage_collection_view_controller_unittest.mm",
"do_not_track_collection_view_controller_unittest.mm",
"import_data_collection_view_controller_unittest.mm", "import_data_collection_view_controller_unittest.mm",
"password_details_collection_view_controller_unittest.mm", "password_details_collection_view_controller_unittest.mm",
"password_exporter_unittest.mm", "password_exporter_unittest.mm",
...@@ -352,7 +348,6 @@ source_set("unit_tests") { ...@@ -352,7 +348,6 @@ source_set("unit_tests") {
"//ios/public/provider/chrome/browser", "//ios/public/provider/chrome/browser",
"//ios/public/provider/chrome/browser/voice", "//ios/public/provider/chrome/browser/voice",
"//ios/third_party/material_components_ios", "//ios/third_party/material_components_ios",
"//ios/web",
"//ios/web/public/test", "//ios/web/public/test",
"//net", "//net",
"//net:test_support", "//net:test_support",
...@@ -423,9 +418,7 @@ source_set("eg_tests") { ...@@ -423,9 +418,7 @@ source_set("eg_tests") {
"//ios/public/provider/chrome/browser/signin:test_support", "//ios/public/provider/chrome/browser/signin:test_support",
"//ios/testing/earl_grey:earl_grey_support", "//ios/testing/earl_grey:earl_grey_support",
"//ios/third_party/earl_grey:earl_grey+link", "//ios/third_party/earl_grey:earl_grey+link",
"//ios/web",
"//ios/web:earl_grey_test_support", "//ios/web:earl_grey_test_support",
"//ios/web/public/test",
"//ios/web/public/test/http_server", "//ios/web/public/test/http_server",
"//net", "//net",
"//ui/base", "//ui/base",
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_DO_NOT_TRACK_COLLECTION_VIEW_CONTROLLER_H_
#define IOS_CHROME_BROWSER_UI_SETTINGS_DO_NOT_TRACK_COLLECTION_VIEW_CONTROLLER_H_
#import "ios/chrome/browser/ui/settings/settings_root_collection_view_controller.h"
class PrefService;
@interface DoNotTrackCollectionViewController
: SettingsRootCollectionViewController
- (instancetype)initWithPrefs:(PrefService*)prefs NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithLayout:(UICollectionViewLayout*)layout
style:(CollectionViewControllerStyle)style
NS_UNAVAILABLE;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_DO_NOT_TRACK_COLLECTION_VIEW_CONTROLLER_H_
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/settings/do_not_track_collection_view_controller.h"
#include "base/mac/foundation_util.h"
#include "components/google/core/common/google_util.h"
#include "components/prefs/pref_member.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome.h"
#import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
#import "ios/chrome/browser/ui/settings/cells/settings_switch_item.h"
#include "ios/chrome/grit/ios_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
typedef NS_ENUM(NSInteger, SectionIdentifier) {
SectionIdentifierSwitch = kSectionIdentifierEnumZero,
SectionIdentifierFooter,
};
typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeSwitch = kItemTypeEnumZero,
ItemTypeFooter,
};
} // namespace
@interface DoNotTrackCollectionViewController () {
// Pref for whether or not 'Do Not Track' is enabled.
BooleanPrefMember _doNotTrackEnabled;
}
// Returns the item to be used as the preference switch.
- (CollectionViewItem*)switchItem;
// Returns the item to be used as a footer.
- (CollectionViewItem*)footerItem;
@end
@implementation DoNotTrackCollectionViewController
#pragma mark - Initialization
- (instancetype)initWithPrefs:(PrefService*)prefs {
UICollectionViewLayout* layout = [[MDCCollectionViewFlowLayout alloc] init];
self =
[super initWithLayout:layout style:CollectionViewControllerStyleAppBar];
if (self) {
self.title = l10n_util::GetNSString(IDS_IOS_OPTIONS_DO_NOT_TRACK_MOBILE);
_doNotTrackEnabled.Init(prefs::kEnableDoNotTrack, prefs);
self.collectionViewAccessibilityIdentifier = @"Do Not Track";
// TODO(crbug.com/764578): -loadModel should not be called from
// initializer. A possible fix is to move this call to -viewDidLoad.
[self loadModel];
}
return self;
}
- (void)loadModel {
[super loadModel];
CollectionViewModel* model = self.collectionViewModel;
[model addSectionWithIdentifier:SectionIdentifierSwitch];
[model addItem:[self switchItem]
toSectionWithIdentifier:SectionIdentifierSwitch];
[model addSectionWithIdentifier:SectionIdentifierFooter];
[model addItem:[self footerItem]
toSectionWithIdentifier:SectionIdentifierFooter];
}
- (CollectionViewItem*)switchItem {
SettingsSwitchItem* item =
[[SettingsSwitchItem alloc] initWithType:ItemTypeSwitch];
item.text = l10n_util::GetNSString(IDS_IOS_OPTIONS_DO_NOT_TRACK_MOBILE);
item.on = _doNotTrackEnabled.GetValue();
return item;
}
- (CollectionViewItem*)footerItem {
NSString* footerText = l10n_util::GetNSString(
IDS_IOS_OPTIONS_ENABLE_DO_NOT_TRACK_BUBBLE_TEXT_MOBILE);
GURL learnMoreURL = google_util::AppendGoogleLocaleParam(
GURL(kDoNotTrackLearnMoreURL),
GetApplicationContext()->GetApplicationLocale());
CollectionViewFooterItem* item =
[[CollectionViewFooterItem alloc] initWithType:ItemTypeFooter];
item.cellStyle = CollectionViewCellStyle::kUIKit;
item.text = footerText;
item.linkURL = learnMoreURL;
item.linkDelegate = self;
return item;
}
#pragma mark - Actions
- (void)switchToggled:(id)sender {
NSIndexPath* switchPath =
[self.collectionViewModel indexPathForItemType:ItemTypeSwitch
sectionIdentifier:SectionIdentifierSwitch];
SettingsSwitchItem* switchItem =
base::mac::ObjCCastStrict<SettingsSwitchItem>(
[self.collectionViewModel itemAtIndexPath:switchPath]);
SettingsSwitchCell* switchCell =
base::mac::ObjCCastStrict<SettingsSwitchCell>(
[self.collectionView cellForItemAtIndexPath:switchPath]);
// Update the model and the preference with the current value of the switch.
DCHECK_EQ(switchCell.switchView, sender);
BOOL isOn = switchCell.switchView.isOn;
switchItem.on = isOn;
_doNotTrackEnabled.SetValue(isOn);
}
#pragma mark - UICollectionViewDelegate
- (UICollectionViewCell*)collectionView:(UICollectionView*)collectionView
cellForItemAtIndexPath:(NSIndexPath*)indexPath {
UICollectionViewCell* cell =
[super collectionView:collectionView cellForItemAtIndexPath:indexPath];
NSInteger itemType =
[self.collectionViewModel itemTypeForIndexPath:indexPath];
if (itemType == ItemTypeSwitch) {
// Have the switch send a message on UIControlEventValueChanged.
SettingsSwitchCell* switchCell =
base::mac::ObjCCastStrict<SettingsSwitchCell>(cell);
[switchCell.switchView addTarget:self
action:@selector(switchToggled:)
forControlEvents:UIControlEventValueChanged];
}
return cell;
}
#pragma mark - MDCCollectionViewStylingDelegate
- (CGFloat)collectionView:(UICollectionView*)collectionView
cellHeightAtIndexPath:(NSIndexPath*)indexPath {
CollectionViewItem* item =
[self.collectionViewModel itemAtIndexPath:indexPath];
switch (item.type) {
case ItemTypeFooter:
return [MDCCollectionViewCell
cr_preferredHeightForWidth:CGRectGetWidth(collectionView.bounds)
forItem:item];
default:
return MDCCellDefaultOneLineHeight;
}
}
- (MDCCollectionViewCellStyle)collectionView:(UICollectionView*)collectionView
cellStyleForSection:(NSInteger)section {
NSInteger sectionIdentifier =
[self.collectionViewModel sectionIdentifierForSection:section];
switch (sectionIdentifier) {
case SectionIdentifierFooter:
// Display the Learn More footer in the default style with no "card" UI
// and no section padding.
return MDCCollectionViewCellStyleDefault;
default:
return self.styler.cellStyle;
}
}
- (BOOL)collectionView:(UICollectionView*)collectionView
shouldHideItemBackgroundAtIndexPath:(NSIndexPath*)indexPath {
NSInteger sectionIdentifier =
[self.collectionViewModel sectionIdentifierForSection:indexPath.section];
switch (sectionIdentifier) {
case SectionIdentifierFooter:
// Display the Learn More footer without any background image or
// shadowing.
return YES;
default:
return NO;
}
}
- (BOOL)collectionView:(UICollectionView*)collectionView
hidesInkViewAtIndexPath:(NSIndexPath*)indexPath {
NSInteger type = [self.collectionViewModel itemTypeForIndexPath:indexPath];
switch (type) {
case ItemTypeFooter:
case ItemTypeSwitch:
return YES;
default:
return NO;
}
}
@end
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/ui/settings/do_not_track_collection_view_controller.h"
#include <memory>
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/sync_preferences/pref_service_mock_factory.h"
#include "ios/chrome/browser/pref_names.h"
#import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
#include "ios/chrome/grit/ios_strings.h"
#include "testing/gtest/include/gtest/gtest.h"
#import "testing/gtest_mac.h"
#include "testing/platform_test.h"
#include "ui/base/l10n/l10n_util_mac.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
class DoNotTrackCollectionViewControllerTest
: public CollectionViewControllerTest {
protected:
void SetUp() override {
CollectionViewControllerTest::SetUp();
pref_service_ = CreateLocalState();
}
CollectionViewController* InstantiateController() override {
return [[DoNotTrackCollectionViewController alloc]
initWithPrefs:pref_service_.get()];
}
std::unique_ptr<PrefService> CreateLocalState() {
scoped_refptr<PrefRegistrySimple> registry(new PrefRegistrySimple());
registry->RegisterBooleanPref(prefs::kEnableDoNotTrack, false);
base::FilePath path("DoNotTrackCollectionViewControllerTest.pref");
sync_preferences::PrefServiceMockFactory factory;
factory.SetUserPrefsFile(path, message_loop_.task_runner().get());
return factory.Create(registry.get());
}
base::MessageLoopForUI message_loop_;
std::unique_ptr<PrefService> pref_service_;
};
TEST_F(DoNotTrackCollectionViewControllerTest, TestModelDoNotTrackOff) {
CreateController();
CheckController();
EXPECT_EQ(2, NumberOfSections());
EXPECT_EQ(1, NumberOfItemsInSection(0));
CheckSwitchCellStateAndTitleWithId(NO, IDS_IOS_OPTIONS_DO_NOT_TRACK_MOBILE, 0,
0);
}
TEST_F(DoNotTrackCollectionViewControllerTest, TestModelDoNotTrackOn) {
BooleanPrefMember doNotTrackEnabled;
doNotTrackEnabled.Init(prefs::kEnableDoNotTrack, pref_service_.get());
doNotTrackEnabled.SetValue(true);
CreateController();
EXPECT_EQ(2, NumberOfSections());
EXPECT_EQ(1, NumberOfItemsInSection(0));
CheckSwitchCellStateAndTitleWithId(YES, IDS_IOS_OPTIONS_DO_NOT_TRACK_MOBILE,
0, 0);
}
} // namespace
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#import "ios/chrome/browser/ui/settings/cells/settings_text_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_text_item.h"
#import "ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller.h" #import "ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/dataplan_usage_collection_view_controller.h" #import "ios/chrome/browser/ui/settings/dataplan_usage_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/do_not_track_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/handoff_collection_view_controller.h" #import "ios/chrome/browser/ui/settings/handoff_collection_view_controller.h"
#import "ios/chrome/browser/ui/settings/settings_navigation_controller.h" #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
#import "ios/chrome/browser/ui/settings/settings_utils.h" #import "ios/chrome/browser/ui/settings/settings_utils.h"
...@@ -41,7 +40,6 @@ ...@@ -41,7 +40,6 @@
#include "ios/chrome/grit/ios_chromium_strings.h" #include "ios/chrome/grit/ios_chromium_strings.h"
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h" #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
#include "ios/web/public/web_capabilities.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_mac.h" #include "ui/base/l10n/l10n_util_mac.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -69,7 +67,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -69,7 +67,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeWebServicesFooter, ItemTypeWebServicesFooter,
ItemTypeWebServicesShowSuggestions, ItemTypeWebServicesShowSuggestions,
ItemTypeWebServicesSendUsageData, ItemTypeWebServicesSendUsageData,
ItemTypeWebServicesDoNotTrack,
ItemTypeCanMakePaymentSwitch, ItemTypeCanMakePaymentSwitch,
ItemTypeClearBrowsingDataClear, ItemTypeClearBrowsingDataClear,
}; };
...@@ -101,7 +98,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -101,7 +98,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
- (CollectionViewItem*)clearBrowsingDetailItem; - (CollectionViewItem*)clearBrowsingDetailItem;
- (CollectionViewItem*)canMakePaymentItem; - (CollectionViewItem*)canMakePaymentItem;
- (CollectionViewItem*)sendUsageDetailItem; - (CollectionViewItem*)sendUsageDetailItem;
- (CollectionViewItem*)doNotTrackDetailItem;
@end @end
...@@ -171,10 +167,10 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -171,10 +167,10 @@ typedef NS_ENUM(NSInteger, ItemType) {
[model addItem:[self handoffDetailItem] [model addItem:[self handoffDetailItem]
toSectionWithIdentifier:SectionIdentifierOtherDevices]; toSectionWithIdentifier:SectionIdentifierOtherDevices];
if (!IsUnifiedConsentEnabled() || web::IsDoNotTrackSupported()) { if (!IsUnifiedConsentEnabled()) {
// Add "Web services" section only if "Do not track" feature, metrics // Add "Web services" section only if the unified consent is disabled.
// reporting feature and show suggestions feature are available. // Otherwise the metrics reporting and show suggestions feature are
// Web Services Section // available in the Google services settings.
[model addSectionWithIdentifier:SectionIdentifierWebServices]; [model addSectionWithIdentifier:SectionIdentifierWebServices];
SettingsTextItem* webServicesHeader = SettingsTextItem* webServicesHeader =
[[SettingsTextItem alloc] initWithType:ItemTypeWebServicesHeader]; [[SettingsTextItem alloc] initWithType:ItemTypeWebServicesHeader];
...@@ -183,12 +179,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -183,12 +179,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
webServicesHeader.textColor = [[MDCPalette greyPalette] tint500]; webServicesHeader.textColor = [[MDCPalette greyPalette] tint500];
[model setHeader:webServicesHeader [model setHeader:webServicesHeader
forSectionWithIdentifier:SectionIdentifierWebServices]; forSectionWithIdentifier:SectionIdentifierWebServices];
// Footer Section
[model addSectionWithIdentifier:SectionIdentifierWebServicesFooter];
[model addItem:[self showSuggestionsFooterItem]
toSectionWithIdentifier:SectionIdentifierWebServicesFooter];
}
if (!IsUnifiedConsentEnabled()) {
// When unified consent flag is enabled, the show suggestions feature and // When unified consent flag is enabled, the show suggestions feature and
// metrics reporting feature are available in the "Google Services and sync" // metrics reporting feature are available in the "Google Services and sync"
// settings. // settings.
...@@ -197,10 +187,10 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -197,10 +187,10 @@ typedef NS_ENUM(NSInteger, ItemType) {
toSectionWithIdentifier:SectionIdentifierWebServices]; toSectionWithIdentifier:SectionIdentifierWebServices];
[model addItem:[self sendUsageDetailItem] [model addItem:[self sendUsageDetailItem]
toSectionWithIdentifier:SectionIdentifierWebServices]; toSectionWithIdentifier:SectionIdentifierWebServices];
} // Footer Section
if (web::IsDoNotTrackSupported()) { [model addSectionWithIdentifier:SectionIdentifierWebServicesFooter];
[model addItem:[self doNotTrackDetailItem] [model addItem:[self showSuggestionsFooterItem]
toSectionWithIdentifier:SectionIdentifierWebServices]; toSectionWithIdentifier:SectionIdentifierWebServicesFooter];
} }
// CanMakePayment Section // CanMakePayment Section
...@@ -291,16 +281,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -291,16 +281,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
return _sendUsageDetailItem; return _sendUsageDetailItem;
} }
- (CollectionViewItem*)doNotTrackDetailItem {
NSString* detailText =
_browserState->GetPrefs()->GetBoolean(prefs::kEnableDoNotTrack)
? l10n_util::GetNSString(IDS_IOS_SETTING_ON)
: l10n_util::GetNSString(IDS_IOS_SETTING_OFF);
return [self detailItemWithType:ItemTypeWebServicesDoNotTrack
titleId:IDS_IOS_OPTIONS_DO_NOT_TRACK_MOBILE
detailText:detailText];
}
- (SettingsDetailItem*)detailItemWithType:(NSInteger)type - (SettingsDetailItem*)detailItemWithType:(NSInteger)type
titleId:(NSInteger)titleId titleId:(NSInteger)titleId
detailText:(NSString*)detailText { detailText:(NSString*)detailText {
...@@ -364,10 +344,6 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -364,10 +344,6 @@ typedef NS_ENUM(NSInteger, ItemType) {
title:l10n_util::GetNSString( title:l10n_util::GetNSString(
IDS_IOS_OPTIONS_SEND_USAGE_DATA)]; IDS_IOS_OPTIONS_SEND_USAGE_DATA)];
break; break;
case ItemTypeWebServicesDoNotTrack:
controller = [[DoNotTrackCollectionViewController alloc]
initWithPrefs:_browserState->GetPrefs()];
break;
case ItemTypeClearBrowsingDataClear: case ItemTypeClearBrowsingDataClear:
controller = [[ClearBrowsingDataCollectionViewController alloc] controller = [[ClearBrowsingDataCollectionViewController alloc]
initWithBrowserState:_browserState]; initWithBrowserState:_browserState];
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "ios/chrome/grit/ios_strings.h" #include "ios/chrome/grit/ios_strings.h"
#include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h"
#include "ios/web/public/test/test_web_thread_bundle.h" #include "ios/web/public/test/test_web_thread_bundle.h"
#include "ios/web/public/web_capabilities.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -109,8 +108,6 @@ TEST_F(PrivacyCollectionViewControllerTest, TestModel) { ...@@ -109,8 +108,6 @@ TEST_F(PrivacyCollectionViewControllerTest, TestModel) {
++sectionIndex; ++sectionIndex;
NSInteger expectedRows = 2; NSInteger expectedRows = 2;
if (web::IsDoNotTrackSupported())
expectedRows++;
EXPECT_EQ(expectedRows, NumberOfItemsInSection(sectionIndex)); EXPECT_EQ(expectedRows, NumberOfItemsInSection(sectionIndex));
CheckSectionHeaderWithId(IDS_IOS_OPTIONS_WEB_SERVICES_LABEL, sectionIndex); CheckSectionHeaderWithId(IDS_IOS_OPTIONS_WEB_SERVICES_LABEL, sectionIndex);
...@@ -123,16 +120,6 @@ TEST_F(PrivacyCollectionViewControllerTest, TestModel) { ...@@ -123,16 +120,6 @@ TEST_F(PrivacyCollectionViewControllerTest, TestModel) {
IDS_IOS_OPTIONS_DATA_USAGE_NEVER, sectionIndex, IDS_IOS_OPTIONS_DATA_USAGE_NEVER, sectionIndex,
row++); row++);
if (web::IsDoNotTrackSupported()) {
NSString* doNotTrackSubtitle =
chrome_browser_state_->GetPrefs()->GetBoolean(prefs::kEnableDoNotTrack)
? l10n_util::GetNSString(IDS_IOS_SETTING_ON)
: l10n_util::GetNSString(IDS_IOS_SETTING_OFF);
CheckTextCellTitleAndSubtitle(
l10n_util::GetNSString(IDS_IOS_OPTIONS_DO_NOT_TRACK_MOBILE),
doNotTrackSubtitle, sectionIndex, row++);
}
sectionIndex++; sectionIndex++;
EXPECT_EQ(1, NumberOfItemsInSection(sectionIndex)); EXPECT_EQ(1, NumberOfItemsInSection(sectionIndex));
CheckSectionFooterWithId(IDS_IOS_OPTIONS_PRIVACY_FOOTER, sectionIndex); CheckSectionFooterWithId(IDS_IOS_OPTIONS_PRIVACY_FOOTER, sectionIndex);
......
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