Commit 1437ee1d authored by Tanmoy Mollik's avatar Tanmoy Mollik Committed by Chromium LUCI CQ

[Android] Remove onPrimaryAccountSet/Changed() from Java

This cl removes onPrimaryAccountSet/Changed methods from the java
IdentityManger. All of the usages of these methods has been replaced by
onPrimaryAccountChanged on the java side.

Bug: 1158855
Change-Id: I4e0deeaa0e127f65e4e43c429dec26963111f736
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2608148Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Tanmoy Mollik <triploblastic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841050}
parent 807acce3
...@@ -35,19 +35,6 @@ public class IdentityManager { ...@@ -35,19 +35,6 @@ public class IdentityManager {
*/ */
default void onPrimaryAccountChanged(PrimaryAccountChangeEvent eventDetails) {} default void onPrimaryAccountChanged(PrimaryAccountChangeEvent eventDetails) {}
/**
* Called when an account becomes the user's primary account.
* This method is not called during a reauth.
*/
default void onPrimaryAccountSet(CoreAccountInfo account) {}
/**
* Called when the user moves from having a primary account to no longer having a primary
* account (note that the user may still have an *unconsented* primary account after this
* event).
*/
default void onPrimaryAccountCleared(CoreAccountInfo account) {}
/** /**
* Called when the Gaia cookie has been deleted explicitly by a user action, e.g. from * Called when the Gaia cookie has been deleted explicitly by a user action, e.g. from
* the settings. * the settings.
...@@ -121,27 +108,6 @@ public class IdentityManager { ...@@ -121,27 +108,6 @@ public class IdentityManager {
} }
} }
/**
* Notifies observers that the primary account was set in C++.
*/
@CalledByNative
private void onPrimaryAccountSet(CoreAccountInfo account) {
for (Observer observer : mObservers) {
observer.onPrimaryAccountSet(account);
}
}
/**
* Notifies observers that the primary account was cleared in C++.
*/
@CalledByNative
@VisibleForTesting
public void onPrimaryAccountCleared(CoreAccountInfo account) {
for (Observer observer : mObservers) {
observer.onPrimaryAccountCleared(account);
}
}
@CalledByNative @CalledByNative
@VisibleForTesting @VisibleForTesting
public void onAccountsCookieDeletedByUserAction() { public void onAccountsCookieDeletedByUserAction() {
......
...@@ -509,38 +509,6 @@ void IdentityManager::OnPrimaryAccountChanged( ...@@ -509,38 +509,6 @@ void IdentityManager::OnPrimaryAccountChanged(
Java_IdentityManager_onPrimaryAccountChanged( Java_IdentityManager_onPrimaryAccountChanged(
env, java_identity_manager_, env, java_identity_manager_,
ConvertToJavaPrimaryAccountChangeEvent(env, event_details)); ConvertToJavaPrimaryAccountChangeEvent(env, event_details));
switch (event_details.GetEventTypeFor(ConsentLevel::kSync)) {
case PrimaryAccountChangeEvent::Type::kSet:
Java_IdentityManager_onPrimaryAccountSet(
env, java_identity_manager_,
ConvertToJavaCoreAccountInfo(
env, event_details.GetCurrentState().primary_account));
return;
case PrimaryAccountChangeEvent::Type::kCleared:
Java_IdentityManager_onPrimaryAccountCleared(
env, java_identity_manager_,
ConvertToJavaCoreAccountInfo(
env, event_details.GetPreviousState().primary_account));
return;
case PrimaryAccountChangeEvent::Type::kNone:
break;
}
switch (event_details.GetEventTypeFor(ConsentLevel::kNotRequired)) {
// TODO(http://crbug.com/1158855): This is a hack as the Java code expects
// a call to onPrimaryAccountCleared() when the unconsented primary account
// is cleared. This does not match the intent of OnPrimaryAccountCleared
// which is supposed to be fired only when sync account is being cleared.
// This hack *must* be removed quickly as it has a high misusage risk.
case PrimaryAccountChangeEvent::Type::kCleared:
Java_IdentityManager_onPrimaryAccountCleared(
env, java_identity_manager_,
ConvertToJavaCoreAccountInfo(
env, event_details.GetPreviousState().primary_account));
break;
case PrimaryAccountChangeEvent::Type::kSet:
case PrimaryAccountChangeEvent::Type::kNone:
break;
}
#endif #endif
} }
......
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