Commit 10f386a1 authored by Side Yilmaz's avatar Side Yilmaz Committed by Commit Bot

Replace IdentityServicesProvider functions in feed classes.

This CL replaces deprecated functions of IdentityServicesProvider with
the newer service getters with profile parameter. Currently,
IdentityServicesProvider gives |Profile#getLastUsedRegularProfile| param
to the native. By this CL, feed classes pass
|Profile#getLastUsedRegularProfile| to the IdentityServicesProvider to
be used by native. Hence, this CL is only clean-up and does not change
code behaviour.

Bug: 1041781, 1075562
Change-Id: Ia4859f565da27638dd7b87e500a70cdabe51aa2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2253750
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarSky Malice <skym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780693}
parent 202501d8
...@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.ChromeTabbedActivity; ...@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.DeferredStartupHandler; import org.chromium.chrome.browser.DeferredStartupHandler;
import org.chromium.chrome.browser.feed.library.api.client.lifecycle.AppLifecycleListener; import org.chromium.chrome.browser.feed.library.api.client.lifecycle.AppLifecycleListener;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.signin.IdentityServicesProvider; import org.chromium.chrome.browser.signin.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.SigninManager; import org.chromium.chrome.browser.signin.SigninManager;
...@@ -95,7 +96,9 @@ public class FeedAppLifecycle ...@@ -95,7 +96,9 @@ public class FeedAppLifecycle
} }
ApplicationStatus.registerStateListenerForAllActivities(this); ApplicationStatus.registerStateListenerForAllActivities(this);
IdentityServicesProvider.get().getSigninManager().addSignInStateObserver(this); IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile())
.addSignInStateObserver(this);
} }
/** /**
...@@ -127,7 +130,9 @@ public class FeedAppLifecycle ...@@ -127,7 +130,9 @@ public class FeedAppLifecycle
* Unregisters listeners and cleans up any native resources held by FeedAppLifecycle. * Unregisters listeners and cleans up any native resources held by FeedAppLifecycle.
*/ */
public void destroy() { public void destroy() {
IdentityServicesProvider.get().getSigninManager().removeSignInStateObserver(this); IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile())
.removeSignInStateObserver(this);
ApplicationStatus.unregisterActivityStateListener(this); ApplicationStatus.unregisterActivityStateListener(this);
mLifecycleBridge.destroy(); mLifecycleBridge.destroy();
mLifecycleBridge = null; mLifecycleBridge = null;
......
...@@ -97,7 +97,8 @@ class FeedSurfaceMediator implements NewTabPageLayout.ScrollDelegate, ...@@ -97,7 +97,8 @@ class FeedSurfaceMediator implements NewTabPageLayout.ScrollDelegate,
@Nullable NativePageNavigationDelegate pageNavigationDelegate) { @Nullable NativePageNavigationDelegate pageNavigationDelegate) {
mCoordinator = coordinator; mCoordinator = coordinator;
mSnapScrollHelper = snapScrollHelper; mSnapScrollHelper = snapScrollHelper;
mSigninManager = IdentityServicesProvider.get().getSigninManager(); mSigninManager = IdentityServicesProvider.get().getSigninManager(
Profile.getLastUsedRegularProfile());
mPageNavigationDelegate = pageNavigationDelegate; mPageNavigationDelegate = pageNavigationDelegate;
mPrefChangeRegistrar = new PrefChangeRegistrar(); mPrefChangeRegistrar = new PrefChangeRegistrar();
......
...@@ -21,6 +21,7 @@ import org.chromium.base.annotations.NativeMethods; ...@@ -21,6 +21,7 @@ import org.chromium.base.annotations.NativeMethods;
import org.chromium.chrome.browser.AppHooks; import org.chromium.chrome.browser.AppHooks;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.native_page.NativePageNavigationDelegate; import org.chromium.chrome.browser.native_page.NativePageNavigationDelegate;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.signin.IdentityServicesProvider; import org.chromium.chrome.browser.signin.IdentityServicesProvider;
import org.chromium.chrome.browser.suggestions.SuggestionsConfig; import org.chromium.chrome.browser.suggestions.SuggestionsConfig;
import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.EmptyTabObserver;
...@@ -108,8 +109,9 @@ public class FeedStreamSurface implements SurfaceActionsHandler, FeedActionsHand ...@@ -108,8 +109,9 @@ public class FeedStreamSurface implements SurfaceActionsHandler, FeedActionsHand
@Override @Override
public String getAccountName() { public String getAccountName() {
CoreAccountInfo primaryAccount = CoreAccountInfo primaryAccount =
IdentityServicesProvider.get().getIdentityManager().getPrimaryAccountInfo( IdentityServicesProvider.get()
ConsentLevel.NOT_REQUIRED); .getIdentityManager(Profile.getLastUsedRegularProfile())
.getPrimaryAccountInfo(ConsentLevel.NOT_REQUIRED);
return primaryAccount == null ? "" : primaryAccount.getEmail(); return primaryAccount == null ? "" : primaryAccount.getEmail();
} }
......
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