Commit 1a8bc86b authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Reflect sync errors on iOS if missing trusted vault keys

This patch is similar in spirit to the Android equivalent in
https://chromium-review.googlesource.com/c/chromium/src/+/1930796.

The overall idea is that, if encryption keys are missing, the UI needs
to display this state as an error, and the user should be able to go
through a reauth flow to retrieve the keys.

The actual logic to trigger the key retrieval process is deferred to
future patches and reflected in TODOs.

Bug: 1019685
Change-Id: Iad250aaca3519b7af50c0d8bfc038009a7d0f30d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1937368
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarJérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720906}
parent 36969363
...@@ -803,6 +803,9 @@ locale. The strings in this file are specific to iOS. ...@@ -803,6 +803,9 @@ locale. The strings in this file are specific to iOS.
<message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_SYNC_DISABLBED_BY_ADMINISTRATOR_TITLE" desc="Error displayed as title when the sync is disabled by the enterprise policy. The user doesn't have a regular gmail account."> <message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_SYNC_DISABLBED_BY_ADMINISTRATOR_TITLE" desc="Error displayed as title when the sync is disabled by the enterprise policy. The user doesn't have a regular gmail account.">
Sync Is Disabled by Your Administrator Sync Is Disabled by Your Administrator
</message> </message>
<message name="IDS_IOS_GOOGLE_SERVICES_SETTINGS_SYNC_ENCRYPTION_FIX_NOW" desc="Title button to ask the user to reauthenticate. Syncing of encrypted types (e.g. passwords) is blocked until the user completes the reauth flow.">
Fix now.
</message>
<message name="IDS_IOS_HISTORY_OTHER_FORMS_OF_HISTORY" desc="The notification at the top of the history page indicating that deleting Chrome browsing history will not delete other forms of history stored at Google My Activity."> <message name="IDS_IOS_HISTORY_OTHER_FORMS_OF_HISTORY" desc="The notification at the top of the history page indicating that deleting Chrome browsing history will not delete other forms of history stored at Google My Activity.">
Your Google Account may have other forms of browsing history at <ph name="BEGIN_LINK">BEGIN_LINK</ph>history.google.com<ph name="END_LINK">END_LINK</ph>. Your Google Account may have other forms of browsing history at <ph name="BEGIN_LINK">BEGIN_LINK</ph>history.google.com<ph name="END_LINK">END_LINK</ph>.
</message> </message>
...@@ -1716,6 +1719,9 @@ To change this setting, <ph name="BEGIN_LINK">BEGIN_LINK</ph>reset sync<ph name= ...@@ -1716,6 +1719,9 @@ To change this setting, <ph name="BEGIN_LINK">BEGIN_LINK</ph>reset sync<ph name=
<message name="IDS_IOS_SYNC_ENCRYPTION_PASSPHRASE_INFO" desc="The information text for encrypting sync using a passphrase, shown on the passphrase screen [iOS only]"> <message name="IDS_IOS_SYNC_ENCRYPTION_PASSPHRASE_INFO" desc="The information text for encrypting sync using a passphrase, shown on the passphrase screen [iOS only]">
Passphrase encryption doesn’t include payment methods and addresses from Google Pay. Only someone with your passphrase can read your encrypted data. The passphrase is not sent to or stored by Google. If you forget your passphrase or want to change this setting, you will need to reset sync. <ph name="BEGIN_LINK">BEGIN_LINK</ph>Learn more<ph name="END_LINK">END_LINK</ph> Passphrase encryption doesn’t include payment methods and addresses from Google Pay. Only someone with your passphrase can read your encrypted data. The passphrase is not sent to or stored by Google. If you forget your passphrase or want to change this setting, you will need to reset sync. <ph name="BEGIN_LINK">BEGIN_LINK</ph>Learn more<ph name="END_LINK">END_LINK</ph>
</message> </message>
<message name="IDS_IOS_SYNC_ENCRYPTION_FIX_NOW" desc="Title displayed when the signed in user needs to reauthenticate. Syncing of encrypted types (e.g. passwords) is blocked until the user completes the reauth flow.">
Fix Now
</message>
<message name="IDS_IOS_SYNC_ENCRYPTION_TITLE" desc="The title for the Sync Encryption item [iOS only]"> <message name="IDS_IOS_SYNC_ENCRYPTION_TITLE" desc="The title for the Sync Encryption item [iOS only]">
Encryption Encryption
</message> </message>
...@@ -1738,13 +1744,19 @@ Your data was encrypted with your sync passphrase on <ph name="TIME">$2<ex>Sept ...@@ -1738,13 +1744,19 @@ Your data was encrypted with your sync passphrase on <ph name="TIME">$2<ex>Sept
<message name="IDS_IOS_SYNC_ERROR_COULD_NOT_CONNECT" desc="The error message to display when the sync server is unavailable. [Length: 100em, can be multiple lines] [iOS only]"> <message name="IDS_IOS_SYNC_ERROR_COULD_NOT_CONNECT" desc="The error message to display when the sync server is unavailable. [Length: 100em, can be multiple lines] [iOS only]">
Could not connect to the server. Could not connect to the server.
</message> </message>
<message name="IDS_IOS_SYNC_ERROR_DESCRIPTION" desc="The error message to display when a generic error prevents sync from starting.">
Sync isn't working.
</message>
<message name="IDS_IOS_SYNC_PASSWORDS_ERROR_DESCRIPTION" desc="The error message to display when a generic error prevents encrypted sync datatypes (passwords) from working.">
Error syncing passwords.
</message>
<message name="IDS_IOS_SYNC_ERROR_INFO_OUT_OF_DATE" desc="The error message to display when the accounts info are out of date. [Length: 100em, can be multiple lines] [iOS only]"> <message name="IDS_IOS_SYNC_ERROR_INFO_OUT_OF_DATE" desc="The error message to display when the accounts info are out of date. [Length: 100em, can be multiple lines] [iOS only]">
Account sign-in details are out of date. Update to start sync. Account sign-in details are out of date. Update to start sync.
</message> </message>
<message name="IDS_IOS_SYNC_ERROR_INTERNET_DISCONNECTED" desc="Error to display when network connection failed while trying to use sync. [Length: 100em, can be multiple lines] [iOS only]"> <message name="IDS_IOS_SYNC_ERROR_INTERNET_DISCONNECTED" desc="Error to display when network connection failed while trying to use sync. [Length: 100em, can be multiple lines] [iOS only]">
Unable to connect to the Internet. Unable to connect to the Internet.
</message> </message>
<message name="IDS_IOS_SYNC_ERROR_TITLE" desc="Title of the error message shown for sync errors. [Length: 60em] [iOS only]"> <message name="IDS_IOS_SYNC_ERROR_TITLE" desc="Title of the error message shown for sync errors. [iOS only]">
Sync Isn't Working Sync Isn't Working
</message> </message>
<message name="IDS_IOS_SYNC_ERROR_UNRECOVERABLE" desc="The error message to display when there is an unrecoverable sync error. [Length: 100em, can be multiple lines] [iOS only]"> <message name="IDS_IOS_SYNC_ERROR_UNRECOVERABLE" desc="The error message to display when there is an unrecoverable sync error. [Length: 100em, can be multiple lines] [iOS only]">
...@@ -1768,6 +1780,9 @@ Your data was encrypted with your sync passphrase on <ph name="TIME">$2<ex>Sept ...@@ -1768,6 +1780,9 @@ Your data was encrypted with your sync passphrase on <ph name="TIME">$2<ex>Sept
<message name="IDS_IOS_SYNC_PASSPHRASE_RECOVER" desc="Message about how to recover from a lost passphrase. [Length:100em, may be multiple lines] [iOS only]"> <message name="IDS_IOS_SYNC_PASSPHRASE_RECOVER" desc="Message about how to recover from a lost passphrase. [Length:100em, may be multiple lines] [iOS only]">
If you forget your passphrase or want to change this setting, <ph name="BEGIN_LINK">BEGIN_LINK</ph>reset sync<ph name="END_LINK">END_LINK</ph> If you forget your passphrase or want to change this setting, <ph name="BEGIN_LINK">BEGIN_LINK</ph>reset sync<ph name="END_LINK">END_LINK</ph>
</message> </message>
<message name="IDS_IOS_SYNC_PASSWORDS_ERROR_TITLE" desc="Title of the error message shown for sync errors when it affects passwords only. [iOS only]">
Error Syncing Passwords
</message>
<message name="IDS_IOS_SYNC_SETTINGS_NOT_CONFIRMED" desc="The error message to display when sign-in was interrupted and the user didn't review the sync settings."> <message name="IDS_IOS_SYNC_SETTINGS_NOT_CONFIRMED" desc="The error message to display when sign-in was interrupted and the user didn't review the sync settings.">
Initial sync setup was not finished. Sync is off. Initial sync setup was not finished. Sync is off.
</message> </message>
......
48ae12ad30af6d2654cffd4b0d68db33e00ffefa
\ No newline at end of file
48ae12ad30af6d2654cffd4b0d68db33e00ffefa
\ No newline at end of file
c85314e60c88df143e720cb14ab9a6f0a2bf41c5
\ No newline at end of file
...@@ -88,6 +88,7 @@ bool SyncSetupService::UserActionIsRequiredToHaveTabSyncWork() { ...@@ -88,6 +88,7 @@ bool SyncSetupService::UserActionIsRequiredToHaveTabSyncWork() {
// These errors effectively amount to disabled sync and require a signin. // These errors effectively amount to disabled sync and require a signin.
case SyncSetupService::kSyncServiceSignInNeedsUpdate: case SyncSetupService::kSyncServiceSignInNeedsUpdate:
case SyncSetupService::kSyncServiceNeedsPassphrase: case SyncSetupService::kSyncServiceNeedsPassphrase:
case SyncSetupService::kSyncServiceNeedsTrustedVaultKey:
case SyncSetupService::kSyncServiceUnrecoverableError: case SyncSetupService::kSyncServiceUnrecoverableError:
case SyncSetupService::kSyncSettingsNotConfirmed: case SyncSetupService::kSyncSettingsNotConfirmed:
return true; return true;
...@@ -150,13 +151,22 @@ SyncSetupService::SyncServiceState SyncSetupService::GetSyncServiceState() { ...@@ -150,13 +151,22 @@ SyncSetupService::SyncServiceState SyncSetupService::GetSyncServiceState() {
if (sync_service_->HasUnrecoverableError()) if (sync_service_->HasUnrecoverableError())
return kSyncServiceUnrecoverableError; return kSyncServiceUnrecoverableError;
if (sync_service_->GetUserSettings() if (sync_service_->GetUserSettings()
->IsPassphraseRequiredForPreferredDataTypes()) ->IsPassphraseRequiredForPreferredDataTypes()) {
return kSyncServiceNeedsPassphrase; return kSyncServiceNeedsPassphrase;
}
if (!IsFirstSetupComplete() && IsSyncEnabled()) if (!IsFirstSetupComplete() && IsSyncEnabled())
return kSyncSettingsNotConfirmed; return kSyncSettingsNotConfirmed;
if (sync_service_->GetUserSettings()
->IsTrustedVaultKeyRequiredForPreferredDataTypes()) {
return kSyncServiceNeedsTrustedVaultKey;
}
return kNoSyncServiceError; return kNoSyncServiceError;
} }
bool SyncSetupService::IsEncryptEverythingEnabled() const {
return sync_service_->GetUserSettings()->IsEncryptEverythingEnabled();
}
bool SyncSetupService::HasFinishedInitialSetup() { bool SyncSetupService::HasFinishedInitialSetup() {
// Sync initial setup is considered to finished iff: // Sync initial setup is considered to finished iff:
// 1. User is signed in with sync enabled and the sync setup was completed. // 1. User is signed in with sync enabled and the sync setup was completed.
......
...@@ -28,6 +28,7 @@ class SyncSetupService : public KeyedService { ...@@ -28,6 +28,7 @@ class SyncSetupService : public KeyedService {
kSyncServiceCouldNotConnect, kSyncServiceCouldNotConnect,
kSyncServiceServiceUnavailable, kSyncServiceServiceUnavailable,
kSyncServiceNeedsPassphrase, kSyncServiceNeedsPassphrase,
kSyncServiceNeedsTrustedVaultKey,
kSyncServiceUnrecoverableError, kSyncServiceUnrecoverableError,
kSyncSettingsNotConfirmed, kSyncSettingsNotConfirmed,
kLastSyncServiceError = kSyncServiceUnrecoverableError kLastSyncServiceError = kSyncServiceUnrecoverableError
...@@ -85,6 +86,9 @@ class SyncSetupService : public KeyedService { ...@@ -85,6 +86,9 @@ class SyncSetupService : public KeyedService {
// Returns the current sync service state. // Returns the current sync service state.
virtual SyncServiceState GetSyncServiceState(); virtual SyncServiceState GetSyncServiceState();
// Returns whether all sync data is being encrypted.
virtual bool IsEncryptEverythingEnabled() const;
// Returns true if the user has gone through the initial sync configuration. // Returns true if the user has gone through the initial sync configuration.
// This method is guaranteed not to start the sync backend so it can be // This method is guaranteed not to start the sync backend so it can be
// called at start-up. // called at start-up.
......
...@@ -75,6 +75,7 @@ typedef NS_ENUM(NSInteger, ItemType) { ...@@ -75,6 +75,7 @@ typedef NS_ENUM(NSInteger, ItemType) {
RestartAuthenticationFlowErrorItemType, RestartAuthenticationFlowErrorItemType,
ReauthDialogAsSyncIsInAuthErrorItemType, ReauthDialogAsSyncIsInAuthErrorItemType,
ShowPassphraseDialogErrorItemType, ShowPassphraseDialogErrorItemType,
SyncNeedsTrustedVaultKeyErrorItemType,
SyncDisabledByAdministratorErrorItemType, SyncDisabledByAdministratorErrorItemType,
SyncSettingsNotCofirmedErrorItemType, SyncSettingsNotCofirmedErrorItemType,
SyncChromeDataItemType, SyncChromeDataItemType,
...@@ -378,6 +379,10 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -378,6 +379,10 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
type = ShowPassphraseDialogErrorItemType; type = ShowPassphraseDialogErrorItemType;
hasError = YES; hasError = YES;
break; break;
case SyncSetupService::kSyncServiceNeedsTrustedVaultKey:
type = SyncNeedsTrustedVaultKeyErrorItemType;
hasError = YES;
break;
case SyncSetupService::kSyncSettingsNotConfirmed: case SyncSetupService::kSyncSettingsNotConfirmed:
if (self.mode == GoogleServicesSettingsModeSettings) { if (self.mode == GoogleServicesSettingsModeSettings) {
type = SyncSettingsNotCofirmedErrorItemType; type = SyncSettingsNotCofirmedErrorItemType;
...@@ -527,6 +532,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -527,6 +532,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
case RestartAuthenticationFlowErrorItemType: case RestartAuthenticationFlowErrorItemType:
case ReauthDialogAsSyncIsInAuthErrorItemType: case ReauthDialogAsSyncIsInAuthErrorItemType:
case ShowPassphraseDialogErrorItemType: case ShowPassphraseDialogErrorItemType:
case SyncNeedsTrustedVaultKeyErrorItemType:
case SyncDisabledByAdministratorErrorItemType: case SyncDisabledByAdministratorErrorItemType:
case SyncSettingsNotCofirmedErrorItemType: case SyncSettingsNotCofirmedErrorItemType:
case SyncChromeDataItemType: case SyncChromeDataItemType:
...@@ -640,11 +646,13 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -640,11 +646,13 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
// + RestartAuthenticationFlowErrorItemType // + RestartAuthenticationFlowErrorItemType
// + ReauthDialogAsSyncIsInAuthErrorItemType // + ReauthDialogAsSyncIsInAuthErrorItemType
// + ShowPassphraseDialogErrorItemType // + ShowPassphraseDialogErrorItemType
// + SyncNeedsTrustedVaultKeyErrorItemType
// + SyncSettingsNotCofirmedErrorItemType // + SyncSettingsNotCofirmedErrorItemType
- (TableViewItem*)createSyncErrorItemWithItemType:(NSInteger)itemType { - (TableViewItem*)createSyncErrorItemWithItemType:(NSInteger)itemType {
DCHECK(itemType == RestartAuthenticationFlowErrorItemType || DCHECK(itemType == RestartAuthenticationFlowErrorItemType ||
itemType == ReauthDialogAsSyncIsInAuthErrorItemType || itemType == ReauthDialogAsSyncIsInAuthErrorItemType ||
itemType == ShowPassphraseDialogErrorItemType || itemType == ShowPassphraseDialogErrorItemType ||
itemType == SyncNeedsTrustedVaultKeyErrorItemType ||
itemType == SyncSettingsNotCofirmedErrorItemType); itemType == SyncSettingsNotCofirmedErrorItemType);
SettingsImageDetailTextItem* syncErrorItem = SettingsImageDetailTextItem* syncErrorItem =
[[SettingsImageDetailTextItem alloc] initWithType:itemType]; [[SettingsImageDetailTextItem alloc] initWithType:itemType];
...@@ -659,6 +667,17 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -659,6 +667,17 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
// error message should be still be displayed in the first settings screen. // error message should be still be displayed in the first settings screen.
syncErrorItem.detailText = GetNSString( syncErrorItem.detailText = GetNSString(
IDS_IOS_GOOGLE_SERVICES_SETTINGS_ENTER_PASSPHRASE_TO_START_SYNC); IDS_IOS_GOOGLE_SERVICES_SETTINGS_ENTER_PASSPHRASE_TO_START_SYNC);
} else if (itemType == SyncNeedsTrustedVaultKeyErrorItemType) {
// Special case only for the sync encryption key error message. The regular
// error message should be still be displayed in the first settings screen.
syncErrorItem.detailText =
GetNSString(IDS_IOS_GOOGLE_SERVICES_SETTINGS_SYNC_ENCRYPTION_FIX_NOW);
// Also override the title to be more accurate, if only passwords are being
// encrypted.
if (!self.syncSetupService->IsEncryptEverythingEnabled()) {
syncErrorItem.text = GetNSString(IDS_IOS_SYNC_PASSWORDS_ERROR_TITLE);
}
} }
syncErrorItem.image = [UIImage imageNamed:kGoogleServicesSyncErrorImage]; syncErrorItem.image = [UIImage imageNamed:kGoogleServicesSyncErrorImage];
return syncErrorItem; return syncErrorItem;
...@@ -777,6 +796,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -777,6 +796,7 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
case RestartAuthenticationFlowErrorItemType: case RestartAuthenticationFlowErrorItemType:
case ReauthDialogAsSyncIsInAuthErrorItemType: case ReauthDialogAsSyncIsInAuthErrorItemType:
case ShowPassphraseDialogErrorItemType: case ShowPassphraseDialogErrorItemType:
case SyncNeedsTrustedVaultKeyErrorItemType:
case SyncDisabledByAdministratorErrorItemType: case SyncDisabledByAdministratorErrorItemType:
case SyncSettingsNotCofirmedErrorItemType: case SyncSettingsNotCofirmedErrorItemType:
case ManageSyncItemType: case ManageSyncItemType:
...@@ -806,6 +826,9 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -806,6 +826,9 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
case ShowPassphraseDialogErrorItemType: case ShowPassphraseDialogErrorItemType:
[self.commandHandler openPassphraseDialog]; [self.commandHandler openPassphraseDialog];
break; break;
case SyncNeedsTrustedVaultKeyErrorItemType:
// TODO(crbug.com/1019685): Open key retrieval dialog.
break;
case ManageSyncItemType: case ManageSyncItemType:
[self.commandHandler openManageSyncSettings]; [self.commandHandler openManageSyncSettings];
break; break;
......
...@@ -285,6 +285,14 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -285,6 +285,14 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
[UIImage imageNamed:kGoogleServicesSyncErrorImage]; [UIImage imageNamed:kGoogleServicesSyncErrorImage];
self.encryptionItem.detailText = GetNSString( self.encryptionItem.detailText = GetNSString(
IDS_IOS_GOOGLE_SERVICES_SETTINGS_ENTER_PASSPHRASE_TO_START_SYNC); IDS_IOS_GOOGLE_SERVICES_SETTINGS_ENTER_PASSPHRASE_TO_START_SYNC);
} else if (self.shouldEncryptionItemBeEnabled &&
self.syncSetupService->GetSyncServiceState() ==
SyncSetupService::kSyncServiceNeedsTrustedVaultKey) {
needsUpdate = needsUpdate || self.encryptionItem.image == nil;
self.encryptionItem.image =
[UIImage imageNamed:kGoogleServicesSyncErrorImage];
self.encryptionItem.detailText =
GetNSString(IDS_IOS_GOOGLE_SERVICES_SETTINGS_SYNC_ENCRYPTION_FIX_NOW);
} else { } else {
needsUpdate = needsUpdate || self.encryptionItem.image != nil; needsUpdate = needsUpdate || self.encryptionItem.image != nil;
self.encryptionItem.image = nil; self.encryptionItem.image = nil;
...@@ -355,7 +363,8 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -355,7 +363,8 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
SyncSetupService::SyncServiceState state = SyncSetupService::SyncServiceState state =
self.syncSetupService->GetSyncServiceState(); self.syncSetupService->GetSyncServiceState();
return state != SyncSetupService::kNoSyncServiceError && return state != SyncSetupService::kNoSyncServiceError &&
state != SyncSetupService::kSyncServiceNeedsPassphrase; state != SyncSetupService::kSyncServiceNeedsPassphrase &&
state != SyncSetupService::kSyncServiceNeedsTrustedVaultKey;
} }
- (BOOL)shouldSyncDataItemEnabled { - (BOOL)shouldSyncDataItemEnabled {
...@@ -460,6 +469,11 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error"; ...@@ -460,6 +469,11 @@ NSString* kGoogleServicesSyncErrorImage = @"google_services_sync_error";
ItemType itemType = static_cast<ItemType>(item.type); ItemType itemType = static_cast<ItemType>(item.type);
switch (itemType) { switch (itemType) {
case EncryptionItemType: case EncryptionItemType:
if (self.syncSetupService->GetSyncServiceState() ==
SyncSetupService::kSyncServiceNeedsTrustedVaultKey) {
// TODO(crbug.com/1019685): Open key retrieval dialog.
break;
}
[self.commandHandler openPassphraseDialog]; [self.commandHandler openPassphraseDialog];
break; break;
case GoogleActivityControlsItemType: case GoogleActivityControlsItemType:
......
...@@ -32,6 +32,7 @@ enum ErrorState { ...@@ -32,6 +32,7 @@ enum ErrorState {
SYNC_NEEDS_PASSPHRASE, SYNC_NEEDS_PASSPHRASE,
SYNC_UNRECOVERABLE_ERROR, SYNC_UNRECOVERABLE_ERROR,
SYNC_SYNC_SETTINGS_NOT_CONFIRMED, SYNC_SYNC_SETTINGS_NOT_CONFIRMED,
SYNC_NEEDS_TRUSTED_VAULT_KEY,
SYNC_ERROR_COUNT SYNC_ERROR_COUNT
}; };
...@@ -49,6 +50,12 @@ NSString* GetSyncErrorDescriptionForSyncSetupService( ...@@ -49,6 +50,12 @@ NSString* GetSyncErrorDescriptionForSyncSetupService(
return l10n_util::GetNSString(IDS_IOS_SYNC_LOGIN_INFO_OUT_OF_DATE); return l10n_util::GetNSString(IDS_IOS_SYNC_LOGIN_INFO_OUT_OF_DATE);
case SyncSetupService::kSyncServiceNeedsPassphrase: case SyncSetupService::kSyncServiceNeedsPassphrase:
return l10n_util::GetNSString(IDS_IOS_SYNC_ENCRYPTION_DESCRIPTION); return l10n_util::GetNSString(IDS_IOS_SYNC_ENCRYPTION_DESCRIPTION);
case SyncSetupService::kSyncServiceNeedsTrustedVaultKey:
if (syncSetupService->IsEncryptEverythingEnabled())
return l10n_util::GetNSString(IDS_IOS_SYNC_ERROR_DESCRIPTION);
// The encryption error affects passwords only as per
// syncer::AlwaysEncryptedUserTypes().
return l10n_util::GetNSString(IDS_IOS_SYNC_PASSWORDS_ERROR_DESCRIPTION);
case SyncSetupService::kSyncSettingsNotConfirmed: case SyncSetupService::kSyncSettingsNotConfirmed:
return l10n_util::GetNSString( return l10n_util::GetNSString(
IDS_IOS_SYNC_SETTINGS_NOT_CONFIRMED_DESCRIPTION); IDS_IOS_SYNC_SETTINGS_NOT_CONFIRMED_DESCRIPTION);
...@@ -73,6 +80,8 @@ NSString* GetSyncErrorMessageForBrowserState( ...@@ -73,6 +80,8 @@ NSString* GetSyncErrorMessageForBrowserState(
return l10n_util::GetNSString(IDS_IOS_SYNC_ERROR_INFO_OUT_OF_DATE); return l10n_util::GetNSString(IDS_IOS_SYNC_ERROR_INFO_OUT_OF_DATE);
case SyncSetupService::kSyncServiceNeedsPassphrase: case SyncSetupService::kSyncServiceNeedsPassphrase:
return l10n_util::GetNSString(IDS_IOS_SYNC_CONFIGURE_ENCRYPTION); return l10n_util::GetNSString(IDS_IOS_SYNC_CONFIGURE_ENCRYPTION);
case SyncSetupService::kSyncServiceNeedsTrustedVaultKey:
return GetSyncErrorDescriptionForSyncSetupService(syncSetupService);
case SyncSetupService::kSyncServiceServiceUnavailable: case SyncSetupService::kSyncServiceServiceUnavailable:
return l10n_util::GetNSString(IDS_SYNC_SERVICE_UNAVAILABLE); return l10n_util::GetNSString(IDS_SYNC_SERVICE_UNAVAILABLE);
case SyncSetupService::kSyncServiceCouldNotConnect: case SyncSetupService::kSyncServiceCouldNotConnect:
...@@ -96,6 +105,8 @@ NSString* GetSyncErrorButtonTitleForBrowserState( ...@@ -96,6 +105,8 @@ NSString* GetSyncErrorButtonTitleForBrowserState(
return l10n_util::GetNSString(IDS_IOS_SYNC_UPDATE_CREDENTIALS); return l10n_util::GetNSString(IDS_IOS_SYNC_UPDATE_CREDENTIALS);
case SyncSetupService::kSyncServiceNeedsPassphrase: case SyncSetupService::kSyncServiceNeedsPassphrase:
return l10n_util::GetNSString(IDS_IOS_SYNC_ENTER_PASSPHRASE); return l10n_util::GetNSString(IDS_IOS_SYNC_ENTER_PASSPHRASE);
case SyncSetupService::kSyncServiceNeedsTrustedVaultKey:
return l10n_util::GetNSString(IDS_IOS_SYNC_ENCRYPTION_FIX_NOW);
case SyncSetupService::kSyncServiceUnrecoverableError: case SyncSetupService::kSyncServiceUnrecoverableError:
return l10n_util::GetNSString(IDS_IOS_SYNC_SIGN_IN_AGAIN); return l10n_util::GetNSString(IDS_IOS_SYNC_SIGN_IN_AGAIN);
case SyncSetupService::kSyncSettingsNotConfirmed: case SyncSetupService::kSyncSettingsNotConfirmed:
...@@ -134,6 +145,7 @@ bool ShouldShowSyncSettings(SyncSetupService::SyncServiceState syncState) { ...@@ -134,6 +145,7 @@ bool ShouldShowSyncSettings(SyncSetupService::SyncServiceState syncState) {
return true; return true;
case SyncSetupService::kSyncServiceSignInNeedsUpdate: case SyncSetupService::kSyncServiceSignInNeedsUpdate:
case SyncSetupService::kSyncServiceNeedsPassphrase: case SyncSetupService::kSyncServiceNeedsPassphrase:
case SyncSetupService::kSyncServiceNeedsTrustedVaultKey:
return false; return false;
} }
} }
...@@ -176,6 +188,9 @@ bool DisplaySyncErrors(ios::ChromeBrowserState* browser_state, ...@@ -176,6 +188,9 @@ bool DisplaySyncErrors(ios::ChromeBrowserState* browser_state,
case SyncSetupService::kSyncServiceNeedsPassphrase: case SyncSetupService::kSyncServiceNeedsPassphrase:
loggedErrorState = SYNC_NEEDS_PASSPHRASE; loggedErrorState = SYNC_NEEDS_PASSPHRASE;
break; break;
case SyncSetupService::kSyncServiceNeedsTrustedVaultKey:
loggedErrorState = SYNC_NEEDS_TRUSTED_VAULT_KEY;
break;
case SyncSetupService::kSyncServiceUnrecoverableError: case SyncSetupService::kSyncServiceUnrecoverableError:
loggedErrorState = SYNC_UNRECOVERABLE_ERROR; loggedErrorState = SYNC_UNRECOVERABLE_ERROR;
break; break;
...@@ -202,6 +217,7 @@ bool IsTransientSyncError(SyncSetupService::SyncServiceState errorState) { ...@@ -202,6 +217,7 @@ bool IsTransientSyncError(SyncSetupService::SyncServiceState errorState) {
return true; return true;
case SyncSetupService::kSyncServiceSignInNeedsUpdate: case SyncSetupService::kSyncServiceSignInNeedsUpdate:
case SyncSetupService::kSyncServiceNeedsPassphrase: case SyncSetupService::kSyncServiceNeedsPassphrase:
case SyncSetupService::kSyncServiceNeedsTrustedVaultKey:
case SyncSetupService::kSyncServiceUnrecoverableError: case SyncSetupService::kSyncServiceUnrecoverableError:
case SyncSetupService::kSyncSettingsNotConfirmed: case SyncSetupService::kSyncSettingsNotConfirmed:
return false; return false;
......
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