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

[iOS] Better little cleanup for UnifiedConsentMediator

This patch fixes a bug to update the selected identity when the identity
list is updated.

Related to:
crrev.com/c/1025895

Bug: 827072
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I772d3be25f6b280370c9d949487a7c2570fa6fc4
Reviewed-on: https://chromium-review.googlesource.com/1032741
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555363}
parent 0161f2d0
......@@ -56,10 +56,9 @@
return;
}
// nil is allowed only if there is no other identity.
DCHECK(selectedIdentity || ios::GetChromeBrowserProvider()
->GetChromeIdentityService()
->GetAllIdentitiesSortedForDisplay()
.count == 0);
DCHECK(selectedIdentity || !ios::GetChromeBrowserProvider()
->GetChromeIdentityService()
->HasIdentities());
_selectedIdentity = selectedIdentity;
self.selectedIdentityAvatar = nil;
[self updateViewController];
......@@ -119,10 +118,12 @@
#pragma mark - ChromeIdentityServiceObserver
- (void)identityListChanged {
NSArray* identities = ios::GetChromeBrowserProvider()
->GetChromeIdentityService()
->GetAllIdentitiesSortedForDisplay();
if (![identities containsObject:self.selectedIdentity]) {
if (!self.selectedIdentity || !ios::GetChromeBrowserProvider()
->GetChromeIdentityService()
->IsValidIdentity(self.selectedIdentity)) {
NSArray* identities = ios::GetChromeBrowserProvider()
->GetChromeIdentityService()
->GetAllIdentitiesSortedForDisplay();
ChromeIdentity* newIdentity = nil;
if (identities.count != 0) {
newIdentity = identities[0];
......
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