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

[iOS] Adding Google services link in Privacy section

Adding footer with: "For more settings that relate to privacy, security,
and data collection, see Sync and Google Services.", in Private
settings.
With a link in the string to open the Sync and Google Services settings.

https://drive.google.com/open?id=1MNsIMDmYlsb9TKDLSSYpblCXpD1x4Mmj

Bug: 956731
Change-Id: Icd918df58039f9b0d676982c3e3c01a22fbca109
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1587885
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#654824}
parent 3bd2edd9
......@@ -1073,6 +1073,9 @@ Handoff must also be enabled in the General section of Settings, and your device
<message name="IDS_IOS_OPTIONS_PRELOAD_WEBPAGES" desc="Title for opening the setting for if/when to preload webpages. [Length: 20em] [iOS only]">
Preload Webpages
</message>
<message name="IDS_IOS_OPTIONS_PRIVACY_GOOGLE_SERVICES_FOOTER" desc="Footer to invite the user to open the Sync and Google Services settings.">
For more settings that relate to privacy, security, and data collection, see <ph name="BEGIN_LINK">BEGIN_LINK</ph>Sync and Google Services<ph name="END_LINK">END_LINK</ph>.
</message>
<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>
......
d3b8b81f6f3c89161e65b9c72b694ebfe8489efc
\ No newline at end of file
......@@ -69,8 +69,14 @@ typedef NS_ENUM(NSInteger, ItemType) {
ItemTypeWebServicesShowSuggestions,
ItemTypeWebServicesFooter,
ItemTypeClearBrowsingDataClear,
// Footer to suggest the user to open Sync and Google services settings.
ItemTypeClearBrowsingDataFooter,
};
// Only used in this class to openn the Sync and Google services settings.
// This link should not be dispatched.
GURL kGoogleServicesSettingsURL("settings://open_google_services");
} // namespace
@interface PrivacyTableViewController () <BooleanObserver,
......@@ -185,6 +191,10 @@ typedef NS_ENUM(NSInteger, ItemType) {
[model addSectionWithIdentifier:SectionIdentifierClearBrowsingData];
[model addItem:[self clearBrowsingDetailItem]
toSectionWithIdentifier:SectionIdentifierClearBrowsingData];
if (unified_consent::IsUnifiedConsentFeatureEnabled()) {
[model setFooter:[self showClearBrowsingDataFooterItem]
forSectionWithIdentifier:SectionIdentifierClearBrowsingData];
}
}
#pragma mark - Model Objects
......@@ -225,6 +235,19 @@ typedef NS_ENUM(NSInteger, ItemType) {
return showSuggestionsFooterItem;
}
// Creates TableViewHeaderFooterItem instance to show a link to open the Sync
// and Google services settings.
- (TableViewHeaderFooterItem*)showClearBrowsingDataFooterItem {
TableViewLinkHeaderFooterItem* showClearBrowsingDataFooterItem =
[[TableViewLinkHeaderFooterItem alloc]
initWithType:ItemTypeClearBrowsingDataFooter];
showClearBrowsingDataFooterItem.text =
l10n_util::GetNSString(IDS_IOS_OPTIONS_PRIVACY_GOOGLE_SERVICES_FOOTER);
showClearBrowsingDataFooterItem.linkURL = kGoogleServicesSettingsURL;
return showClearBrowsingDataFooterItem;
}
- (TableViewItem*)clearBrowsingDetailItem {
return [self detailItemWithType:ItemTypeClearBrowsingDataClear
titleId:IDS_IOS_CLEAR_BROWSING_DATA_TITLE
......@@ -326,12 +349,9 @@ typedef NS_ENUM(NSInteger, ItemType) {
viewForFooterInSection:(NSInteger)section {
UIView* footerView =
[super tableView:tableView viewForFooterInSection:section];
if (SectionIdentifierWebServices ==
[self.tableViewModel sectionIdentifierForSection:section] &&
!unified_consent::IsUnifiedConsentFeatureEnabled()) {
// The footer view is only shown when Unified consent flag is off.
TableViewLinkHeaderFooterView* footer =
base::mac::ObjCCastStrict<TableViewLinkHeaderFooterView>(footerView);
TableViewLinkHeaderFooterView* footer =
base::mac::ObjCCast<TableViewLinkHeaderFooterView>(footerView);
if (footer) {
footer.delegate = self;
}
return footerView;
......@@ -507,4 +527,16 @@ typedef NS_ENUM(NSInteger, ItemType) {
}
}
#pragma mark - TableViewLinkHeaderFooterItemDelegate
- (void)view:(TableViewLinkHeaderFooterView*)view didTapLinkURL:(GURL)URL {
if (URL == kGoogleServicesSettingsURL) {
// kGoogleServicesSettingsURL is not a realy link. It should be handled
// with a special case.
[self.dispatcher showGoogleServicesSettingsFromViewController:self];
} else {
[super view:view didTapLinkURL:URL];
}
}
@end
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