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 {
AccountInfoRetriever(Profile* profile,
const CoreAccountId& account_id,
const std::string& email,
const int desired_image_side_pixels,
bool is_pre_signin)
const int desired_image_side_pixels)
: profile_(profile),
account_id_(account_id),
email_(email),
desired_image_side_pixels_(desired_image_side_pixels),
is_pre_signin_(is_pre_signin) {}
desired_image_side_pixels_(desired_image_side_pixels) {}
void Start() {
profile_image_downloader_.reset(new ProfileDownloader(this));
......@@ -70,7 +68,7 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
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 {
base::string16 full_name = downloader->GetProfileFullName();
......@@ -108,11 +106,6 @@ class AccountInfoRetriever : public ProfileDownloaderDelegate {
// Desired side length of the profile image (in 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);
};
......@@ -123,8 +116,7 @@ void JNI_ProfileDownloader_StartFetchingAccountInfoFor(
JNIEnv* env,
const JavaParamRef<jobject>& jprofile,
const JavaParamRef<jstring>& jemail,
jint image_side_pixels,
jboolean is_pre_signin) {
jint image_side_pixels) {
Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile);
const std::string email = base::android::ConvertJavaStringToUTF8(env, jemail);
......@@ -139,8 +131,7 @@ void JNI_ProfileDownloader_StartFetchingAccountInfoFor(
return;
}
AccountInfoRetriever* retriever =
new AccountInfoRetriever(profile, maybe_account_info.value().account_id,
email, image_side_pixels, is_pre_signin);
AccountInfoRetriever* retriever = new AccountInfoRetriever(
profile, maybe_account_info.value().account_id, email, image_side_pixels);
retriever->Start();
}
......@@ -110,7 +110,7 @@ class ProfileDownloader {
// Pending requests here must be pre-signin request since SigninManager will wait
// system accounts been seeded into AccountTrackerService before finishing sign in.
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);
mAccountEmails.remove(0);
mImageSizes.remove(0);
......@@ -140,8 +140,7 @@ class ProfileDownloader {
PendingProfileDownloads.get().pendProfileDownload(profile, accountEmail, imageSize);
return;
}
ProfileDownloaderJni.get().startFetchingAccountInfoFor(
profile, accountEmail, imageSize, /* isPreSignin= */ true);
ProfileDownloaderJni.get().startFetchingAccountInfoFor(profile, accountEmail, imageSize);
}
@VisibleForTesting
......@@ -155,7 +154,6 @@ class ProfileDownloader {
@NativeMethods
interface Natives {
void startFetchingAccountInfoFor(
Profile profile, String accountEmail, int imageSize, boolean isPreSignin);
void startFetchingAccountInfoFor(Profile profile, String accountEmail, int imageSize);
}
}
......@@ -5,7 +5,6 @@
package org.chromium.chrome.browser.signin.services;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
......@@ -82,10 +81,10 @@ public class ProfileDownloaderTest {
ProfileDownloader.PendingProfileDownloads.get();
verify(mAccountTrackerServiceMock).addSystemAccountsSeededListener(pendingProfileDownloads);
verify(mProfileDownloaderNativeMock, never())
.startFetchingAccountInfoFor(any(), anyString(), anyInt(), anyBoolean());
.startFetchingAccountInfoFor(any(), anyString(), anyInt());
pendingProfileDownloads.onSystemAccountsSeedingComplete();
verify(mProfileDownloaderNativeMock)
.startFetchingAccountInfoFor(mProfileMock, ACCOUNT_EMAIL, IMAGE_SIZE, true);
.startFetchingAccountInfoFor(mProfileMock, ACCOUNT_EMAIL, IMAGE_SIZE);
}
@Test
......@@ -97,7 +96,7 @@ public class ProfileDownloaderTest {
verify(mAccountTrackerServiceMock, never())
.addSystemAccountsSeededListener(pendingProfileDownloads);
verify(mProfileDownloaderNativeMock)
.startFetchingAccountInfoFor(mProfileMock, ACCOUNT_EMAIL, IMAGE_SIZE, true);
.startFetchingAccountInfoFor(mProfileMock, ACCOUNT_EMAIL, IMAGE_SIZE);
}
@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