Commit b1b9909d authored by Ted Choc's avatar Ted Choc Committed by Commit Bot

Update Java ProfileManager onProfileAdded to be consistent with native.

BUG=

Change-Id: I6ef4f5f9652027844c57e76535577b16cd7b9bbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1955174
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#722547}
parent de6644e3
...@@ -1205,9 +1205,9 @@ public class DownloadManagerService implements DownloadController.DownloadNotifi ...@@ -1205,9 +1205,9 @@ public class DownloadManagerService implements DownloadController.DownloadNotifi
} }
@Override @Override
public void onProfileCreated(Profile profile) { public void onProfileAdded(Profile profile) {
ProfileManager.removeObserver(this); ProfileManager.removeObserver(this);
DownloadManagerServiceJni.get().onProfileCreated( DownloadManagerServiceJni.get().onProfileAdded(
mNativeDownloadManagerService, DownloadManagerService.this); mNativeDownloadManagerService, DownloadManagerService.this);
} }
...@@ -2054,7 +2054,7 @@ public class DownloadManagerService implements DownloadController.DownloadNotifi ...@@ -2054,7 +2054,7 @@ public class DownloadManagerService implements DownloadController.DownloadNotifi
interface Natives { interface Natives {
boolean isSupportedMimeType(String mimeType); boolean isSupportedMimeType(String mimeType);
int getAutoResumptionLimit(); int getAutoResumptionLimit();
long init(DownloadManagerService caller, boolean isProfileCreated); long init(DownloadManagerService caller, boolean isProfileAdded);
void openDownload(long nativeDownloadManagerService, DownloadManagerService caller, void openDownload(long nativeDownloadManagerService, DownloadManagerService caller,
String downloadGuid, boolean isOffTheRecord, int source); String downloadGuid, boolean isOffTheRecord, int source);
void resumeDownload(long nativeDownloadManagerService, DownloadManagerService caller, void resumeDownload(long nativeDownloadManagerService, DownloadManagerService caller,
...@@ -2076,7 +2076,7 @@ public class DownloadManagerService implements DownloadController.DownloadNotifi ...@@ -2076,7 +2076,7 @@ public class DownloadManagerService implements DownloadController.DownloadNotifi
DownloadManagerService caller, boolean isOffTheRecord); DownloadManagerService caller, boolean isOffTheRecord);
void updateLastAccessTime(long nativeDownloadManagerService, DownloadManagerService caller, void updateLastAccessTime(long nativeDownloadManagerService, DownloadManagerService caller,
String downloadGuid, boolean isOffTheRecord); String downloadGuid, boolean isOffTheRecord);
void onProfileCreated(long nativeDownloadManagerService, DownloadManagerService caller); void onProfileAdded(long nativeDownloadManagerService, DownloadManagerService caller);
void createInterruptedDownloadForTest(long nativeDownloadManagerService, void createInterruptedDownloadForTest(long nativeDownloadManagerService,
DownloadManagerService caller, String url, String guid, String targetPath); DownloadManagerService caller, String url, String guid, String targetPath);
void recordFirstBackgroundInterruptReason(long nativeDownloadManagerService, void recordFirstBackgroundInterruptReason(long nativeDownloadManagerService,
......
...@@ -121,8 +121,8 @@ public class StartupTabPreloader implements ProfileManager.Observer, Destroyable ...@@ -121,8 +121,8 @@ public class StartupTabPreloader implements ProfileManager.Observer, Destroyable
* {@link ChromeTabCreator}. * {@link ChromeTabCreator}.
*/ */
@Override @Override
public void onProfileCreated(Profile profile) { public void onProfileAdded(Profile profile) {
try (TraceEvent e = TraceEvent.scoped("StartupTabPreloader.onProfileCreated")) { try (TraceEvent e = TraceEvent.scoped("StartupTabPreloader.onProfileAdded")) {
// We only care about the first non-incognito profile that's created during startup. // We only care about the first non-incognito profile that's created during startup.
if (profile.isOffTheRecord()) return; if (profile.isOffTheRecord()) return;
......
...@@ -20,7 +20,7 @@ public class ProfileManager { ...@@ -20,7 +20,7 @@ public class ProfileManager {
* Called whenever a profile is created. * Called whenever a profile is created.
* @param profile The profile that has just been created. * @param profile The profile that has just been created.
*/ */
public void onProfileCreated(Profile profile); public void onProfileAdded(Profile profile);
} }
/** /**
...@@ -49,7 +49,7 @@ public class ProfileManager { ...@@ -49,7 +49,7 @@ public class ProfileManager {
// If a profile has been added, we know the ProfileManager has been initialized. // If a profile has been added, we know the ProfileManager has been initialized.
sInitialized = true; sInitialized = true;
for (Observer observer : sObservers) { for (Observer observer : sObservers) {
observer.onProfileCreated(profile); observer.onProfileAdded(profile);
} }
} }
} }
...@@ -189,10 +189,10 @@ DownloadManagerService::~DownloadManagerService() {} ...@@ -189,10 +189,10 @@ DownloadManagerService::~DownloadManagerService() {}
void DownloadManagerService::Init(JNIEnv* env, void DownloadManagerService::Init(JNIEnv* env,
jobject obj, jobject obj,
bool is_profile_created) { bool is_profile_added) {
java_ref_.Reset(env, obj); java_ref_.Reset(env, obj);
if (is_profile_created) { if (is_profile_added) {
OnProfileCreated(env, obj); OnProfileAdded(env, obj);
} else { } else {
// In reduced mode, only non-incognito downloads should be loaded. // In reduced mode, only non-incognito downloads should be loaded.
DownloadStartupUtils::EnsureDownloadSystemInitialized( DownloadStartupUtils::EnsureDownloadSystemInitialized(
...@@ -202,7 +202,7 @@ void DownloadManagerService::Init(JNIEnv* env, ...@@ -202,7 +202,7 @@ void DownloadManagerService::Init(JNIEnv* env,
} }
} }
void DownloadManagerService::OnProfileCreated(JNIEnv* env, jobject obj) { void DownloadManagerService::OnProfileAdded(JNIEnv* env, jobject obj) {
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
// Register coordinator for each available profile. // Register coordinator for each available profile.
......
...@@ -49,13 +49,14 @@ class DownloadManagerService ...@@ -49,13 +49,14 @@ class DownloadManagerService
DownloadManagerService(); DownloadManagerService();
~DownloadManagerService() override; ~DownloadManagerService() override;
// Called to Initialize this object. If |is_profile_created| is false, // Called to Initialize this object. If |is_profile_added| is false,
// it means only the service manager is launched. OnProfileCreated() will // it means only the service manager is launched. OnProfileAdded() will
// be called later when the profile is created. // be called later when the profile is added.
void Init(JNIEnv* env, jobject obj, bool is_profile_created); void Init(JNIEnv* env, jobject obj, bool is_profile_added);
// Called when the prfile is created. // Called when the profile is added to the ProfileManager and fully
void OnProfileCreated(JNIEnv* env, jobject obj); // initialized.
void OnProfileAdded(JNIEnv* env, jobject obj);
// Called to handle subsequent steps, after a download was determined as a OMA // Called to handle subsequent steps, after a download was determined as a OMA
// download type. // download type.
......
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