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

[iOS] Adding "Manage Your Google Account" in Google services settings

Adding "Manage Your Google Account" in Google services settings.

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

Bug: 961257
Change-Id: I8a6b13f40e4b3b09e3ebcef546dc5d0f9b75e38f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1602510Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658993}
parent 3c9e8133
......@@ -837,6 +837,9 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_LONG_PRESS_TOOLBAR_IPH_PROMOTION_TEXT" desc="Text for the LongPress Toolbar Tip in-product help promotion, explaining that the user can long press on the toolbar's button to display more options. [iOS only]">
Press and hold for more tab options
</message>
<message name="IDS_IOS_MANAGE_YOUR_GOOGLE_ACCOUNT_TITLE" desc="Title for the view in the Settings to open 'Google Account' web page.">
Manage Your Google Account
</message>
<message name="IDS_IOS_MANAGE_SYNC_SETTINGS_TITLE" desc="Title for the view in the Settings for enabling/disabling Sync. [iOS only]">
Manage Sync
</message>
......
52e0e646914c86c0381be5645a0bc8b4abba3c1a
\ No newline at end of file
......@@ -77,6 +77,8 @@ const size_t kNumberOfChromeHostURLs = base::size(kChromeHostURLs);
const char kSyncGoogleDashboardURL[] =
"https://www.google.com/settings/chrome/sync/";
const char kManageYourGoogleAccountURL[] = "https://myaccount.google.com/";
const char kPageInfoHelpCenterURL[] =
"https://support.google.com/chrome?p=ui_security_indicator&ios=1";
......
......@@ -71,6 +71,9 @@ extern const size_t kNumberOfChromeHostURLs;
// URL to the sync google dashboard.
extern const char kSyncGoogleDashboardURL[];
// URL to the Google account configuration page.
extern const char kManageYourGoogleAccountURL[];
// "What do these mean?" URL for the Page Info bubble.
extern const char kPageInfoHelpCenterURL[];
......
......@@ -26,6 +26,9 @@
// Opens the manage sync settings view.
- (void)openManageSyncSettings;
// Open the "Manage Your Google Account" web page
- (void)openManageGoogleAccountWebPage;
@end
#endif // IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_GOOGLE_SERVICES_SETTINGS_COMMAND_HANDLER_H_
......@@ -5,8 +5,10 @@
#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.h"
#include "base/mac/foundation_util.h"
#include "components/google/core/common/google_util.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/signin/authentication_service.h"
#import "ios/chrome/browser/signin/authentication_service_factory.h"
#include "ios/chrome/browser/signin/identity_manager_factory.h"
......@@ -15,6 +17,7 @@
#include "ios/chrome/browser/sync/sync_setup_service_factory.h"
#import "ios/chrome/browser/ui/authentication/authentication_flow.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
#import "ios/chrome/browser/ui/commands/open_new_tab_command.h"
#import "ios/chrome/browser/ui/settings/google_services/accounts_table_view_controller.h"
#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_command_handler.h"
#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.h"
......@@ -239,6 +242,14 @@
[self.manageSyncSettingsCoordinator start];
}
- (void)openManageGoogleAccountWebPage {
GURL url = google_util::AppendGoogleLocaleParam(
GURL(kManageYourGoogleAccountURL),
GetApplicationContext()->GetApplicationLocale());
OpenNewTabCommand* command = [OpenNewTabCommand commandWithURLFromChrome:url];
[self.dispatcher closeSettingsUIAndOpenURL:command];
}
#pragma mark - GoogleServicesSettingsViewControllerPresentationDelegate
- (void)googleServicesSettingsViewControllerDidRemove:
......
......@@ -60,6 +60,7 @@ typedef NS_ENUM(NSInteger, SectionIdentifier) {
typedef NS_ENUM(NSInteger, ItemType) {
// IdentitySectionIdentifier section.
IdentityItemType = kItemTypeEnumZero,
ManageGoogleAccountItemType,
// SyncSectionIdentifier section.
SignInItemType,
RestartAuthenticationFlowErrorItemType,
......@@ -192,7 +193,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
[self configureIdentityAccountItem];
}
// Creates the identity sections.
// Creates the identity section.
- (void)createIdentitySection {
TableViewModel* model = self.consumer.tableViewModel;
[model insertSectionWithIdentifier:IdentitySectionIdentifier atIndex:0];
......@@ -207,6 +208,12 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
}
[model addItem:self.accountItem
toSectionWithIdentifier:IdentitySectionIdentifier];
TableViewImageItem* manageGoogleAccount =
[[TableViewImageItem alloc] initWithType:ManageGoogleAccountItemType];
manageGoogleAccount.title =
GetNSString(IDS_IOS_MANAGE_YOUR_GOOGLE_ACCOUNT_TITLE);
[model addItem:manageGoogleAccount
toSectionWithIdentifier:IdentitySectionIdentifier];
}
// Creates, removes or updates the identity section as needed. And notifies the
......@@ -484,6 +491,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
switchItem.on = self.anonymizedDataCollectionPreference.value;
break;
case IdentityItemType:
case ManageGoogleAccountItemType:
case SignInItemType:
case RestartAuthenticationFlowErrorItemType:
case ReauthDialogAsSyncIsInAuthErrorItemType:
......@@ -662,6 +670,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
}
break;
case IdentityItemType:
case ManageGoogleAccountItemType:
case SignInItemType:
case RestartAuthenticationFlowErrorItemType:
case ReauthDialogAsSyncIsInAuthErrorItemType:
......@@ -680,6 +689,9 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
case IdentityItemType:
[self.commandHandler openAccountSettings];
break;
case ManageGoogleAccountItemType:
[self.commandHandler openManageGoogleAccountWebPage];
break;
case SignInItemType:
[self.commandHandler showSignIn];
break;
......
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