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

[iOS] Accept nil callback in ChromeIdentityService::GetAvatarForIdentity()

Adding comments for ChromeIdentityService to accept nil as |callback| for
ChromeIdentityService::GetAvatarForIdentity().
And Adding support for nil callback in FakeChromeIdentityService.

Related to: crrev.com/i/1296954

Change-Id: I0d96d8a3abcd934705ec7743d7711b760ea1b459
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1609842
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659480}
parent 786fad53
......@@ -167,7 +167,7 @@ class ChromeIdentityService {
// Fetches the profile avatar, from the cache or the network.
// For high resolution iPads, returns large images (200 x 200) to avoid
// pixelization. Calls back on the main thread.
// pixelization. Calls back on the main thread. |callback| may be nil.
virtual void GetAvatarForIdentity(ChromeIdentity* identity,
GetAvatarCallback callback);
......
......@@ -29,15 +29,6 @@ UIImage* FakeGetCachedAvatarForIdentity(ChromeIdentity*) {
return provider ? provider->GetDefaultAvatar() : nil;
}
void FakeGetAvatarForIdentity(ChromeIdentity* identity,
ios::GetAvatarCallback callback) {
// |GetAvatarForIdentity| is normally an asynchronous operation, this is
// replicated here by dispatching it.
dispatch_async(dispatch_get_main_queue(), ^{
callback(FakeGetCachedAvatarForIdentity(identity));
});
}
void FakeGetHostedDomainForIdentity(ChromeIdentity* identity,
ios::GetHostedDomainCallback callback) {
NSString* domain = base::SysUTF8ToNSString(gaia::ExtractDomainName(
......@@ -230,7 +221,14 @@ UIImage* FakeChromeIdentityService::GetCachedAvatarForIdentity(
void FakeChromeIdentityService::GetAvatarForIdentity(
ChromeIdentity* identity,
GetAvatarCallback callback) {
FakeGetAvatarForIdentity(identity, callback);
if (!callback) {
return;
}
// |GetAvatarForIdentity| is normally an asynchronous operation, this is
// replicated here by dispatching it.
dispatch_async(dispatch_get_main_queue(), ^{
callback(FakeGetCachedAvatarForIdentity(identity));
});
}
void FakeChromeIdentityService::GetHostedDomainForIdentity(
......
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