Commit ffdc941c authored by Alice Wang's avatar Alice Wang Committed by Chromium LUCI CQ

[Signin][Android] Remove redundant boolean argument in ProfileDownloader

This CL removes the redundant boolean argument in ProfileDownloader.

Bug: 1151860
Change-Id: I1d8c366fb292f322ad51dddfef2ad2c3ef0a0457
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2620561Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842533}
parent e54c1e5b
...@@ -30,13 +30,11 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate { ...@@ -30,13 +30,11 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
AccountInfoRetriever(Profile* profile, AccountInfoRetriever(Profile* profile,
const CoreAccountId& account_id, const CoreAccountId& account_id,
const std::string& email, const std::string& email,
const int desired_image_side_pixels, const int desired_image_side_pixels)
bool is_pre_signin)
: profile_(profile), : profile_(profile),
account_id_(account_id), account_id_(account_id),
email_(email), email_(email),
desired_image_side_pixels_(desired_image_side_pixels), desired_image_side_pixels_(desired_image_side_pixels) {}
is_pre_signin_(is_pre_signin) {}
void Start() { void Start() {
profile_image_downloader_.reset(new ProfileDownloader(this)); profile_image_downloader_.reset(new ProfileDownloader(this));
...@@ -70,7 +68,7 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate { ...@@ -70,7 +68,7 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
std::string GetCachedPictureURL() const override { return std::string(); } std::string GetCachedPictureURL() const override { return std::string(); }
bool IsPreSignin() const override { return is_pre_signin_; } bool IsPreSignin() const override { return true; }
void OnProfileDownloadSuccess(ProfileDownloader* downloader) override { void OnProfileDownloadSuccess(ProfileDownloader* downloader) override {
base::string16 full_name = downloader->GetProfileFullName(); base::string16 full_name = downloader->GetProfileFullName();
...@@ -108,11 +106,6 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate { ...@@ -108,11 +106,6 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
// Desired side length of the profile image (in pixels). // Desired side length of the profile image (in pixels).
const int desired_image_side_pixels_; const int desired_image_side_pixels_;
// True when the profile download is happening before the user has signed in,
// such as during first run when we can still get tokens and want to fetch
// the profile name and picture to display.
bool is_pre_signin_;
DISALLOW_COPY_AND_ASSIGN(AccountInfoRetriever); DISALLOW_COPY_AND_ASSIGN(AccountInfoRetriever);
}; };
...@@ -123,8 +116,7 @@ void JNI_ProfileDownloader_StartFetchingAccountInfoFor( ...@@ -123,8 +116,7 @@ void JNI_ProfileDownloader_StartFetchingAccountInfoFor(
JNIEnv* env, JNIEnv* env,
const JavaParamRef<jobject>& jprofile, const JavaParamRef<jobject>& jprofile,
const JavaParamRef<jstring>& jemail, const JavaParamRef<jstring>& jemail,
jint image_side_pixels, jint image_side_pixels) {
jboolean is_pre_signin) {
Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
const std::string email = base::android::ConvertJavaStringToUTF8(env, jemail); const std::string email = base::android::ConvertJavaStringToUTF8(env, jemail);
...@@ -139,8 +131,7 @@ void JNI_ProfileDownloader_StartFetchingAccountInfoFor( ...@@ -139,8 +131,7 @@ void JNI_ProfileDownloader_StartFetchingAccountInfoFor(
return; return;
} }
AccountInfoRetriever* retriever = AccountInfoRetriever* retriever = new AccountInfoRetriever(
new AccountInfoRetriever(profile, maybe_account_info.value().account_id, profile, maybe_account_info.value().account_id, email, image_side_pixels);
email, image_side_pixels, is_pre_signin);
retriever->Start(); retriever->Start();
} }
...@@ -110,7 +110,7 @@ class ProfileDownloader { ...@@ -110,7 +110,7 @@ class ProfileDownloader {
// Pending requests here must be pre-signin request since SigninManager will wait // Pending requests here must be pre-signin request since SigninManager will wait
// system accounts been seeded into AccountTrackerService before finishing sign in. // system accounts been seeded into AccountTrackerService before finishing sign in.
ProfileDownloaderJni.get().startFetchingAccountInfoFor( ProfileDownloaderJni.get().startFetchingAccountInfoFor(
mProfiles.get(0), mAccountEmails.get(0), mImageSizes.get(0), true); mProfiles.get(0), mAccountEmails.get(0), mImageSizes.get(0));
mProfiles.remove(0); mProfiles.remove(0);
mAccountEmails.remove(0); mAccountEmails.remove(0);
mImageSizes.remove(0); mImageSizes.remove(0);
...@@ -140,8 +140,7 @@ class ProfileDownloader { ...@@ -140,8 +140,7 @@ class ProfileDownloader {
PendingProfileDownloads.get().pendProfileDownload(profile, accountEmail, imageSize); PendingProfileDownloads.get().pendProfileDownload(profile, accountEmail, imageSize);
return; return;
} }
ProfileDownloaderJni.get().startFetchingAccountInfoFor( ProfileDownloaderJni.get().startFetchingAccountInfoFor(profile, accountEmail, imageSize);
profile, accountEmail, imageSize, /* isPreSignin= */ true);
} }
@VisibleForTesting @VisibleForTesting
...@@ -155,7 +154,6 @@ class ProfileDownloader { ...@@ -155,7 +154,6 @@ class ProfileDownloader {
@NativeMethods @NativeMethods
interface Natives { interface Natives {
void startFetchingAccountInfoFor( void startFetchingAccountInfoFor(Profile profile, String accountEmail, int imageSize);
Profile profile, String accountEmail, int imageSize, boolean isPreSignin);
} }
} }
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.signin.services; package org.chromium.chrome.browser.signin.services;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
...@@ -82,10 +81,10 @@ public class ProfileDownloaderTest { ...@@ -82,10 +81,10 @@ public class ProfileDownloaderTest {
ProfileDownloader.PendingProfileDownloads.get(); ProfileDownloader.PendingProfileDownloads.get();
verify(mAccountTrackerServiceMock).addSystemAccountsSeededListener(pendingProfileDownloads); verify(mAccountTrackerServiceMock).addSystemAccountsSeededListener(pendingProfileDownloads);
verify(mProfileDownloaderNativeMock, never()) verify(mProfileDownloaderNativeMock, never())
.startFetchingAccountInfoFor(any(), anyString(), anyInt(), anyBoolean()); .startFetchingAccountInfoFor(any(), anyString(), anyInt());
pendingProfileDownloads.onSystemAccountsSeedingComplete(); pendingProfileDownloads.onSystemAccountsSeedingComplete();
verify(mProfileDownloaderNativeMock) verify(mProfileDownloaderNativeMock)
.startFetchingAccountInfoFor(mProfileMock, ACCOUNT_EMAIL, IMAGE_SIZE, true); .startFetchingAccountInfoFor(mProfileMock, ACCOUNT_EMAIL, IMAGE_SIZE);
} }
@Test @Test
...@@ -97,7 +96,7 @@ public class ProfileDownloaderTest { ...@@ -97,7 +96,7 @@ public class ProfileDownloaderTest {
verify(mAccountTrackerServiceMock, never()) verify(mAccountTrackerServiceMock, never())
.addSystemAccountsSeededListener(pendingProfileDownloads); .addSystemAccountsSeededListener(pendingProfileDownloads);
verify(mProfileDownloaderNativeMock) verify(mProfileDownloaderNativeMock)
.startFetchingAccountInfoFor(mProfileMock, ACCOUNT_EMAIL, IMAGE_SIZE, true); .startFetchingAccountInfoFor(mProfileMock, ACCOUNT_EMAIL, IMAGE_SIZE);
} }
@Test @Test
......
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