0

Migrate getLastUsedRegularProfile from Profile -> ProfileManager.

Deprecated profile methods will be removed in a subsequent CL
to avoid late breaking conflicts.

Bug: 40254448
Change-Id: I6dddb9f9b78abe58a4f8c3f65b6dd7c1b7489595
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5304420
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Theresa Sullivan <twellington@chromium.org>
Commit-Queue: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1262058}
This commit is contained in:
Ted Choc
2024-02-17 05:37:03 +00:00
committed by Chromium LUCI CQ
parent 6929fef6bb
commit f486e3fc74
299 changed files with 935 additions and 714 deletions
PRESUBMIT.pyPRESUBMIT_test.py
chrome
android
features
keyboard_accessory
internal
java
src
org
chromium
chrome
browser
keyboard_accessory
start_surface
tab_ui
java
src
org
chromium
chrome
browser
tasks
javatests
src
org
chromium
feed
core
java
src
org
chromium
javatests
src
org
chromium
chrome
browser
java
src
org
chromium
chrome
browser
BackupSigninProcessor.javaChromeActivitySessionTracker.javaChromeBackupAgentImpl.javaChromeBackupWatcher.javaIntentHandler.javaSynchronousInitializationActivity.javaWarmupManager.java
app
background_task_scheduler
bookmarkswidget
browsing_data
compositor
customtabs
dependency_injection
dom_distiller
download
feature_guide
homepage
incognito
init
notifications
ntp
offlinepages
rlz
segmentation_platform
settings
sharing
signin
site_settings
suggestions
sync
tasks
ui
usage_stats
javatests
src
org
chromium
chrome
browser
ImageFetcherIntegrationTest.javaPwaRestoreBottomSheetTestUtils.javaShareIntentTest.javaVirtualKeyboardResizeTest.javaWarmupManagerTest.java
accessibility
app
autofill
background_sync
bookmarks
browsing_data
compositor
content_settings
contextualsearch
customtabs
device_dialog
dom_distiller
download
feedback
firstrun
gesturenav
history
incognito
infobar
input
locale
notifications
ntp
offlinepages
omnibox
page_info
password_manager
permissions
privacy
profiles
search_engines
settings
share
signin
site_settings
suggestions
sync
tab
tabmodel
toolbar
junit
browser
android
browserservices
verification
httpclient
java
src
org
chromium
chrome
browser
android
metrics
javatests
src
org
chromium
chrome
browser
autofill
android
java
src
org
chromium
chrome
javatest
src
org
chromium
chrome
browser
banners
android
java
src
org
chromium
chrome
commerce
android
java
src
org
chromium
chrome
browser
merchant_viewer
android
price_tracking
android
java
src
javatests
subscriptions
test
android
java
src
org
chromium
data_sharing
android
java
src
org
chromium
chrome
download
internal
android
java
src
org
chromium
chrome
engagement
android
java
src
org
chromium
chrome
feed
gsa
java
src
org
chromium
chrome
browser
image_descriptions
android
java
src
org
chromium
chrome
browser
incognito
android
java
src
org
chromium
javatests
src
org
chromium
chrome
locale
java
src
org
chromium
chrome
magic_stack
android
junit
src
org
chromium
chrome
optimization_guide
password_check
android
internal
java
src
org
chromium
chrome
browser
password_manager
android
java
src
org
chromium
chrome
browser
junit
src
pwd_check_wrapper
java
src
org
chromium
chrome
privacy_guide
android
javatests
src
org
chromium
chrome
browser
privacy_sandbox
profiles
android
java
src
org
chromium
chrome
quick_delete
recent_tabs
internal
android
java
src
safe_browsing
android
javatests
src
org
chromium
chrome
safety_check
android
javatests
src
org
chromium
chrome
browser
search_engines
android
java
segmentation_platform
android
javatests
src
org
chromium
chrome
share
android
sync
test
android
java
src
org
chromium
chrome
tab
touch_to_fill
password_manager
android
internal
java
src
org
chromium
chrome
browser
ui
android
hats
internal
java
src
org
chromium
chrome
logo
java
src
org
night_mode
java
src
org
chromium
omnibox
java
page_insights
searchactivityutils
java
signin
java
src
org
chromium
toolbar
webid
internal
java
src
org
chromium
chrome
user_education
java
src
org
chromium
chrome
browser
test
android
javatests

@ -260,7 +260,7 @@ _BANNED_JAVA_FUNCTIONS : Sequence[BanRule] = (
), ),
), ),
BanRule( BanRule(
'Profile.getLastUsedRegularProfile()', 'ProfileManager.getLastUsedRegularProfile()',
( (
'Prefer passing in the Profile reference instead of relying on the ' 'Prefer passing in the Profile reference instead of relying on the '
'static getLastUsedRegularProfile() call. Only top level entry points ' 'static getLastUsedRegularProfile() call. Only top level entry points '

@ -2800,7 +2800,7 @@ class BannedTypeCheckTest(unittest.TestCase):
MockFile('some/java/problematic/requestlayout.java', MockFile('some/java/problematic/requestlayout.java',
['requestLayout();']), ['requestLayout();']),
MockFile('some/java/problematic/lastprofile.java', MockFile('some/java/problematic/lastprofile.java',
['Profile.getLastUsedRegularProfile();']), ['ProfileManager.getLastUsedRegularProfile();']),
MockFile('some/java/problematic/getdrawable1.java', MockFile('some/java/problematic/getdrawable1.java',
['ResourcesCompat.getDrawable();']), ['ResourcesCompat.getDrawable();']),
MockFile('some/java/problematic/getdrawable2.java', MockFile('some/java/problematic/getdrawable2.java',

@ -12,7 +12,7 @@ import androidx.annotation.StringRes;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.keyboard_accessory.R; import org.chromium.chrome.browser.keyboard_accessory.R;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.util.ChromeAccessibilityUtil; import org.chromium.chrome.browser.util.ChromeAccessibilityUtil;
import org.chromium.components.browser_ui.widget.textbubble.TextBubble; import org.chromium.components.browser_ui.widget.textbubble.TextBubble;
import org.chromium.components.feature_engagement.EventConstants; import org.chromium.components.feature_engagement.EventConstants;
@ -189,7 +189,7 @@ class KeyboardAccessoryIPHUtils {
// incognito profile) instead of always using regular profile. It works correctly now, // incognito profile) instead of always using regular profile. It works correctly now,
// but it is not safe. // but it is not safe.
final Tracker tracker = final Tracker tracker =
TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile()); TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
if (!tracker.isInitialized()) return null; if (!tracker.isInitialized()) return null;
return tracker; return tracker;
} }

@ -12,7 +12,7 @@ import androidx.annotation.VisibleForTesting;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.chrome.browser.keyboard_accessory.R; import org.chromium.chrome.browser.keyboard_accessory.R;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.ui.favicon.FaviconUtils; import org.chromium.chrome.browser.ui.favicon.FaviconUtils;
import org.chromium.components.browser_ui.widget.RoundedIconGenerator; import org.chromium.components.browser_ui.widget.RoundedIconGenerator;
import org.chromium.components.favicon.LargeIconBridge; import org.chromium.components.favicon.LargeIconBridge;
@ -74,7 +74,7 @@ public class FaviconHelper {
*/ */
public void fetchFavicon(String origin, Callback<Drawable> setIconCallback) { public void fetchFavicon(String origin, Callback<Drawable> setIconCallback) {
final LargeIconBridge mIconBridge = final LargeIconBridge mIconBridge =
new LargeIconBridge(Profile.getLastUsedRegularProfile()); new LargeIconBridge(ProfileManager.getLastUsedRegularProfile());
final GURL gurlOrigin = new GURL(origin); final GURL gurlOrigin = new GURL(origin);
if (!gurlOrigin.isValid()) return; if (!gurlOrigin.isValid()) return;
mIconBridge.getLargeIconForUrl( mIconBridge.getLargeIconForUrl(

@ -17,6 +17,7 @@ import org.chromium.chrome.browser.feed.FeedSwipeRefreshLayout;
import org.chromium.chrome.browser.feed.ScrollableContainerDelegate; import org.chromium.chrome.browser.feed.ScrollableContainerDelegate;
import org.chromium.chrome.browser.ntp.NewTabPageLaunchOrigin; import org.chromium.chrome.browser.ntp.NewTabPageLaunchOrigin;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
@ -107,7 +108,7 @@ class ExploreSurfaceCoordinatorFactory {
boolean isInNightMode, boolean isInNightMode,
boolean isPlaceholderShown, boolean isPlaceholderShown,
@NewTabPageLaunchOrigin int launchOrigin) { @NewTabPageLaunchOrigin int launchOrigin) {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
return new ExploreSurfaceCoordinator( return new ExploreSurfaceCoordinator(
profile, profile,

@ -11,7 +11,7 @@ import androidx.annotation.Nullable;
import org.chromium.chrome.browser.feed.FeedSurfaceCoordinator; import org.chromium.chrome.browser.feed.FeedSurfaceCoordinator;
import org.chromium.chrome.browser.feed.FeedSurfaceLifecycleManager; import org.chromium.chrome.browser.feed.FeedSurfaceLifecycleManager;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.user_prefs.UserPrefs; import org.chromium.components.user_prefs.UserPrefs;
/** Explore surface feed lifecycle manager. */ /** Explore surface feed lifecycle manager. */
@ -32,7 +32,7 @@ class ExploreSurfaceFeedLifecycleManager extends FeedSurfaceLifecycleManager {
} }
private boolean shouldShowFeed() { private boolean shouldShowFeed() {
return UserPrefs.get(Profile.getLastUsedRegularProfile()) return UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.getBoolean(Pref.ARTICLES_LIST_VISIBLE); .getBoolean(Pref.ARTICLES_LIST_VISIBLE);
} }

@ -54,6 +54,7 @@ import org.chromium.chrome.browser.omnibox.OmniboxFeatures;
import org.chromium.chrome.browser.omnibox.OmniboxStub; import org.chromium.chrome.browser.omnibox.OmniboxStub;
import org.chromium.chrome.browser.omnibox.styles.OmniboxResourceProvider; import org.chromium.chrome.browser.omnibox.styles.OmniboxResourceProvider;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.share.ShareDelegate; import org.chromium.chrome.browser.share.ShareDelegate;
import org.chromium.chrome.browser.suggestions.tile.MostVisitedTilesCoordinator; import org.chromium.chrome.browser.suggestions.tile.MostVisitedTilesCoordinator;
import org.chromium.chrome.browser.suggestions.tile.TileGroupDelegateImpl; import org.chromium.chrome.browser.suggestions.tile.TileGroupDelegateImpl;
@ -572,7 +573,7 @@ public class StartSurfaceCoordinator implements StartSurface {
mStartSurfaceMediator.initWithNative( mStartSurfaceMediator.initWithNative(
mIsStartSurfaceEnabled ? mOmniboxStubSupplier.get() : null, mIsStartSurfaceEnabled ? mOmniboxStubSupplier.get() : null,
mExploreSurfaceCoordinatorFactory, mExploreSurfaceCoordinatorFactory,
UserPrefs.get(Profile.getLastUsedRegularProfile()), UserPrefs.get(ProfileManager.getLastUsedRegularProfile()),
mSnackbarManager); mSnackbarManager);
if (mGridTabSwitcher != null) { if (mGridTabSwitcher != null) {
@ -1340,7 +1341,7 @@ public class StartSurfaceCoordinator implements StartSurface {
return; return;
} }
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
MostVisitedTileNavigationDelegate navigationDelegate = MostVisitedTileNavigationDelegate navigationDelegate =
new MostVisitedTileNavigationDelegate(mActivity, profile, mParentTabSupplier); new MostVisitedTileNavigationDelegate(mActivity, profile, mParentTabSupplier);
mSuggestionsUiDelegate = mSuggestionsUiDelegate =

@ -11,6 +11,7 @@ import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
import org.chromium.chrome.browser.offlinepages.RequestCoordinatorBridge; import org.chromium.chrome.browser.offlinepages.RequestCoordinatorBridge;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate; import org.chromium.chrome.browser.suggestions.SuggestionsNavigationDelegate;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.document.ChromeAsyncTabLauncher; import org.chromium.chrome.browser.tabmodel.document.ChromeAsyncTabLauncher;
@ -86,7 +87,7 @@ public class MostVisitedTileNavigationDelegate extends SuggestionsNavigationDele
private void saveUrlForOffline(String url) { private void saveUrlForOffline(String url) {
// TODO(crbug.com/1193816): Namespace shouldn't be NTP_SUGGESTIONS_NAMESPACE since it's // TODO(crbug.com/1193816): Namespace shouldn't be NTP_SUGGESTIONS_NAMESPACE since it's
// not on NTP. // not on NTP.
RequestCoordinatorBridge.getForProfile(Profile.getLastUsedRegularProfile()) RequestCoordinatorBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
.savePageLater( .savePageLater(
url, url,
OfflinePageBridge.NTP_SUGGESTIONS_NAMESPACE, OfflinePageBridge.NTP_SUGGESTIONS_NAMESPACE,

@ -31,6 +31,7 @@ import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcher;
import org.chromium.chrome.browser.ntp.IncognitoCookieControlsManager; import org.chromium.chrome.browser.ntp.IncognitoCookieControlsManager;
import org.chromium.chrome.browser.omnibox.OmniboxStub; import org.chromium.chrome.browser.omnibox.OmniboxStub;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.suggestions.tile.MostVisitedTilesCoordinator; import org.chromium.chrome.browser.suggestions.tile.MostVisitedTilesCoordinator;
import org.chromium.chrome.browser.suggestions.tile.TileGroupDelegateImpl; import org.chromium.chrome.browser.suggestions.tile.TileGroupDelegateImpl;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
@ -179,7 +180,7 @@ public class TasksSurfaceCoordinator implements TasksSurface {
View.OnClickListener incognitoLearnMoreClickListener = View.OnClickListener incognitoLearnMoreClickListener =
v -> { v -> {
Profile profile = Profile profile =
Profile.getLastUsedRegularProfile() ProfileManager.getLastUsedRegularProfile()
.getPrimaryOTRProfile(/* createIfNeeded= */ true); .getPrimaryOTRProfile(/* createIfNeeded= */ true);
HelpAndFeedbackLauncherImpl.getForProfile(profile) HelpAndFeedbackLauncherImpl.getForProfile(profile)
.show( .show(
@ -228,7 +229,7 @@ public class TasksSurfaceCoordinator implements TasksSurface {
return; return;
} }
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
MostVisitedTileNavigationDelegate navigationDelegate = MostVisitedTileNavigationDelegate navigationDelegate =
new MostVisitedTileNavigationDelegate(mActivity, profile, mParentTabSupplier); new MostVisitedTileNavigationDelegate(mActivity, profile, mParentTabSupplier);
mSuggestionsUiDelegate = mSuggestionsUiDelegate =

@ -34,6 +34,7 @@ import org.chromium.chrome.browser.ntp.IncognitoDescriptionView;
import org.chromium.chrome.browser.ntp.search.SearchBoxCoordinator; import org.chromium.chrome.browser.ntp.search.SearchBoxCoordinator;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.features.start_surface.StartSurfaceConfiguration; import org.chromium.chrome.features.start_surface.StartSurfaceConfiguration;
import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.components.browser_ui.styles.ChromeColors;
import org.chromium.components.browser_ui.widget.CoordinatorLayoutForPointer; import org.chromium.components.browser_ui.widget.CoordinatorLayoutForPointer;
@ -471,7 +472,7 @@ public class TasksView extends CoordinatorLayoutForPointer {
boolean shouldShowTrackingProtectionNtp() { boolean shouldShowTrackingProtectionNtp() {
Profile profile = Profile profile =
Profile.getLastUsedRegularProfile() ProfileManager.getLastUsedRegularProfile()
.getPrimaryOTRProfile(/* createIfNeeded= */ true); .getPrimaryOTRProfile(/* createIfNeeded= */ true);
return (UserPrefs.get(profile).getBoolean(Pref.TRACKING_PROTECTION3PCD_ENABLED) return (UserPrefs.get(profile).getBoolean(Pref.TRACKING_PROTECTION3PCD_ENABLED)
|| ChromeFeatureList.isEnabled(ChromeFeatureList.TRACKING_PROTECTION_3PCD)); || ChromeFeatureList.isEnabled(ChromeFeatureList.TRACKING_PROTECTION_3PCD));

@ -48,7 +48,7 @@ import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tasks.ReturnToChromeUtil; import org.chromium.chrome.browser.tasks.ReturnToChromeUtil;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
@ -147,7 +147,7 @@ public class InstantStartFeedTest {
// FEED_ARTICLES_LIST_VISIBLE should equal to ARTICLES_LIST_VISIBLE. // FEED_ARTICLES_LIST_VISIBLE should equal to ARTICLES_LIST_VISIBLE.
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> () ->
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.getBoolean(Pref.ARTICLES_LIST_VISIBLE) .getBoolean(Pref.ARTICLES_LIST_VISIBLE)
== ReturnToChromeUtil.getFeedArticlesVisibility()); == ReturnToChromeUtil.getFeedArticlesVisibility());
@ -158,7 +158,7 @@ public class InstantStartFeedTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> () ->
Assert.assertEquals( Assert.assertEquals(
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.getBoolean(Pref.ARTICLES_LIST_VISIBLE), .getBoolean(Pref.ARTICLES_LIST_VISIBLE),
ReturnToChromeUtil.getFeedArticlesVisibility())); ReturnToChromeUtil.getFeedArticlesVisibility()));
@ -169,7 +169,7 @@ public class InstantStartFeedTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> () ->
Assert.assertEquals( Assert.assertEquals(
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.getBoolean(Pref.ARTICLES_LIST_VISIBLE), .getBoolean(Pref.ARTICLES_LIST_VISIBLE),
ReturnToChromeUtil.getFeedArticlesVisibility())); ReturnToChromeUtil.getFeedArticlesVisibility()));
} }

@ -85,7 +85,7 @@ import org.chromium.chrome.browser.init.AsyncInitializationActivity;
import org.chromium.chrome.browser.layouts.LayoutStateProvider; import org.chromium.chrome.browser.layouts.LayoutStateProvider;
import org.chromium.chrome.browser.layouts.LayoutTestUtils; import org.chromium.chrome.browser.layouts.LayoutTestUtils;
import org.chromium.chrome.browser.layouts.LayoutType; import org.chromium.chrome.browser.layouts.LayoutType;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabLaunchType;
import org.chromium.chrome.browser.tasks.ReturnToChromeUtil; import org.chromium.chrome.browser.tasks.ReturnToChromeUtil;
@ -913,7 +913,8 @@ public class StartSurfaceTest {
// SpareTab should be created when the start surface is shown. // SpareTab should be created when the start surface is shown.
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> { () -> {
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile()); WarmupManager.getInstance()
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
}); });
// The spareTab initializes a renderer process. // The spareTab initializes a renderer process.
@ -927,7 +928,7 @@ public class StartSurfaceTest {
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> () ->
!WarmupManager.getInstance() !WarmupManager.getInstance()
.hasSpareTab(Profile.getLastUsedRegularProfile())); .hasSpareTab(ProfileManager.getLastUsedRegularProfile()));
Assert.assertEquals( Assert.assertEquals(
1, 1,
RecordHistogram.getHistogramValueCountForTesting( RecordHistogram.getHistogramValueCountForTesting(
@ -956,7 +957,8 @@ public class StartSurfaceTest {
// SpareTab should be created when the start surface is shown. // SpareTab should be created when the start surface is shown.
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> { () -> {
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile()); WarmupManager.getInstance()
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
}); });
// Navigate from StartSurface using search box. // Navigate from StartSurface using search box.
@ -972,7 +974,7 @@ public class StartSurfaceTest {
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> () ->
!WarmupManager.getInstance() !WarmupManager.getInstance()
.hasSpareTab(Profile.getLastUsedRegularProfile())); .hasSpareTab(ProfileManager.getLastUsedRegularProfile()));
Assert.assertEquals( Assert.assertEquals(
1, 1,
RecordHistogram.getHistogramValueCountForTesting( RecordHistogram.getHistogramValueCountForTesting(
@ -999,7 +1001,8 @@ public class StartSurfaceTest {
// SpareTab should be created when the start surface is shown. // SpareTab should be created when the start surface is shown.
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> { () -> {
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile()); WarmupManager.getInstance()
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
}); });
// Navigate from StartSurface using carousel tab switcher. // Navigate from StartSurface using carousel tab switcher.
@ -1010,7 +1013,7 @@ public class StartSurfaceTest {
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> () ->
!WarmupManager.getInstance() !WarmupManager.getInstance()
.hasSpareTab(Profile.getLastUsedRegularProfile())); .hasSpareTab(ProfileManager.getLastUsedRegularProfile()));
Assert.assertEquals( Assert.assertEquals(
1, 1,
RecordHistogram.getHistogramValueCountForTesting( RecordHistogram.getHistogramValueCountForTesting(
@ -1038,7 +1041,8 @@ public class StartSurfaceTest {
// SpareTab should be created when the start surface is shown. // SpareTab should be created when the start surface is shown.
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> { () -> {
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile()); WarmupManager.getInstance()
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
}); });
// The renderer process count should be 1 as spareTab also initializes renderer when the // The renderer process count should be 1 as spareTab also initializes renderer when the
@ -1067,7 +1071,8 @@ public class StartSurfaceTest {
// SpareTab should be created when the start surface is shown. // SpareTab should be created when the start surface is shown.
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> { () -> {
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile()); WarmupManager.getInstance()
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
}); });
// Navigate from start surface using link // Navigate from start surface using link
@ -1077,7 +1082,7 @@ public class StartSurfaceTest {
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> () ->
!WarmupManager.getInstance() !WarmupManager.getInstance()
.hasSpareTab(Profile.getLastUsedRegularProfile())); .hasSpareTab(ProfileManager.getLastUsedRegularProfile()));
Assert.assertEquals( Assert.assertEquals(
1, 1,
RecordHistogram.getHistogramValueCountForTesting( RecordHistogram.getHistogramValueCountForTesting(

@ -52,6 +52,7 @@ import org.chromium.chrome.browser.omnibox.OmniboxStub;
import org.chromium.chrome.browser.omnibox.voice.VoiceRecognitionHandler; import org.chromium.chrome.browser.omnibox.voice.VoiceRecognitionHandler;
import org.chromium.chrome.browser.preferences.PrefChangeRegistrar; import org.chromium.chrome.browser.preferences.PrefChangeRegistrar;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.services.IdentityServicesProviderJni; import org.chromium.chrome.browser.signin.services.IdentityServicesProviderJni;
@ -113,8 +114,8 @@ public class StartSurfaceCoordinatorUnitTestRule implements TestRule {
List<TabModel> tabModels = new ArrayList<>(); List<TabModel> tabModels = new ArrayList<>();
MockTabModelSelector selector = MockTabModelSelector selector =
new MockTabModelSelector( new MockTabModelSelector(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
Profile.getLastUsedRegularProfile().getPrimaryOTRProfile(true), ProfileManager.getLastUsedRegularProfile().getPrimaryOTRProfile(true),
0, 0,
0, 0,
null); null);
@ -180,7 +181,7 @@ public class StartSurfaceCoordinatorUnitTestRule implements TestRule {
Mockito.when(profile.getPrimaryOTRProfile(Mockito.anyBoolean())) Mockito.when(profile.getPrimaryOTRProfile(Mockito.anyBoolean()))
.thenReturn(incognitoProfile); .thenReturn(incognitoProfile);
PrefService prefService = Mockito.mock(PrefService.class); PrefService prefService = Mockito.mock(PrefService.class);
Profile.setLastUsedProfileForTesting(profile); ProfileManager.setLastUsedProfileForTesting(profile);
mSuggestionsDeps.getFactory().offlinePageBridge = new FakeOfflinePageBridge(); mSuggestionsDeps.getFactory().offlinePageBridge = new FakeOfflinePageBridge();
mSuggestionsDeps.getFactory().mostVisitedSites = new FakeMostVisitedSites(); mSuggestionsDeps.getFactory().mostVisitedSites = new FakeMostVisitedSites();

@ -101,6 +101,7 @@ import org.chromium.chrome.browser.omnibox.OmniboxStub;
import org.chromium.chrome.browser.omnibox.UrlFocusChangeListener; import org.chromium.chrome.browser.omnibox.UrlFocusChangeListener;
import org.chromium.chrome.browser.omnibox.voice.VoiceRecognitionHandler; import org.chromium.chrome.browser.omnibox.voice.VoiceRecognitionHandler;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.tab.MockTab; import org.chromium.chrome.browser.tab.MockTab;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
@ -216,7 +217,7 @@ public class StartSurfaceMediatorUnitTest {
doReturn(false).when(mProfile).isOffTheRecord(); doReturn(false).when(mProfile).isOffTheRecord();
mProfileSupplier.set(mProfile); mProfileSupplier.set(mProfile);
Profile.setLastUsedProfileForTesting(mProfile); ProfileManager.setLastUsedProfileForTesting(mProfile);
TemplateUrlServiceFactory.setInstanceForTesting(mTemplateUrlService); TemplateUrlServiceFactory.setInstanceForTesting(mTemplateUrlService);
ArrayList<PropertyKey> allProperties = ArrayList<PropertyKey> allProperties =

@ -58,6 +58,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.ntp.IncognitoCookieControlsManager; import org.chromium.chrome.browser.ntp.IncognitoCookieControlsManager;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.browser_ui.styles.ChromeColors; import org.chromium.components.browser_ui.styles.ChromeColors;
import org.chromium.components.prefs.PrefService; import org.chromium.components.prefs.PrefService;
import org.chromium.components.user_prefs.UserPrefs; import org.chromium.components.user_prefs.UserPrefs;
@ -103,7 +104,7 @@ public class TasksViewBinderUnitTest {
mJniMocker.mock(UserPrefsJni.TEST_HOOKS, mUserPrefsJniMock); mJniMocker.mock(UserPrefsJni.TEST_HOOKS, mUserPrefsJniMock);
when(mProfile.getPrimaryOTRProfile(true)).thenReturn(mProfile); when(mProfile.getPrimaryOTRProfile(true)).thenReturn(mProfile);
Profile.setLastUsedProfileForTesting(mProfile); ProfileManager.setLastUsedProfileForTesting(mProfile);
when(mUserPrefsJniMock.get(mProfile)).thenReturn(mPrefService); when(mUserPrefsJniMock.get(mProfile)).thenReturn(mPrefService);
createTasksView(R.layout.tasks_view_layout); createTasksView(R.layout.tasks_view_layout);
} }

@ -13,7 +13,7 @@ import androidx.annotation.StringRes;
import org.chromium.base.ApplicationStatus; import org.chromium.base.ApplicationStatus;
import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
@ -64,7 +64,7 @@ public class TabGroupUtils {
} }
final Tracker tracker = final Tracker tracker =
TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile()); TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
if (!tracker.isInitialized()) return; if (!tracker.isInitialized()) return;
if (!tracker.shouldTriggerHelpUI(featureName)) return; if (!tracker.shouldTriggerHelpUI(featureName)) return;

@ -64,7 +64,7 @@ import org.chromium.chrome.browser.price_tracking.PriceDropNotificationManagerFa
import org.chromium.chrome.browser.price_tracking.PriceDropNotificationManagerImpl; import org.chromium.chrome.browser.price_tracking.PriceDropNotificationManagerImpl;
import org.chromium.chrome.browser.price_tracking.PriceTrackingFeatures; import org.chromium.chrome.browser.price_tracking.PriceTrackingFeatures;
import org.chromium.chrome.browser.price_tracking.PriceTrackingUtilities; import org.chromium.chrome.browser.price_tracking.PriceTrackingUtilities;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tasks.tab_management.MessageService.MessageDisableReason; import org.chromium.chrome.browser.tasks.tab_management.MessageService.MessageDisableReason;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
@ -135,7 +135,7 @@ public class PriceAlertsMessageCardTest {
return TestThreadUtils.runOnUiThreadBlockingNoException( return TestThreadUtils.runOnUiThreadBlockingNoException(
() -> { () -> {
return PriceTrackingUtilities.isPriceAlertsMessageCardEnabled( return PriceTrackingUtilities.isPriceAlertsMessageCardEnabled(
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
}); });
} }

@ -67,6 +67,7 @@ import org.chromium.chrome.browser.optimization_guide.OptimizationGuideBridge.Op
import org.chromium.chrome.browser.optimization_guide.OptimizationGuideBridgeJni; import org.chromium.chrome.browser.optimization_guide.OptimizationGuideBridgeJni;
import org.chromium.chrome.browser.price_tracking.PriceTrackingFeatures; import org.chromium.chrome.browser.price_tracking.PriceTrackingFeatures;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.MockTab; import org.chromium.chrome.browser.tab.MockTab;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.state.LevelDBPersistedDataStorage; import org.chromium.chrome.browser.tab.state.LevelDBPersistedDataStorage;
@ -351,7 +352,7 @@ public class TabListViewHolderTest extends BlankUiTestActivityTestCase {
doReturn(false).when(mProfile).isOffTheRecord(); doReturn(false).when(mProfile).isOffTheRecord();
LevelDBPersistedDataStorage.setSkipNativeAssertionsForTesting(true); LevelDBPersistedDataStorage.setSkipNativeAssertionsForTesting(true);
Profile.setLastUsedProfileForTesting(mProfile); ProfileManager.setLastUsedProfileForTesting(mProfile);
PriceTrackingFeatures.setPriceTrackingEnabledForTesting(false); PriceTrackingFeatures.setPriceTrackingEnabledForTesting(false);
mMocker.mock(UrlUtilitiesJni.TEST_HOOKS, mUrlUtilitiesJniMock); mMocker.mock(UrlUtilitiesJni.TEST_HOOKS, mUrlUtilitiesJniMock);

@ -10,7 +10,7 @@ import androidx.annotation.Nullable;
import org.chromium.base.ResettersForTesting; import org.chromium.base.ResettersForTesting;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabHidingType; import org.chromium.chrome.browser.tab.TabHidingType;
@ -144,7 +144,7 @@ public class NtpFeedSurfaceLifecycleManager extends FeedSurfaceLifecycleManager
private PrefService getPrefService() { private PrefService getPrefService() {
if (sPrefServiceForTesting != null) return sPrefServiceForTesting; if (sPrefServiceForTesting != null) return sPrefServiceForTesting;
return UserPrefs.get(Profile.getLastUsedRegularProfile()); return UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
} }
static void setPrefServiceForTesting(PrefService prefServiceForTesting) { static void setPrefServiceForTesting(PrefService prefServiceForTesting) {

@ -8,7 +8,7 @@ import com.google.protobuf.CodedOutputStream;
import org.chromium.base.Log; import org.chromium.base.Log;
import org.chromium.base.test.util.UrlUtils; import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.user_prefs.UserPrefs; import org.chromium.components.user_prefs.UserPrefs;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
import org.chromium.net.test.util.WebServer; import org.chromium.net.test.util.WebServer;
@ -31,9 +31,9 @@ public class TestFeedServer implements WebServer.RequestHandler {
mServer = new WebServer(0, false); mServer = new WebServer(0, false);
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.setString(Pref.HOST_OVERRIDE_HOST, getBaseUrl()); .setString(Pref.HOST_OVERRIDE_HOST, getBaseUrl());
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.setString(Pref.DISCOVER_API_ENDPOINT_OVERRIDE, getBaseUrl()); .setString(Pref.DISCOVER_API_ENDPOINT_OVERRIDE, getBaseUrl());
}); });
mServer.setRequestHandler(this); mServer.setRequestHandler(this);

@ -12,6 +12,7 @@ import androidx.annotation.NonNull;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.services.SigninManager; import org.chromium.chrome.browser.signin.services.SigninManager;
import org.chromium.chrome.browser.signin.services.SigninManager.SignInCallback; import org.chromium.chrome.browser.signin.services.SigninManager.SignInCallback;
@ -42,7 +43,7 @@ public final class BackupSigninProcessor {
// TODO(crbug.com/1336196): Delete comment above once the dependency is gone. // TODO(crbug.com/1336196): Delete comment above once the dependency is gone.
SigninManager signinManager = SigninManager signinManager =
IdentityServicesProvider.get() IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile()); .getSigninManager(ProfileManager.getLastUsedRegularProfile());
final String accountEmail = getBackupFlowSigninAccountEmail(); final String accountEmail = getBackupFlowSigninAccountEmail();
if (!signinManager.isSyncOptInAllowed() || TextUtils.isEmpty(accountEmail)) { if (!signinManager.isSyncOptInAllowed() || TextUtils.isEmpty(accountEmail)) {
setBackupFlowSigninComplete(); setBackupFlowSigninComplete();
@ -85,7 +86,7 @@ public final class BackupSigninProcessor {
private static void signinAndEnableSync( private static void signinAndEnableSync(
@NonNull CoreAccountInfo coreAccountInfo, Activity activity) { @NonNull CoreAccountInfo coreAccountInfo, Activity activity) {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
SigninManager signinManager = IdentityServicesProvider.get().getSigninManager(profile); SigninManager signinManager = IdentityServicesProvider.get().getSigninManager(profile);
signinManager.runAfterOperationInProgress( signinManager.runAfterOperationInProgress(
() -> { () -> {

@ -33,7 +33,7 @@ import org.chromium.chrome.browser.password_manager.PasswordManagerLifecycleHelp
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.profiles.ProfileManagerUtils; import org.chromium.chrome.browser.profiles.ProfileManagerUtils;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.translate.TranslateBridge; import org.chromium.chrome.browser.translate.TranslateBridge;
@ -157,9 +157,10 @@ public class ChromeActivitySessionTracker {
TraceEvent.scoped("ChromeActivitySessionTracker.onForegroundSessionStart")) { TraceEvent.scoped("ChromeActivitySessionTracker.onForegroundSessionStart")) {
UmaUtils.recordForegroundStartTimeWithNative(); UmaUtils.recordForegroundStartTimeWithNative();
updatePasswordEchoState(); updatePasswordEchoState();
FontSizePrefs.getInstance(Profile.getLastUsedRegularProfile()) FontSizePrefs.getInstance(ProfileManager.getLastUsedRegularProfile())
.onSystemFontScaleChanged(); .onSystemFontScaleChanged();
DeviceAccessibilitySettingsHandler.getInstance(Profile.getLastUsedRegularProfile()) DeviceAccessibilitySettingsHandler.getInstance(
ProfileManager.getLastUsedRegularProfile())
.updateFontWeightAdjustment(); .updateFontWeightAdjustment();
ChromeLocalizationUtils.recordUiLanguageStatus(); ChromeLocalizationUtils.recordUiLanguageStatus();
updateAcceptLanguages(); updateAcceptLanguages();
@ -192,7 +193,8 @@ public class ChromeActivitySessionTracker {
IntentHandler.clearPendingReferrer(); IntentHandler.clearPendingReferrer();
IntentHandler.clearPendingIncognitoUrl(); IntentHandler.clearPendingIncognitoUrl();
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile()); Tracker tracker =
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
tracker.notifyEvent(EventConstants.FOREGROUND_SESSION_DESTROYED); tracker.notifyEvent(EventConstants.FOREGROUND_SESSION_DESTROYED);
} }
@ -235,7 +237,7 @@ public class ChromeActivitySessionTracker {
// call. So cache-clearing may not be effective if URL rendering can happen before // call. So cache-clearing may not be effective if URL rendering can happen before
// OnBrowsingDataRemoverDone() is called, in which case we may have to reload as // OnBrowsingDataRemoverDone() is called, in which case we may have to reload as
// well. Check if it can happen. // well. Check if it can happen.
BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile()) BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
.clearBrowsingData( .clearBrowsingData(
null, new int[] {BrowsingDataType.CACHE}, TimePeriod.ALL_TIME); null, new int[] {BrowsingDataType.CACHE}, TimePeriod.ALL_TIME);
} }
@ -253,13 +255,13 @@ public class ChromeActivitySessionTracker {
Settings.System.TEXT_SHOW_PASSWORD, Settings.System.TEXT_SHOW_PASSWORD,
1) 1)
== 1; == 1;
if (UserPrefs.get(Profile.getLastUsedRegularProfile()) if (UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.getBoolean(Pref.WEB_KIT_PASSWORD_ECHO_ENABLED) .getBoolean(Pref.WEB_KIT_PASSWORD_ECHO_ENABLED)
== systemEnabled) { == systemEnabled) {
return; return;
} }
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.setBoolean(Pref.WEB_KIT_PASSWORD_ECHO_ENABLED, systemEnabled); .setBoolean(Pref.WEB_KIT_PASSWORD_ECHO_ENABLED, systemEnabled);
} }

@ -30,7 +30,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.init.AsyncInitTaskRunner; import org.chromium.chrome.browser.init.AsyncInitTaskRunner;
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.services.SigninManager; import org.chromium.chrome.browser.signin.services.SigninManager;
import org.chromium.components.signin.AccountManagerFacade; import org.chromium.components.signin.AccountManagerFacade;
@ -217,12 +217,14 @@ public class ChromeBackupAgentImpl extends ChromeBackupAgent.Impl {
syncAccount.set( syncAccount.set(
IdentityServicesProvider.get() IdentityServicesProvider.get()
.getIdentityManager(Profile.getLastUsedRegularProfile()) .getIdentityManager(
ProfileManager.getLastUsedRegularProfile())
.getPrimaryAccountInfo(ConsentLevel.SYNC)); .getPrimaryAccountInfo(ConsentLevel.SYNC));
signedInAccount.set( signedInAccount.set(
IdentityServicesProvider.get() IdentityServicesProvider.get()
.getIdentityManager(Profile.getLastUsedRegularProfile()) .getIdentityManager(
ProfileManager.getLastUsedRegularProfile())
.getPrimaryAccountInfo(ConsentLevel.SIGNIN)); .getPrimaryAccountInfo(ConsentLevel.SIGNIN));
if (syncAccount.get() != null if (syncAccount.get() != null
@ -599,7 +601,7 @@ public class ChromeBackupAgentImpl extends ChromeBackupAgent.Impl {
() -> { () -> {
SigninManager signinManager = SigninManager signinManager =
IdentityServicesProvider.get() IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile()); .getSigninManager(ProfileManager.getLastUsedRegularProfile());
final AccountManagerFacade accountManagerFacade = final AccountManagerFacade accountManagerFacade =
AccountManagerFacadeProvider.getInstance(); AccountManagerFacadeProvider.getInstance();

@ -17,7 +17,7 @@ import org.chromium.base.StrictModeContext;
import org.chromium.base.shared_preferences.SharedPreferencesManager; import org.chromium.base.shared_preferences.SharedPreferencesManager;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
import org.chromium.components.signin.identitymanager.IdentityManager; import org.chromium.components.signin.identitymanager.IdentityManager;
import org.chromium.components.signin.identitymanager.PrimaryAccountChangeEvent; import org.chromium.components.signin.identitymanager.PrimaryAccountChangeEvent;
@ -67,7 +67,7 @@ public class ChromeBackupWatcher {
// Update the backup if the sign-in status changes. // Update the backup if the sign-in status changes.
IdentityManager identityManager = IdentityManager identityManager =
IdentityServicesProvider.get() IdentityServicesProvider.get()
.getIdentityManager(Profile.getLastUsedRegularProfile()); .getIdentityManager(ProfileManager.getLastUsedRegularProfile());
identityManager.addObserver( identityManager.addObserver(
new IdentityManager.Observer() { new IdentityManager.Observer() {
@Override @Override

@ -42,6 +42,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.gsa.GSAState; import org.chromium.chrome.browser.gsa.GSAState;
import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteControllerProvider; import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteControllerProvider;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.renderer_host.ChromeNavigationUIData; import org.chromium.chrome.browser.renderer_host.ChromeNavigationUIData;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
@ -631,7 +632,7 @@ public class IntentHandler {
} }
String query = results.get(0); String query = results.get(0);
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
AutocompleteMatch match; AutocompleteMatch match;
try (var controller = AutocompleteControllerProvider.createCloseableController(profile)) { try (var controller = AutocompleteControllerProvider.createCloseableController(profile)) {
match = controller.get().classify(query); match = controller.get().classify(query);

@ -40,7 +40,7 @@ public abstract class SynchronousInitializationActivity extends ChromeBaseAppCom
assert ProfileManager.isInitialized(); assert ProfileManager.isInitialized();
// TODO(crbug/1410601): Pass the Profile information via the launching Intent and remove // TODO(crbug/1410601): Pass the Profile information via the launching Intent and remove
// getLastUsedRegularProfile below. // getLastUsedRegularProfile below.
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
return new ProfileProvider() { return new ProfileProvider() {
@NonNull @NonNull
@Override @Override

@ -38,6 +38,7 @@ import org.chromium.chrome.browser.content.WebContentsFactory;
import org.chromium.chrome.browser.crash.ChromePureJavaExceptionReporter; import org.chromium.chrome.browser.crash.ChromePureJavaExceptionReporter;
import org.chromium.chrome.browser.customtabs.CustomTabDelegateFactory; import org.chromium.chrome.browser.customtabs.CustomTabDelegateFactory;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabBuilder; import org.chromium.chrome.browser.tab.TabBuilder;
@ -563,7 +564,7 @@ public class WarmupManager {
mSpareWebContents = mSpareWebContents =
new WebContentsFactory() new WebContentsFactory()
.createWebContentsWithWarmRenderer( .createWebContentsWithWarmRenderer(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
/* initiallyHidden= */ true); /* initiallyHidden= */ true);
mObserver = new RenderProcessGoneObserver(); mObserver = new RenderProcessGoneObserver();
mSpareWebContents.addObserver(mObserver); mSpareWebContents.addObserver(mObserver);

@ -16,6 +16,7 @@ import org.chromium.chrome.browser.download.settings.DownloadSettings;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.profiles.OTRProfileID; import org.chromium.chrome.browser.profiles.OTRProfileID;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager;
import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.settings.SettingsLauncher;
@ -39,10 +40,10 @@ class DownloadManagerCoordinatorFactoryHelper {
ModalDialogManager modalDialogManager) { ModalDialogManager modalDialogManager) {
Profile profile = Profile profile =
OTRProfileID.isOffTheRecord(config.otrProfileID) OTRProfileID.isOffTheRecord(config.otrProfileID)
? Profile.getLastUsedRegularProfile() ? ProfileManager.getLastUsedRegularProfile()
.getOffTheRecordProfile( .getOffTheRecordProfile(
config.otrProfileID, /* createIfNeeded= */ true) config.otrProfileID, /* createIfNeeded= */ true)
: Profile.getLastUsedRegularProfile(); : ProfileManager.getLastUsedRegularProfile();
Callback<Context> settingsLaunchHelper = Callback<Context> settingsLaunchHelper =
DownloadManagerCoordinatorFactoryHelper::settingsLaunchHelper; DownloadManagerCoordinatorFactoryHelper::settingsLaunchHelper;
return DownloadManagerCoordinatorFactory.create( return DownloadManagerCoordinatorFactory.create(

@ -12,6 +12,7 @@ import org.chromium.base.Callback;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileKey; import org.chromium.chrome.browser.profiles.ProfileKey;
import org.chromium.chrome.browser.profiles.ProfileKeyUtil; import org.chromium.chrome.browser.profiles.ProfileKeyUtil;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.background_task_scheduler.NativeBackgroundTask; import org.chromium.components.background_task_scheduler.NativeBackgroundTask;
import org.chromium.components.background_task_scheduler.TaskInfo; import org.chromium.components.background_task_scheduler.TaskInfo;
import org.chromium.components.background_task_scheduler.TaskParameters; import org.chromium.components.background_task_scheduler.TaskParameters;
@ -55,7 +56,7 @@ public final class ProxyNativeTask extends NativeBackgroundTask {
.startBackgroundTaskWithFullBrowser( .startBackgroundTaskWithFullBrowser(
mNativeProxyNativeTask, mNativeProxyNativeTask,
ProxyNativeTask.this, ProxyNativeTask.this,
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
} else { } else {
ProxyNativeTaskJni.get() ProxyNativeTaskJni.get()
.startBackgroundTaskInReducedMode( .startBackgroundTaskInReducedMode(
@ -72,7 +73,7 @@ public final class ProxyNativeTask extends NativeBackgroundTask {
.onFullBrowserLoaded( .onFullBrowserLoaded(
mNativeProxyNativeTask, mNativeProxyNativeTask,
ProxyNativeTask.this, ProxyNativeTask.this,
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
} }
@Override @Override

@ -34,7 +34,7 @@ import org.chromium.chrome.browser.bookmarks.BookmarkModel;
import org.chromium.chrome.browser.bookmarks.BookmarkModelObserver; import org.chromium.chrome.browser.bookmarks.BookmarkModelObserver;
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
import org.chromium.chrome.browser.night_mode.SystemNightModeMonitor; import org.chromium.chrome.browser.night_mode.SystemNightModeMonitor;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.ui.favicon.FaviconUtils; import org.chromium.chrome.browser.ui.favicon.FaviconUtils;
import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkId;
import org.chromium.components.bookmarks.BookmarkItem; import org.chromium.components.bookmarks.BookmarkItem;
@ -173,13 +173,14 @@ public class BookmarkWidgetServiceImpl extends BookmarkWidgetService.Impl {
mCallback = callback; mCallback = callback;
Resources res = context.getResources(); Resources res = context.getResources();
mLargeIconBridge = new LargeIconBridge(Profile.getLastUsedRegularProfile()); mLargeIconBridge = new LargeIconBridge(ProfileManager.getLastUsedRegularProfile());
mMinIconSizeDp = (int) res.getDimension(R.dimen.default_favicon_min_size); mMinIconSizeDp = (int) res.getDimension(R.dimen.default_favicon_min_size);
mDisplayedIconSize = res.getDimensionPixelSize(R.dimen.default_favicon_size); mDisplayedIconSize = res.getDimensionPixelSize(R.dimen.default_favicon_size);
mIconGenerator = FaviconUtils.createRoundedRectangleIconGenerator(context); mIconGenerator = FaviconUtils.createRoundedRectangleIconGenerator(context);
mRemainingTaskCount = 1; mRemainingTaskCount = 1;
mBookmarkModel = BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile()); mBookmarkModel =
BookmarkModel.getForProfile(ProfileManager.getLastUsedRegularProfile());
mBookmarkModel.finishLoadingBookmarkModel( mBookmarkModel.finishLoadingBookmarkModel(
new Runnable() { new Runnable() {
@Override @Override
@ -306,7 +307,8 @@ public class BookmarkWidgetServiceImpl extends BookmarkWidgetService.Impl {
RecordUserAction.record("BookmarkNavigatorWidgetAdded"); RecordUserAction.record("BookmarkNavigatorWidgetAdded");
} }
mBookmarkModel = BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile()); mBookmarkModel =
BookmarkModel.getForProfile(ProfileManager.getLastUsedRegularProfile());
mBookmarkModel.addObserver( mBookmarkModel.addObserver(
new BookmarkModelObserver() { new BookmarkModelObserver() {
@Override @Override

@ -32,6 +32,7 @@ import org.chromium.base.CollectionUtil;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.ui.favicon.FaviconUtils; import org.chromium.chrome.browser.ui.favicon.FaviconUtils;
import org.chromium.chrome.browser.webapps.WebappRegistry; import org.chromium.chrome.browser.webapps.WebappRegistry;
import org.chromium.components.browser_ui.util.ConversionUtils; import org.chromium.components.browser_ui.util.ConversionUtils;
@ -276,7 +277,7 @@ public class ConfirmImportantSitesDialogFragment extends DialogFragment {
mFaviconURLs = new String[0]; mFaviconURLs = new String[0];
dismiss(); dismiss();
} }
mProfile = Profile.getLastUsedRegularProfile(); mProfile = ProfileManager.getLastUsedRegularProfile();
mLargeIconBridge = new LargeIconBridge(mProfile); mLargeIconBridge = new LargeIconBridge(mProfile);
ActivityManager activityManager = ActivityManager activityManager =
((ActivityManager) ((ActivityManager)

@ -17,6 +17,7 @@ import org.jni_zero.NativeMethods;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.compositor.layouts.content.TitleBitmapFactory; import org.chromium.chrome.browser.compositor.layouts.content.TitleBitmapFactory;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabFavicon; import org.chromium.chrome.browser.tab.TabFavicon;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
@ -175,8 +176,8 @@ public class LayerTitleCache {
// to get the correct profile. // to get the correct profile.
Profile profile = Profile profile =
!tab.isIncognito() !tab.isIncognito()
? Profile.getLastUsedRegularProfile() ? ProfileManager.getLastUsedRegularProfile()
: Profile.getLastUsedRegularProfile() : ProfileManager.getLastUsedRegularProfile()
.getPrimaryOTRProfile(/* createIfNeeded= */ true); .getPrimaryOTRProfile(/* createIfNeeded= */ true);
mFaviconHelper.getLocalFaviconImageForURL(profile, tab.getUrl(), mFaviconSize, callback); mFaviconHelper.getLocalFaviconImageForURL(profile, tab.getUrl(), mFaviconSize, callback);
} }

@ -21,6 +21,7 @@ import org.chromium.chrome.browser.content.ContentUtils;
import org.chromium.chrome.browser.content.WebContentsFactory; import org.chromium.chrome.browser.content.WebContentsFactory;
import org.chromium.chrome.browser.contextualsearch.ContextualSearchManagementDelegate; import org.chromium.chrome.browser.contextualsearch.ContextualSearchManagementDelegate;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetController; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState; import org.chromium.components.browser_ui.bottomsheet.BottomSheetController.SheetState;
import org.chromium.components.browser_ui.bottomsheet.BottomSheetObserver; import org.chromium.components.browser_ui.bottomsheet.BottomSheetObserver;
@ -94,7 +95,7 @@ public class ContextualSearchPanelCoordinator implements ContextualSearchPanelIn
} }
private void createWebContents() { private void createWebContents() {
final Profile profile = Profile.getLastUsedRegularProfile(); final Profile profile = ProfileManager.getLastUsedRegularProfile();
mWebContents = WebContentsFactory.createWebContents(profile, false, false); mWebContents = WebContentsFactory.createWebContents(profile, false, false);
mWebContentView = ContentView.createContentView(mContext, null, mWebContents); mWebContentView = ContentView.createContentView(mContext, null, mWebContents);
final ViewAndroidDelegate delegate = final ViewAndroidDelegate delegate =

@ -19,6 +19,7 @@ import org.chromium.chrome.browser.compositor.bottombar.contextualsearch.Related
import org.chromium.chrome.browser.layouts.scene_layer.SceneLayer; import org.chromium.chrome.browser.layouts.scene_layer.SceneLayer;
import org.chromium.chrome.browser.layouts.scene_layer.SceneOverlayLayer; import org.chromium.chrome.browser.layouts.scene_layer.SceneOverlayLayer;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.resources.ResourceManager; import org.chromium.ui.resources.ResourceManager;
@ -214,7 +215,7 @@ public class ContextualSearchSceneLayer extends SceneOverlayLayer {
touchHighlightVisible, touchHighlightVisible,
touchHighlightXOffset, touchHighlightXOffset,
touchHighlightWidth, touchHighlightWidth,
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
roundedBarTopResourceId, roundedBarTopResourceId,
separatorLineColor); separatorLineColor);
} }

@ -74,6 +74,7 @@ import org.chromium.chrome.browser.prefetch.settings.PreloadPagesSettingsBridge;
import org.chromium.chrome.browser.prefetch.settings.PreloadPagesState; import org.chromium.chrome.browser.prefetch.settings.PreloadPagesState;
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.components.content_settings.CookieControlsMode; import org.chromium.components.content_settings.CookieControlsMode;
import org.chromium.components.embedder_support.util.Origin; import org.chromium.components.embedder_support.util.Origin;
@ -481,7 +482,7 @@ public class CustomTabsConnection {
try (TraceEvent e = try (TraceEvent e =
TraceEvent.scoped("WarmupInternalFinishInitialization")) { TraceEvent.scoped("WarmupInternalFinishInitialization")) {
// (4) // (4)
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
WarmupManager.startPreconnectPredictorInitialization(profile); WarmupManager.startPreconnectPredictorInitialization(profile);
// (5) The throttling database uses shared preferences, that can cause // (5) The throttling database uses shared preferences, that can cause
@ -568,7 +569,7 @@ public class CustomTabsConnection {
boolean atLeastOneUrl = false; boolean atLeastOneUrl = false;
if (likelyBundles == null) return false; if (likelyBundles == null) return false;
WarmupManager warmupManager = WarmupManager.getInstance(); WarmupManager warmupManager = WarmupManager.getInstance();
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
for (Bundle bundle : likelyBundles) { for (Bundle bundle : likelyBundles) {
Uri uri; Uri uri;
try { try {
@ -664,7 +665,7 @@ public class CustomTabsConnection {
try (TraceEvent e = TraceEvent.scoped("CustomTabsConnection.mayLaunchUrlOnUiThread")) { try (TraceEvent e = TraceEvent.scoped("CustomTabsConnection.mayLaunchUrlOnUiThread")) {
// doMayLaunchUrlInternal() is always called once the native level initialization is // doMayLaunchUrlInternal() is always called once the native level initialization is
// done, at least the initial profile load. However, at that stage the startup callback // done, at least the initial profile load. However, at that stage the startup callback
// may not have run, which causes Profile.getLastUsedRegularProfile() to throw an // may not have run, which causes ProfileManager.getLastUsedRegularProfile() to throw an
// exception. But the tasks have been posted by then, so reschedule ourselves, only // exception. But the tasks have been posted by then, so reschedule ourselves, only
// once. // once.
if (!BrowserStartupController.getInstance().isFullBrowserStarted()) { if (!BrowserStartupController.getInstance().isFullBrowserStarted()) {
@ -1028,7 +1029,7 @@ public class CustomTabsConnection {
WarmupManager.getInstance() WarmupManager.getInstance()
.maybePreconnectUrlAndSubResources( .maybePreconnectUrlAndSubResources(
Profile.getLastUsedRegularProfile(), redirectEndpoint.toString()); ProfileManager.getLastUsedRegularProfile(), redirectEndpoint.toString());
} }
@VisibleForTesting @VisibleForTesting
@ -1102,7 +1103,7 @@ public class CustomTabsConnection {
String packageName = mClientManager.getClientPackageNameForSession(session); String packageName = mClientManager.getClientPackageNameForSession(session);
CustomTabsConnectionJni.get() CustomTabsConnectionJni.get()
.createAndStartDetachedResourceRequest( .createAndStartDetachedResourceRequest(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
session, session,
packageName, packageName,
urlString, urlString,
@ -1149,7 +1150,7 @@ public class CustomTabsConnection {
// Session is null because we don't need completion notifications. // Session is null because we don't need completion notifications.
CustomTabsConnectionJni.get() CustomTabsConnectionJni.get()
.createAndStartDetachedResourceRequest( .createAndStartDetachedResourceRequest(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
null, null,
null, null,
urlString, urlString,
@ -1789,7 +1790,8 @@ public class CustomTabsConnection {
if (!DeviceClassManager.enablePrerendering()) { if (!DeviceClassManager.enablePrerendering()) {
return false; return false;
} }
if (UserPrefs.get(Profile.getLastUsedRegularProfile()).getInteger(COOKIE_CONTROLS_MODE) if (UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.getInteger(COOKIE_CONTROLS_MODE)
== CookieControlsMode.BLOCK_THIRD_PARTY) { == CookieControlsMode.BLOCK_THIRD_PARTY) {
return false; return false;
} }
@ -1817,7 +1819,7 @@ public class CustomTabsConnection {
Bundle extras, Bundle extras,
int uid) { int uid) {
WarmupManager warmupManager = WarmupManager.getInstance(); WarmupManager warmupManager = WarmupManager.getInstance();
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
// At most one on-going speculation, clears the previous one. // At most one on-going speculation, clears the previous one.
cancelSpeculation(null); cancelSpeculation(null);

@ -25,6 +25,7 @@ import org.chromium.chrome.browser.night_mode.SystemNightModeMonitor;
import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager; import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager;
import org.chromium.chrome.browser.webapps.WebappRegistry; import org.chromium.chrome.browser.webapps.WebappRegistry;
@ -42,7 +43,7 @@ public class ChromeAppModule {
@Provides @Provides
@Named(LAST_USED_REGULAR_PROFILE) @Named(LAST_USED_REGULAR_PROFILE)
public Profile provideLastUsedRegularProfile() { public Profile provideLastUsedRegularProfile() {
return Profile.getLastUsedRegularProfile(); return ProfileManager.getLastUsedRegularProfile();
} }
@Provides @Provides

@ -24,7 +24,7 @@ import android.widget.TextView;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.dom_distiller.core.DistilledPagePrefs; import org.chromium.components.dom_distiller.core.DistilledPagePrefs;
import org.chromium.dom_distiller.mojom.FontFamily; import org.chromium.dom_distiller.mojom.FontFamily;
import org.chromium.dom_distiller.mojom.Theme; import org.chromium.dom_distiller.mojom.Theme;
@ -74,7 +74,7 @@ public class DistilledPagePrefsView extends LinearLayout
// incognito profile) instead of always using regular profile. It works correctly now, but // incognito profile) instead of always using regular profile. It works correctly now, but
// it is not safe. // it is not safe.
mDistilledPagePrefs = mDistilledPagePrefs =
DomDistillerServiceFactory.getForProfile(Profile.getLastUsedRegularProfile()) DomDistillerServiceFactory.getForProfile(ProfileManager.getLastUsedRegularProfile())
.getDistilledPagePrefs(); .getDistilledPagePrefs();
mColorModeButtons = new HashMap<Integer /* Theme */, RadioButton>(); mColorModeButtons = new HashMap<Integer /* Theme */, RadioButton>();
mPercentageFormatter = NumberFormat.getPercentInstance(Locale.getDefault()); mPercentageFormatter = NumberFormat.getPercentInstance(Locale.getDefault());

@ -1075,7 +1075,7 @@ public class DownloadManagerService implements DownloadServiceDelegate, ProfileM
} }
if (BrowserStartupController.getInstance().isFullBrowserStarted()) { if (BrowserStartupController.getInstance().isFullBrowserStarted()) {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
if (OTRProfileID.isOffTheRecord(info.getOTRProfileId())) { if (OTRProfileID.isOffTheRecord(info.getOTRProfileId())) {
profile = profile =
profile.getOffTheRecordProfile( profile.getOffTheRecordProfile(
@ -1310,7 +1310,7 @@ public class DownloadManagerService implements DownloadServiceDelegate, ProfileM
*/ */
// TODO(shaktisahu): Drive this from a similar observer. // TODO(shaktisahu): Drive this from a similar observer.
private void maybeShowMissingSdCardError(List<DownloadItem> list) { private void maybeShowMissingSdCardError(List<DownloadItem> list) {
PrefService prefService = UserPrefs.get(Profile.getLastUsedRegularProfile()); PrefService prefService = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
// Only show the missing directory snackbar once. // Only show the missing directory snackbar once.
if (!prefService.getBoolean(Pref.SHOW_MISSING_SD_CARD_ERROR_ANDROID)) return; if (!prefService.getBoolean(Pref.SHOW_MISSING_SD_CARD_ERROR_ANDROID)) return;

@ -31,7 +31,7 @@ import org.chromium.chrome.browser.notifications.NotificationUmaTracker;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.OTRProfileID; import org.chromium.chrome.browser.profiles.OTRProfileID;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.background_task_scheduler.BackgroundTask.TaskFinishedCallback; import org.chromium.components.background_task_scheduler.BackgroundTask.TaskFinishedCallback;
import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy;
import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl;
@ -799,7 +799,7 @@ public class DownloadNotificationService {
public void cancelOffTheRecordDownloads() { public void cancelOffTheRecordDownloads() {
boolean cancelActualDownload = boolean cancelActualDownload =
BrowserStartupController.getInstance().isFullBrowserStarted() BrowserStartupController.getInstance().isFullBrowserStarted()
&& Profile.getLastUsedRegularProfile().hasPrimaryOTRProfile(); && ProfileManager.getLastUsedRegularProfile().hasPrimaryOTRProfile();
List<DownloadSharedPreferenceEntry> entries = mDownloadSharedPreferenceHelper.getEntries(); List<DownloadSharedPreferenceEntry> entries = mDownloadSharedPreferenceHelper.getEntries();
List<DownloadSharedPreferenceEntry> copies = List<DownloadSharedPreferenceEntry> copies =

@ -139,7 +139,8 @@ public class DownloadUtils {
// If the profile is off-the-record and it does not exist, then do not start the activity. // If the profile is off-the-record and it does not exist, then do not start the activity.
if (OTRProfileID.isOffTheRecord(otrProfileID) if (OTRProfileID.isOffTheRecord(otrProfileID)
&& !Profile.getLastUsedRegularProfile().hasOffTheRecordProfile(otrProfileID)) { && !ProfileManager.getLastUsedRegularProfile()
.hasOffTheRecordProfile(otrProfileID)) {
return false; return false;
} }
@ -173,8 +174,8 @@ public class DownloadUtils {
if (BrowserStartupController.getInstance().isFullBrowserStarted()) { if (BrowserStartupController.getInstance().isFullBrowserStarted()) {
Profile profile = Profile profile =
otrProfileID == null otrProfileID == null
? Profile.getLastUsedRegularProfile() ? ProfileManager.getLastUsedRegularProfile()
: Profile.getLastUsedRegularProfile() : ProfileManager.getLastUsedRegularProfile()
.getOffTheRecordProfile( .getOffTheRecordProfile(
otrProfileID, /* createIfNeeded= */ true); otrProfileID, /* createIfNeeded= */ true);
Tracker tracker = TrackerFactory.getTrackerForProfile(profile); Tracker tracker = TrackerFactory.getTrackerForProfile(profile);
@ -207,7 +208,7 @@ public class DownloadUtils {
OTRProfileID otrProfileID = OTRProfileID.deserializeWithoutVerify(serializedId); OTRProfileID otrProfileID = OTRProfileID.deserializeWithoutVerify(serializedId);
return otrProfileID == null return otrProfileID == null
|| Profile.getLastUsedRegularProfile().hasOffTheRecordProfile(otrProfileID); || ProfileManager.getLastUsedRegularProfile().hasOffTheRecordProfile(otrProfileID);
} }
/** /**

@ -15,7 +15,6 @@ import org.chromium.base.IntentUtils;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.ui.default_browser_promo.DefaultBrowserPromoDeps; import org.chromium.chrome.browser.ui.default_browser_promo.DefaultBrowserPromoDeps;
import org.chromium.chrome.browser.ui.default_browser_promo.DefaultBrowserPromoUtils; import org.chromium.chrome.browser.ui.default_browser_promo.DefaultBrowserPromoUtils;
@ -57,7 +56,7 @@ public final class FeatureNotificationUtils {
() -> { () -> {
Tracker tracker = Tracker tracker =
TrackerFactory.getTrackerForProfile( TrackerFactory.getTrackerForProfile(
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
tracker.setPriorityNotification( tracker.setPriorityNotification(
FeatureNotificationUtils FeatureNotificationUtils
.getIPHFeatureForNotificationFeatureType(featureType)); .getIPHFeatureForNotificationFeatureType(featureType));
@ -67,7 +66,8 @@ public final class FeatureNotificationUtils {
/** Helper method to register an IPH show callback for the feature type to show the IPH. */ /** Helper method to register an IPH show callback for the feature type to show the IPH. */
public static void registerIPHCallback(@FeatureType int featureType, Runnable showIphCallback) { public static void registerIPHCallback(@FeatureType int featureType, Runnable showIphCallback) {
if (!ProfileManager.isInitialized()) return; if (!ProfileManager.isInitialized()) return;
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile()); Tracker tracker =
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
tracker.registerPriorityNotificationHandler( tracker.registerPriorityNotificationHandler(
getIPHFeatureForNotificationFeatureType(featureType), showIphCallback); getIPHFeatureForNotificationFeatureType(featureType), showIphCallback);
} }
@ -75,7 +75,8 @@ public final class FeatureNotificationUtils {
/** Unregisters any IPH callbacks associated with the feature type. */ /** Unregisters any IPH callbacks associated with the feature type. */
public static void unregisterIPHCallback(@FeatureType int featureType) { public static void unregisterIPHCallback(@FeatureType int featureType) {
if (!ProfileManager.isInitialized()) return; if (!ProfileManager.isInitialized()) return;
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile()); Tracker tracker =
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
tracker.unregisterPriorityNotificationHandler( tracker.unregisterPriorityNotificationHandler(
getIPHFeatureForNotificationFeatureType(featureType)); getIPHFeatureForNotificationFeatureType(featureType));
} }
@ -86,7 +87,8 @@ public final class FeatureNotificationUtils {
*/ */
public static boolean willShowIPH(@FeatureType int featureType) { public static boolean willShowIPH(@FeatureType int featureType) {
String iphFeature = getIPHFeatureForNotificationFeatureType(featureType); String iphFeature = getIPHFeatureForNotificationFeatureType(featureType);
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile()); Tracker tracker =
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
return TextUtils.equals(tracker.getPendingPriorityNotification(), iphFeature); return TextUtils.equals(tracker.getPendingPriorityNotification(), iphFeature);
} }
@ -179,7 +181,7 @@ public final class FeatureNotificationUtils {
if (featureType == FeatureType.DEFAULT_BROWSER) { if (featureType == FeatureType.DEFAULT_BROWSER) {
return !shouldShowDefaultBrowserPromo(); return !shouldShowDefaultBrowserPromo();
} else if (featureType == FeatureType.NTP_SUGGESTION_CARD) { } else if (featureType == FeatureType.NTP_SUGGESTION_CARD) {
PrefService prefService = UserPrefs.get(Profile.getLastUsedRegularProfile()); PrefService prefService = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
return !prefService.getBoolean(Pref.ARTICLES_LIST_VISIBLE); return !prefService.getBoolean(Pref.ARTICLES_LIST_VISIBLE);
} }
return false; return false;

@ -23,7 +23,6 @@ import org.chromium.chrome.browser.partnercustomizations.HomepageCharacterizatio
import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations; import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.settings.SettingsLauncher;
@ -117,8 +116,8 @@ public class HomepageManager
* this function will fallback to return {@link ChromeUrlConstants.nativeNtpGurl()}. If the * this function will fallback to return {@link ChromeUrlConstants.nativeNtpGurl()}. If the
* default search engine (DSE) isn't Google, may fallback to the DSE's new Tab URL. * default search engine (DSE) isn't Google, may fallback to the DSE's new Tab URL.
* *
* <p>This function needs to be called on UI thread since Profile.getLastUsedRegularProfile() is * <p>This function needs to be called on UI thread since
* called. * ProfileManager.getLastUsedRegularProfile() is called.
* *
* <p>This function checks different sources to get the current homepage, which is listed below * <p>This function checks different sources to get the current homepage, which is listed below
* according to their priority: * according to their priority:
@ -138,13 +137,14 @@ public class HomepageManager
homepageGurl = ChromeUrlConstants.nativeNtpGurl(); homepageGurl = ChromeUrlConstants.nativeNtpGurl();
} }
// We have to use Profile.getLastUsedRegularProfile() to get the last used regular Profile // We have to use ProfileManager.getLastUsedRegularProfile() to get the last used regular
// Profile
// before HomepageManager supports multiple Profiles. Thus, if DSE isn't Google, pressing // before HomepageManager supports multiple Profiles. Thus, if DSE isn't Google, pressing
// the home button may redirect to the DSE's new Tab URL, rather than showing an incognito // the home button may redirect to the DSE's new Tab URL, rather than showing an incognito
// NTP. // NTP.
return DseNewTabUrlManager.maybeGetOverrideUrl( return DseNewTabUrlManager.maybeGetOverrideUrl(
homepageGurl, homepageGurl,
ProfileManager.isInitialized() ? Profile.getLastUsedRegularProfile() : null); ProfileManager.isInitialized() ? ProfileManager.getLastUsedRegularProfile() : null);
} }
/** /**

@ -17,7 +17,7 @@ import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.preferences.PrefChangeRegistrar; import org.chromium.chrome.browser.preferences.PrefChangeRegistrar;
import org.chromium.chrome.browser.preferences.PrefChangeRegistrar.PrefObserver; import org.chromium.chrome.browser.preferences.PrefChangeRegistrar.PrefObserver;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.prefs.PrefService; import org.chromium.components.prefs.PrefService;
import org.chromium.components.user_prefs.UserPrefs; import org.chromium.components.user_prefs.UserPrefs;
import org.chromium.url.GURL; import org.chromium.url.GURL;
@ -221,7 +221,7 @@ public class HomepagePolicyManager implements PrefObserver {
private PrefService getPrefService() { private PrefService getPrefService() {
if (sPrefServiceForTesting != null) return sPrefServiceForTesting; if (sPrefServiceForTesting != null) return sPrefServiceForTesting;
return UserPrefs.get(Profile.getLastUsedRegularProfile()); return UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
} }
public static void setPrefServiceForTesting(PrefService prefService) { public static void setPrefServiceForTesting(PrefService prefService) {

@ -22,7 +22,6 @@ import org.chromium.base.task.PostTask;
import org.chromium.base.task.TaskTraits; import org.chromium.base.task.TaskTraits;
import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.document.ChromeLauncherActivity; import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tabmodel.IncognitoTabHostUtils; import org.chromium.chrome.browser.tabmodel.IncognitoTabHostUtils;
import org.chromium.chrome.browser.util.AndroidTaskUtils; import org.chromium.chrome.browser.util.AndroidTaskUtils;
@ -67,9 +66,9 @@ public class IncognitoNotificationServiceImpl extends IncognitoNotificationServi
IncognitoNotificationManager.dismissIncognitoNotification(); IncognitoNotificationManager.dismissIncognitoNotification();
if (BrowserStartupController.getInstance().isFullBrowserStarted()) { if (BrowserStartupController.getInstance().isFullBrowserStarted()) {
if (Profile.getLastUsedRegularProfile().hasPrimaryOTRProfile()) { if (ProfileManager.getLastUsedRegularProfile().hasPrimaryOTRProfile()) {
ProfileManager.destroyWhenAppropriate( ProfileManager.destroyWhenAppropriate(
Profile.getLastUsedRegularProfile() ProfileManager.getLastUsedRegularProfile()
.getPrimaryOTRProfile(/* createIfNeeded= */ false)); .getPrimaryOTRProfile(/* createIfNeeded= */ false));
} }
} }

@ -52,7 +52,7 @@ public class ActivityProfileProvider extends OneshotSupplierImpl<ProfileProvider
@NonNull @NonNull
@Override @Override
public Profile getOriginalProfile() { public Profile getOriginalProfile() {
return Profile.getLastUsedRegularProfile(); return ProfileManager.getLastUsedRegularProfile();
} }
@Nullable @Nullable

@ -40,7 +40,7 @@ import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;
import org.chromium.chrome.browser.metrics.SimpleStartupForegroundSessionDetector; import org.chromium.chrome.browser.metrics.SimpleStartupForegroundSessionDetector;
import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcher; import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcher;
import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcherImpl; import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcherImpl;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.profiles.ProfileProvider; import org.chromium.chrome.browser.profiles.ProfileProvider;
import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities; import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities;
import org.chromium.chrome.features.start_surface.StartSurfaceConfiguration; import org.chromium.chrome.features.start_surface.StartSurfaceConfiguration;
@ -268,7 +268,7 @@ public abstract class AsyncInitializationActivity extends ChromeBaseAppCompatAct
if (!IntentHandler.hasAnyIncognitoExtra(intent.getExtras())) { if (!IntentHandler.hasAnyIncognitoExtra(intent.getExtras())) {
WarmupManager.getInstance() WarmupManager.getInstance()
.maybePreconnectUrlAndSubResources( .maybePreconnectUrlAndSubResources(
Profile.getLastUsedRegularProfile(), url); ProfileManager.getLastUsedRegularProfile(), url);
} }
} finally { } finally {
TraceEvent.end("maybePreconnect"); TraceEvent.end("maybePreconnect");

@ -38,7 +38,7 @@ import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.language.GlobalAppLocaleController; import org.chromium.chrome.browser.language.GlobalAppLocaleController;
import org.chromium.chrome.browser.metrics.UmaUtils; import org.chromium.chrome.browser.metrics.UmaUtils;
import org.chromium.chrome.browser.preferences.AllPreferenceKeyRegistries; import org.chromium.chrome.browser.preferences.AllPreferenceKeyRegistries;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.signin.SigninCheckerProvider; import org.chromium.chrome.browser.signin.SigninCheckerProvider;
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; import org.chromium.chrome.browser.webapps.ChromeWebApkHost;
import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerFactory; import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerFactory;
@ -359,7 +359,7 @@ public class ChromeBrowserInitializer {
LibraryProcessType.PROCESS_BROWSER, LibraryProcessType.PROCESS_BROWSER,
/* singleProcess= */ false, /* singleProcess= */ false,
/* startGpuProcess= */ startGpuProcess); /* startGpuProcess= */ startGpuProcess);
SigninCheckerProvider.get(Profile.getLastUsedRegularProfile()); SigninCheckerProvider.get(ProfileManager.getLastUsedRegularProfile());
} finally { } finally {
TraceEvent.end("ChromeBrowserInitializer.startChromeBrowserProcessesSync"); TraceEvent.end("ChromeBrowserInitializer.startChromeBrowserProcessesSync");
} }

@ -74,6 +74,7 @@ import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.price_tracking.PriceTrackingFeatures; import org.chromium.chrome.browser.price_tracking.PriceTrackingFeatures;
import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl; import org.chromium.chrome.browser.privacy.settings.PrivacyPreferencesManagerImpl;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.profiles.ProfileManagerUtils; import org.chromium.chrome.browser.profiles.ProfileManagerUtils;
import org.chromium.chrome.browser.quickactionsearchwidget.QuickActionSearchWidgetProvider; import org.chromium.chrome.browser.quickactionsearchwidget.QuickActionSearchWidgetProvider;
import org.chromium.chrome.browser.rlz.RevenueStats; import org.chromium.chrome.browser.rlz.RevenueStats;
@ -432,7 +433,7 @@ public class ProcessInitializationHandler {
new Runnable() { new Runnable() {
@Override @Override
public void run() { public void run() {
SigninCheckerProvider.get(Profile.getLastUsedRegularProfile()) SigninCheckerProvider.get(ProfileManager.getLastUsedRegularProfile())
.onMainActivityStart(); .onMainActivityStart();
RevenueStats.getInstance().retrieveAndApplyTrackingIds(); RevenueStats.getInstance().retrieveAndApplyTrackingIds();
} }
@ -489,7 +490,7 @@ public class ProcessInitializationHandler {
() -> { () -> {
// OptimizationTypes which we give a guarantee will be registered when we pass // OptimizationTypes which we give a guarantee will be registered when we pass
// the onDeferredStartup() signal to OptimizationGuide. // the onDeferredStartup() signal to OptimizationGuide.
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
List<HintsProto.OptimizationType> registeredTypesAllowList = new ArrayList<>(); List<HintsProto.OptimizationType> registeredTypesAllowList = new ArrayList<>();
registeredTypesAllowList.addAll( registeredTypesAllowList.addAll(
ShoppingPersistedTabData.getShoppingHintsToRegisterOnDeferredStartup( ShoppingPersistedTabData.getShoppingHintsToRegisterOnDeferredStartup(
@ -508,7 +509,7 @@ public class ProcessInitializationHandler {
() -> { () -> {
if (ChromeFeatureList.isEnabled(ChromeFeatureList.FEATURE_NOTIFICATION_GUIDE)) { if (ChromeFeatureList.isEnabled(ChromeFeatureList.FEATURE_NOTIFICATION_GUIDE)) {
FeatureNotificationGuideServiceFactory.getForProfile( FeatureNotificationGuideServiceFactory.getForProfile(
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
} }
}); });
deferredStartupHandler.addDeferredTask( deferredStartupHandler.addDeferredTask(

@ -42,6 +42,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager; import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
import org.chromium.chrome.browser.usage_stats.UsageStatsService; import org.chromium.chrome.browser.usage_stats.UsageStatsService;
import org.chromium.chrome.browser.webapps.ChromeWebApkHost; import org.chromium.chrome.browser.webapps.ChromeWebApkHost;
@ -592,7 +593,7 @@ public class NotificationPlatformBridge {
final boolean silent, final boolean silent,
final ActionInfo[] actions) { final ActionInfo[] actions) {
final boolean vibrateEnabled = final boolean vibrateEnabled =
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.getBoolean(NOTIFICATIONS_VIBRATE_ENABLED); .getBoolean(NOTIFICATIONS_VIBRATE_ENABLED);
final boolean incognito = profile.isOffTheRecord(); final boolean incognito = profile.isOffTheRecord();
// TODO(peter): by-pass this check for non-Web Notification types. // TODO(peter): by-pass this check for non-Web Notification types.
@ -1203,7 +1204,7 @@ public class NotificationPlatformBridge {
NotificationIdentifyingAttributes identifyingAttributes) { NotificationIdentifyingAttributes identifyingAttributes) {
// TODO(crbug.com/1521432): Verify if we can/need to use the correct profile here. // TODO(crbug.com/1521432): Verify if we can/need to use the correct profile here.
NotificationSuspender suspender = NotificationSuspender suspender =
new NotificationSuspender(Profile.getLastUsedRegularProfile()); new NotificationSuspender(ProfileManager.getLastUsedRegularProfile());
List<String> notificationIdsToCancel = List<String> notificationIdsToCancel =
suspender.storeNotificationResourcesFromOrigins( suspender.storeNotificationResourcesFromOrigins(
Collections.singletonList(Uri.parse(identifyingAttributes.origin))); Collections.singletonList(Uri.parse(identifyingAttributes.origin)));
@ -1236,7 +1237,7 @@ public class NotificationPlatformBridge {
// TODO(crbug.com/1521432): Verify if we can/need to use the correct profile here. // TODO(crbug.com/1521432): Verify if we can/need to use the correct profile here.
NotificationSuspender suspender = NotificationSuspender suspender =
new NotificationSuspender(Profile.getLastUsedRegularProfile()); new NotificationSuspender(ProfileManager.getLastUsedRegularProfile());
suspender.unsuspendNotificationsFromOrigins( suspender.unsuspendNotificationsFromOrigins(
Collections.singletonList(Uri.parse(identifyingAttributes.origin))); Collections.singletonList(Uri.parse(identifyingAttributes.origin)));
} }

@ -11,7 +11,7 @@ import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.segmentation_platform.SegmentationPlatformServiceFactory; import org.chromium.chrome.browser.segmentation_platform.SegmentationPlatformServiceFactory;
import org.chromium.components.segmentation_platform.PredictionOptions; import org.chromium.components.segmentation_platform.PredictionOptions;
import org.chromium.components.segmentation_platform.SegmentationPlatformService; import org.chromium.components.segmentation_platform.SegmentationPlatformService;
@ -121,7 +121,7 @@ public class FeedPositionUtils {
public static void cacheSegmentationResult() { public static void cacheSegmentationResult() {
SegmentationPlatformService segmentationPlatformService = SegmentationPlatformService segmentationPlatformService =
SegmentationPlatformServiceFactory.getForProfile( SegmentationPlatformServiceFactory.getForProfile(
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
PredictionOptions options = new PredictionOptions(/* onDemandExecution= */ false); PredictionOptions options = new PredictionOptions(/* onDemandExecution= */ false);
segmentationPlatformService.getClassificationResult( segmentationPlatformService.getClassificationResult(
FEED_USER_SEGMENT_KEY, FEED_USER_SEGMENT_KEY,

@ -46,6 +46,7 @@ import org.chromium.chrome.browser.logo.LogoView;
import org.chromium.chrome.browser.ntp.NewTabPage.OnSearchBoxScrollListener; import org.chromium.chrome.browser.ntp.NewTabPage.OnSearchBoxScrollListener;
import org.chromium.chrome.browser.ntp.search.SearchBoxCoordinator; import org.chromium.chrome.browser.ntp.search.SearchBoxCoordinator;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.suggestions.tile.MostVisitedTilesCoordinator; import org.chromium.chrome.browser.suggestions.tile.MostVisitedTilesCoordinator;
import org.chromium.chrome.browser.suggestions.tile.TileGroup; import org.chromium.chrome.browser.suggestions.tile.TileGroup;
import org.chromium.chrome.browser.suggestions.tile.TileGroup.Delegate; import org.chromium.chrome.browser.suggestions.tile.TileGroup.Delegate;
@ -247,7 +248,7 @@ public class NewTabPageLayout extends LinearLayout {
mIsNtpAsHomeSurfaceOnTablet = isNtpAsHomeSurfaceOnTablet; mIsNtpAsHomeSurfaceOnTablet = isNtpAsHomeSurfaceOnTablet;
mIsSurfacePolishEnabled = isSurfacePolishEnabled; mIsSurfacePolishEnabled = isSurfacePolishEnabled;
mIsSurfacePolishOmniboxColorEnabled = isSurfacePolishOmniboxColorEnabled; mIsSurfacePolishOmniboxColorEnabled = isSurfacePolishOmniboxColorEnabled;
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
mIsTablet = isTablet; mIsTablet = isTablet;
mTabStripHeightSupplier = tabStripHeightSupplier; mTabStripHeightSupplier = tabStripHeightSupplier;

@ -32,6 +32,7 @@ import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitio
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabLaunchType;
import org.chromium.components.browser_ui.notifications.NotificationManagerProxy; import org.chromium.components.browser_ui.notifications.NotificationManagerProxy;
import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl; import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl;
@ -294,7 +295,7 @@ public class AutoFetchNotifier {
showCompleteNotificationWithParams( showCompleteNotificationWithParams(
pageTitle, tabId, offlineId, originalUrl, finalUrl, params); pageTitle, tabId, offlineId, originalUrl, finalUrl, params);
}, },
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
} }
private static void showCompleteNotificationWithParams( private static void showCompleteNotificationWithParams(
@ -384,7 +385,7 @@ public class AutoFetchNotifier {
private static void cancelInProgress() { private static void cancelInProgress() {
// Using regular profile here, since this function is only called in regular mode. // Using regular profile here, since this function is only called in regular mode.
AutoFetchNotifierJni.get().cancelInProgress(Profile.getLastUsedRegularProfile()); AutoFetchNotifierJni.get().cancelInProgress(ProfileManager.getLastUsedRegularProfile());
} }
@NativeMethods @NativeMethods

@ -29,7 +29,7 @@ import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
import org.chromium.chrome.browser.download.DownloadManagerService; import org.chromium.chrome.browser.download.DownloadManagerService;
import org.chromium.chrome.browser.offlinepages.OfflinePageOrigin; import org.chromium.chrome.browser.offlinepages.OfflinePageOrigin;
import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; import org.chromium.chrome.browser.offlinepages.OfflinePageUtils;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.AsyncTabCreationParams; import org.chromium.chrome.browser.tabmodel.AsyncTabCreationParams;
@ -103,7 +103,7 @@ public class OfflinePageDownloadBridge {
openItemInNewTab(offlineId, params, isIncognito); openItemInNewTab(offlineId, params, isIncognito);
} }
}, },
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
} }
/** /**

@ -11,6 +11,7 @@ import org.jni_zero.NativeMethods;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.uid.SettingsSecureBasedIdentificationGenerator; import org.chromium.chrome.browser.uid.SettingsSecureBasedIdentificationGenerator;
import java.util.List; import java.util.List;
@ -39,7 +40,7 @@ public class RlzPingHandler {
RlzPingHandlerJni.get() RlzPingHandlerJni.get()
.startPing( .startPing(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
brand, brand,
Locale.getDefault().getLanguage(), Locale.getDefault().getLanguage(),
TextUtils.join(",", events), TextUtils.join(",", events),

@ -29,6 +29,7 @@ import org.chromium.chrome.browser.bookmarks.BookmarkModel;
import org.chromium.chrome.browser.commerce.PriceTrackingUtils; import org.chromium.chrome.browser.commerce.PriceTrackingUtils;
import org.chromium.chrome.browser.commerce.PriceTrackingUtilsJni; import org.chromium.chrome.browser.commerce.PriceTrackingUtilsJni;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.segmentation_platform.ContextualPageActionController.ActionProvider; import org.chromium.chrome.browser.segmentation_platform.ContextualPageActionController.ActionProvider;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkId;
@ -134,7 +135,7 @@ public class PriceTrackingActionProviderTest {
SignalAccumulator accumulator = new SignalAccumulator(new Handler(), mMockTab, providers); SignalAccumulator accumulator = new SignalAccumulator(new Handler(), mMockTab, providers);
// URL supports price tracking. // URL supports price tracking.
setIsUrlPriceTrackableResult(true); setIsUrlPriceTrackableResult(true);
Profile.setLastUsedProfileForTesting(mProfile); ProfileManager.setLastUsedProfileForTesting(mProfile);
// URL is already bookmarked. // URL is already bookmarked.
doReturn(new BookmarkId(1L, 0)).when(mBookmarkModel).getUserBookmarkIdForTab(mMockTab); doReturn(new BookmarkId(1L, 0)).when(mBookmarkModel).getUserBookmarkIdForTab(mMockTab);
// Bookmark has price tracking information. // Bookmark has price tracking information.
@ -153,7 +154,7 @@ public class PriceTrackingActionProviderTest {
SignalAccumulator accumulator = new SignalAccumulator(new Handler(), mMockTab, providers); SignalAccumulator accumulator = new SignalAccumulator(new Handler(), mMockTab, providers);
// URL does not support price tracking. // URL does not support price tracking.
setIsUrlPriceTrackableResult(false); setIsUrlPriceTrackableResult(false);
Profile.setLastUsedProfileForTesting(mProfile); ProfileManager.setLastUsedProfileForTesting(mProfile);
// URL is bookmarked. // URL is bookmarked.
doReturn(new BookmarkId(1L, 0)).when(mBookmarkModel).getUserBookmarkIdForTab(mMockTab); doReturn(new BookmarkId(1L, 0)).when(mBookmarkModel).getUserBookmarkIdForTab(mMockTab);
// Bookmark has no price tracking information. // Bookmark has no price tracking information.

@ -62,6 +62,7 @@ import org.chromium.chrome.browser.privacy_guide.PrivacyGuideFragment;
import org.chromium.chrome.browser.privacy_sandbox.ChromeTrackingProtectionDelegate; import org.chromium.chrome.browser.privacy_sandbox.ChromeTrackingProtectionDelegate;
import org.chromium.chrome.browser.privacy_sandbox.PrivacySandboxSettingsBaseFragment; import org.chromium.chrome.browser.privacy_sandbox.PrivacySandboxSettingsBaseFragment;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.profiles.ProfileManagerUtils; import org.chromium.chrome.browser.profiles.ProfileManagerUtils;
import org.chromium.chrome.browser.safe_browsing.settings.SafeBrowsingSettingsFragmentBase; import org.chromium.chrome.browser.safe_browsing.settings.SafeBrowsingSettingsFragmentBase;
import org.chromium.chrome.browser.safety_check.SafetyCheckBridge; import org.chromium.chrome.browser.safety_check.SafetyCheckBridge;
@ -160,7 +161,7 @@ public class SettingsActivity extends ChromeBaseAppCompatActivity
// killed, or for tests. This should happen before super.onCreate() because it might // killed, or for tests. This should happen before super.onCreate() because it might
// recreate a fragment, and a fragment might depend on the native library. // recreate a fragment, and a fragment might depend on the native library.
ChromeBrowserInitializer.getInstance().handleSynchronousStartup(); ChromeBrowserInitializer.getInstance().handleSynchronousStartup();
mProfile = Profile.getLastUsedRegularProfile(); mProfile = ProfileManager.getLastUsedRegularProfile();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

@ -9,6 +9,7 @@ import org.jni_zero.NativeMethods;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.sync.protocol.SharingSpecificFields; import org.chromium.components.sync.protocol.SharingSpecificFields;
import org.chromium.components.sync_device_info.FormFactor; import org.chromium.components.sync_device_info.FormFactor;
@ -31,7 +32,7 @@ public class SharingServiceProxy {
if (sNativeSharingServiceProxyAndroid == 0) { if (sNativeSharingServiceProxyAndroid == 0) {
// The service hasn't been created yet. // The service hasn't been created yet.
Natives jni = SharingServiceProxyJni.get(); Natives jni = SharingServiceProxyJni.get();
jni.initSharingService(Profile.getLastUsedRegularProfile()); jni.initSharingService(ProfileManager.getLastUsedRegularProfile());
} }
sInstance = new SharingServiceProxy(); sInstance = new SharingServiceProxy();

@ -11,7 +11,7 @@ import androidx.annotation.Nullable;
import org.chromium.base.ResettersForTesting; import org.chromium.base.ResettersForTesting;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
import org.chromium.chrome.browser.signin.services.SigninManager; import org.chromium.chrome.browser.signin.services.SigninManager;
import org.chromium.chrome.browser.ui.signin.SyncConsentActivityLauncher; import org.chromium.chrome.browser.ui.signin.SyncConsentActivityLauncher;
@ -93,7 +93,7 @@ public final class SyncConsentActivityLauncherImpl implements SyncConsentActivit
public boolean launchActivityIfAllowed(Context context, @SigninAccessPoint int accessPoint) { public boolean launchActivityIfAllowed(Context context, @SigninAccessPoint int accessPoint) {
SigninManager signinManager = SigninManager signinManager =
IdentityServicesProvider.get() IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile()); .getSigninManager(ProfileManager.getLastUsedRegularProfile());
if (signinManager.isSyncOptInAllowed()) { if (signinManager.isSyncOptInAllowed()) {
launchInternal(context, SyncConsentFragmentBase.createArguments(accessPoint, null)); launchInternal(context, SyncConsentFragmentBase.createArguments(accessPoint, null));
return true; return true;

@ -35,6 +35,7 @@ import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityPreferencesManager; import org.chromium.chrome.browser.ui.searchactivityutils.SearchActivityPreferencesManager;
import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.settings.SettingsLauncher;
@ -189,7 +190,7 @@ public class ManageSpaceActivity extends AppCompatActivity implements View.OnCli
/** This refreshes the storage numbers by fetching all site permissions. */ /** This refreshes the storage numbers by fetching all site permissions. */
private void refreshStorageNumbers() { private void refreshStorageNumbers() {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(profile); WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(profile);
fetcher.fetchPreferencesForCategory( fetcher.fetchPreferencesForCategory(
SiteSettingsCategory.createFromType(profile, SiteSettingsCategory.Type.USE_STORAGE), SiteSettingsCategory.createFromType(profile, SiteSettingsCategory.Type.USE_STORAGE),
@ -299,7 +300,7 @@ public class ManageSpaceActivity extends AppCompatActivity implements View.OnCli
* asynchronously, and at the end we update the UI with the new storage numbers. * asynchronously, and at the end we update the UI with the new storage numbers.
*/ */
public void clearData() { public void clearData() {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(profile, true); WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(profile, true);
fetcher.fetchPreferencesForCategory( fetcher.fetchPreferencesForCategory(
SiteSettingsCategory.createFromType( SiteSettingsCategory.createFromType(
@ -322,7 +323,7 @@ public class ManageSpaceActivity extends AppCompatActivity implements View.OnCli
if (site.getLocalStorageInfo() == null if (site.getLocalStorageInfo() == null
|| !site.getLocalStorageInfo().isDomainImportant()) { || !site.getLocalStorageInfo().isDomainImportant()) {
mNumSitesClearing++; mNumSitesClearing++;
site.clearAllStoredData(Profile.getLastUsedRegularProfile(), this); site.clearAllStoredData(ProfileManager.getLastUsedRegularProfile(), this);
} else { } else {
siteStorageLeft += site.getTotalUsage(); siteStorageLeft += site.getTotalUsage();
} }

@ -9,7 +9,7 @@ import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.user_prefs.UserPrefs; import org.chromium.components.user_prefs.UserPrefs;
/** Exposes methods to report suggestions related events, for UMA or Fetch scheduling purposes. */ /** Exposes methods to report suggestions related events, for UMA or Fetch scheduling purposes. */
@ -51,7 +51,7 @@ public abstract class SuggestionsMetrics {
public static void recordArticlesListVisible() { public static void recordArticlesListVisible() {
RecordHistogram.recordBooleanHistogram( RecordHistogram.recordBooleanHistogram(
"NewTabPage.ContentSuggestions.ArticlesListVisible", "NewTabPage.ContentSuggestions.ArticlesListVisible",
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.getBoolean(Pref.ARTICLES_LIST_VISIBLE)); .getBoolean(Pref.ARTICLES_LIST_VISIBLE));
} }
} }

@ -19,6 +19,7 @@ import org.chromium.chrome.browser.lifecycle.ConfigurationChangedObserver;
import org.chromium.chrome.browser.native_page.ContextMenuManager; import org.chromium.chrome.browser.native_page.ContextMenuManager;
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.suggestions.SuggestionsConfig; import org.chromium.chrome.browser.suggestions.SuggestionsConfig;
import org.chromium.chrome.browser.suggestions.SuggestionsDependencyFactory; import org.chromium.chrome.browser.suggestions.SuggestionsDependencyFactory;
import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate; import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
@ -140,7 +141,7 @@ public class MostVisitedTilesCoordinator implements ConfigurationChangedObserver
TileGroup.Delegate tileGroupDelegate, TileGroup.Delegate tileGroupDelegate,
TouchEnabledDelegate touchEnabledDelegate) { TouchEnabledDelegate touchEnabledDelegate) {
mActivityLifecycleDispatcher.register(this); mActivityLifecycleDispatcher.register(this);
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
if (mRenderer == null) { if (mRenderer == null) {
mRenderer = mRenderer =
new TileRenderer( new TileRenderer(

@ -25,7 +25,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.native_page.ContextMenuManager; import org.chromium.chrome.browser.native_page.ContextMenuManager;
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.suggestions.SiteSuggestion; import org.chromium.chrome.browser.suggestions.SiteSuggestion;
import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate; import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
@ -142,7 +142,7 @@ public class MostVisitedTilesMediator implements TileGroup.Observer, TemplateUrl
mTileGroup.startObserving(MAX_RESULTS); mTileGroup.startObserving(MAX_RESULTS);
mTemplateUrlService = mTemplateUrlService =
TemplateUrlServiceFactory.getForProfile(Profile.getLastUsedRegularProfile()); TemplateUrlServiceFactory.getForProfile(ProfileManager.getLastUsedRegularProfile());
mTemplateUrlService.addObserver(this); mTemplateUrlService.addObserver(this);
onSearchEngineHasLogoChanged(); onSearchEngineHasLogoChanged();

@ -25,7 +25,7 @@ import org.chromium.base.task.TaskTraits;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.omnibox.suggestions.mostvisited.SuggestTileType; import org.chromium.chrome.browser.omnibox.suggestions.mostvisited.SuggestTileType;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.suggestions.ImageFetcher; import org.chromium.chrome.browser.suggestions.ImageFetcher;
import org.chromium.chrome.browser.suggestions.SiteSuggestion; import org.chromium.chrome.browser.suggestions.SiteSuggestion;
@ -172,7 +172,8 @@ public class TileRenderer {
/** Record that a tile was clicked for IPH reasons. */ /** Record that a tile was clicked for IPH reasons. */
private void recordTileClickedForIPH(String eventName) { private void recordTileClickedForIPH(String eventName) {
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile()); Tracker tracker =
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
tracker.notifyEvent(eventName); tracker.notifyEvent(eventName);
} }
@ -253,7 +254,7 @@ public class TileRenderer {
/** @return True, if the tile represents a Search query. */ /** @return True, if the tile represents a Search query. */
private boolean isSearchTile(Tile tile) { private boolean isSearchTile(Tile tile) {
TemplateUrlService searchService = TemplateUrlService searchService =
TemplateUrlServiceFactory.getForProfile(Profile.getLastUsedRegularProfile()); TemplateUrlServiceFactory.getForProfile(ProfileManager.getLastUsedRegularProfile());
return searchService != null return searchService != null
&& searchService.isSearchResultsPageFromDefaultSearchProvider(tile.getUrl()); && searchService.isSearchResultsPageFromDefaultSearchProvider(tile.getUrl());
} }

@ -17,6 +17,7 @@ import androidx.fragment.app.FragmentTransaction;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
import org.chromium.chrome.browser.sync.SyncErrorNotifier; import org.chromium.chrome.browser.sync.SyncErrorNotifier;
import org.chromium.chrome.browser.sync.SyncServiceFactory; import org.chromium.chrome.browser.sync.SyncServiceFactory;
@ -48,7 +49,7 @@ public class PassphraseActivity extends AppCompatActivity
// During a normal user flow the ChromeTabbedActivity would start the Chrome browser // During a normal user flow the ChromeTabbedActivity would start the Chrome browser
// process and this wouldn't be necessary. // process and this wouldn't be necessary.
ChromeBrowserInitializer.getInstance().handleSynchronousStartup(); ChromeBrowserInitializer.getInstance().handleSynchronousStartup();
mProfile = Profile.getLastUsedRegularProfile(); mProfile = ProfileManager.getLastUsedRegularProfile();
mIdentityManager = IdentityServicesProvider.get().getIdentityManager(mProfile); mIdentityManager = IdentityServicesProvider.get().getIdentityManager(mProfile);
mSyncService = SyncServiceFactory.getForProfile(mProfile); mSyncService = SyncServiceFactory.getForProfile(mProfile);
assert mSyncService != null; assert mSyncService != null;

@ -55,6 +55,7 @@ import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.preferences.PrefChangeRegistrar; import org.chromium.chrome.browser.preferences.PrefChangeRegistrar;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.segmentation_platform.SegmentationPlatformServiceFactory; import org.chromium.chrome.browser.segmentation_platform.SegmentationPlatformServiceFactory;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabLaunchType;
@ -843,7 +844,7 @@ public final class ReturnToChromeUtil {
public static void cacheReturnTimeFromSegmentation() { public static void cacheReturnTimeFromSegmentation() {
SegmentationPlatformService segmentationPlatformService = SegmentationPlatformService segmentationPlatformService =
SegmentationPlatformServiceFactory.getForProfile( SegmentationPlatformServiceFactory.getForProfile(
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
PredictionOptions predictionOptions = new PredictionOptions(false); PredictionOptions predictionOptions = new PredictionOptions(false);
segmentationPlatformService.getClassificationResult( segmentationPlatformService.getClassificationResult(
START_V2_SEGMENTATION_PLATFORM_KEY, START_V2_SEGMENTATION_PLATFORM_KEY,
@ -902,7 +903,7 @@ public final class ReturnToChromeUtil {
} }
private static void updateFeedVisibility() { private static void updateFeedVisibility() {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
ChromeSharedPreferences.getInstance() ChromeSharedPreferences.getInstance()
.writeBoolean( .writeBoolean(
ChromePreferenceKeys.FEED_ARTICLES_LIST_VISIBLE, ChromePreferenceKeys.FEED_ARTICLES_LIST_VISIBLE,

@ -100,6 +100,7 @@ import org.chromium.chrome.browser.password_manager.PasswordManagerLauncher;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.price_tracking.PriceTrackingButtonController; import org.chromium.chrome.browser.price_tracking.PriceTrackingButtonController;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.quick_delete.QuickDeleteController; import org.chromium.chrome.browser.quick_delete.QuickDeleteController;
import org.chromium.chrome.browser.quick_delete.QuickDeleteDelegateImpl; import org.chromium.chrome.browser.quick_delete.QuickDeleteDelegateImpl;
import org.chromium.chrome.browser.readaloud.ReadAloudController; import org.chromium.chrome.browser.readaloud.ReadAloudController;
@ -547,7 +548,7 @@ public class RootUiCoordinator
@Override @Override
public BrowserContextHandle getBrowserContextHandle() { public BrowserContextHandle getBrowserContextHandle() {
return Profile.getLastUsedRegularProfile(); return ProfileManager.getLastUsedRegularProfile();
} }
}); });
mFoldTransitionController = mFoldTransitionController =
@ -872,7 +873,7 @@ public class RootUiCoordinator
if (DeviceFormFactor.isWindowOnTablet(mWindowAndroid) if (DeviceFormFactor.isWindowOnTablet(mWindowAndroid)
&& (RequestDesktopUtils.maybeDefaultEnableGlobalSetting( && (RequestDesktopUtils.maybeDefaultEnableGlobalSetting(
getPrimaryDisplaySizeInInches(), getPrimaryDisplaySizeInInches(),
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
mActivity))) { mActivity))) {
// TODO(crbug.com/1350274): Remove this explicit load when this bug is addressed. // TODO(crbug.com/1350274): Remove this explicit load when this bug is addressed.
if (mActivityTabProvider != null && mActivityTabProvider.get() != null) { if (mActivityTabProvider != null && mActivityTabProvider.get() != null) {
@ -883,7 +884,7 @@ public class RootUiCoordinator
} }
RequestDesktopUtils.maybeDefaultEnableWindowSetting( RequestDesktopUtils.maybeDefaultEnableWindowSetting(
mActivity, Profile.getLastUsedRegularProfile()); mActivity, ProfileManager.getLastUsedRegularProfile());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.READALOUD)) { if (ChromeFeatureList.isEnabled(ChromeFeatureList.READALOUD)) {
TabModelSelector tabModelSelector = mTabModelSelectorSupplier.get(); TabModelSelector tabModelSelector = mTabModelSelectorSupplier.get();
@ -1001,7 +1002,7 @@ public class RootUiCoordinator
} }
private void initMerchantTrustSignals() { private void initMerchantTrustSignals() {
if (ShoppingServiceFactory.getForProfile(Profile.getLastUsedRegularProfile()) if (ShoppingServiceFactory.getForProfile(ProfileManager.getLastUsedRegularProfile())
.isMerchantViewerEnabled() .isMerchantViewerEnabled()
&& shouldInitializeMerchantTrustSignals()) { && shouldInitializeMerchantTrustSignals()) {
MerchantTrustSignalsCoordinator merchantTrustSignalsCoordinator = MerchantTrustSignalsCoordinator merchantTrustSignalsCoordinator =

@ -19,6 +19,7 @@ import org.chromium.chrome.browser.AppHooks;
import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.components.user_prefs.UserPrefs; import org.chromium.components.user_prefs.UserPrefs;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@ -80,7 +81,7 @@ public class UsageStatsService {
@VisibleForTesting @VisibleForTesting
UsageStatsService() { UsageStatsService() {
mProfile = Profile.getLastUsedRegularProfile(); mProfile = ProfileManager.getLastUsedRegularProfile();
mBridge = new UsageStatsBridge(mProfile, this); mBridge = new UsageStatsBridge(mProfile, this);
mEventTracker = new EventTracker(mBridge); mEventTracker = new EventTracker(mBridge);
mSuspensionTracker = new SuspensionTracker(mBridge, mProfile); mSuspensionTracker = new SuspensionTracker(mBridge, mProfile);

@ -21,7 +21,7 @@ import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeBrowserTestRule; import org.chromium.chrome.test.ChromeBrowserTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.components.image_fetcher.ImageFetcher; import org.chromium.components.image_fetcher.ImageFetcher;
@ -76,7 +76,7 @@ public class ImageFetcherIntegrationTest {
ImageFetcher imageFetcher = ImageFetcher imageFetcher =
ImageFetcherFactory.createImageFetcher( ImageFetcherFactory.createImageFetcher(
ImageFetcherConfig.NETWORK_ONLY, ImageFetcherConfig.NETWORK_ONLY,
Profile.getLastUsedRegularProfile().getProfileKey()); ProfileManager.getLastUsedRegularProfile().getProfileKey());
imageFetcher.fetchImage(params, callbackWaiter); imageFetcher.fetchImage(params, callbackWaiter);
return null; return null;
} }

@ -11,6 +11,7 @@ import org.jni_zero.NativeMethods;
import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CallbackHelper;
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils;
/** Static methods for use in tests to manipulate the PWA App list for restoring. */ /** Static methods for use in tests to manipulate the PWA App list for restoring. */
@ -24,7 +25,7 @@ public class PwaRestoreBottomSheetTestUtils {
ChromeBrowserInitializer.getInstance().handleSynchronousStartup(); ChromeBrowserInitializer.getInstance().handleSynchronousStartup();
PwaRestoreBottomSheetTestUtilsJni.get() PwaRestoreBottomSheetTestUtilsJni.get()
.waitForWebApkDatabaseInitialization( .waitForWebApkDatabaseInitialization(
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
}); });
sCallbackHelper.waitForNext(); sCallbackHelper.waitForNext();
} }
@ -36,7 +37,9 @@ public class PwaRestoreBottomSheetTestUtils {
() -> { () -> {
PwaRestoreBottomSheetTestUtilsJni.get() PwaRestoreBottomSheetTestUtilsJni.get()
.setAppListForRestoring( .setAppListForRestoring(
appList, lastUsedInDays, Profile.getLastUsedRegularProfile()); appList,
lastUsedInDays,
ProfileManager.getLastUsedRegularProfile());
}); });
} }

@ -28,7 +28,7 @@ import org.chromium.base.test.util.Criteria;
import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.CriteriaHelper;
import org.chromium.chrome.browser.app.metrics.LaunchCauseMetrics; import org.chromium.chrome.browser.app.metrics.LaunchCauseMetrics;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.share.ShareHelper; import org.chromium.chrome.browser.share.ShareHelper;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
@ -58,7 +58,7 @@ public class ShareIntentTest {
ThreadUtils.runOnUiThreadBlocking( ThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
ShareHelper.setLastShareComponentName( ShareHelper.setLastShareComponentName(
Profile.getLastUsedRegularProfile(), target); ProfileManager.getLastUsedRegularProfile(), target);
mActivityTestRule mActivityTestRule
.getActivity() .getActivity()
.onMenuOrKeyboardAction(R.id.direct_share_menu_id, true); .onMenuOrKeyboardAction(R.id.direct_share_menu_id, true);

@ -27,7 +27,7 @@ import org.chromium.base.test.util.CriteriaNotSatisfiedException;
import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.DisabledTest;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.components.prefs.PrefService; import org.chromium.components.prefs.PrefService;
@ -56,7 +56,7 @@ public class VirtualKeyboardResizeTest {
private EmbeddedTestServer mTestServer; private EmbeddedTestServer mTestServer;
private static PrefService getPrefService() { private static PrefService getPrefService() {
return UserPrefs.get(Profile.getLastUsedRegularProfile()); return UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
} }
@Before @Before

@ -42,6 +42,7 @@ import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
import org.chromium.chrome.browser.profiles.OTRProfileID; import org.chromium.chrome.browser.profiles.OTRProfileID;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabLaunchType;
import org.chromium.chrome.browser.tabmodel.TabCreator; import org.chromium.chrome.browser.tabmodel.TabCreator;
@ -232,7 +233,7 @@ public class WarmupManagerTest {
(Callable<Profile>) (Callable<Profile>)
() -> { () -> {
OTRProfileID otrProfileID = OTRProfileID.createUnique("CCT:Incognito"); OTRProfileID otrProfileID = OTRProfileID.createUnique("CCT:Incognito");
return Profile.getLastUsedRegularProfile() return ProfileManager.getLastUsedRegularProfile()
.getOffTheRecordProfile( .getOffTheRecordProfile(
otrProfileID, /* createIfNeeded= */ true); otrProfileID, /* createIfNeeded= */ true);
}); });
@ -242,13 +243,13 @@ public class WarmupManagerTest {
return TestThreadUtils.runOnUiThreadBlockingNoException( return TestThreadUtils.runOnUiThreadBlockingNoException(
(Callable<Profile>) (Callable<Profile>)
() -> () ->
Profile.getLastUsedRegularProfile() ProfileManager.getLastUsedRegularProfile()
.getPrimaryOTRProfile(/* createIfNeeded= */ true)); .getPrimaryOTRProfile(/* createIfNeeded= */ true));
} }
private static Profile getRegularProfile() { private static Profile getRegularProfile() {
return TestThreadUtils.runOnUiThreadBlockingNoException( return TestThreadUtils.runOnUiThreadBlockingNoException(
(Callable<Profile>) () -> Profile.getLastUsedRegularProfile()); (Callable<Profile>) () -> ProfileManager.getLastUsedRegularProfile());
} }
private static Profile getProfile(ProfileType profileType) { private static Profile getProfile(ProfileType profileType) {

@ -20,7 +20,7 @@ import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeBrowserTestRule; import org.chromium.chrome.test.ChromeBrowserTestRule;
import org.chromium.components.browser_ui.accessibility.FontSizePrefs; import org.chromium.components.browser_ui.accessibility.FontSizePrefs;
import org.chromium.components.browser_ui.accessibility.FontSizePrefs.FontSizePrefsObserver; import org.chromium.components.browser_ui.accessibility.FontSizePrefs.FontSizePrefsObserver;
@ -190,7 +190,7 @@ public class FontSizePrefsTest {
private FontSizePrefs getFontSizePrefs(final Context context) { private FontSizePrefs getFontSizePrefs(final Context context) {
return TestThreadUtils.runOnUiThreadBlockingNoException( return TestThreadUtils.runOnUiThreadBlockingNoException(
() -> FontSizePrefs.getInstance(Profile.getLastUsedRegularProfile())); () -> FontSizePrefs.getInstance(ProfileManager.getLastUsedRegularProfile()));
} }
private TestingObserver createAndAddFontSizePrefsObserver() { private TestingObserver createAndAddFontSizePrefsObserver() {

@ -41,7 +41,7 @@ import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.Features; import org.chromium.base.test.util.Features;
import org.chromium.base.test.util.Features.DisableFeatures; import org.chromium.base.test.util.Features.DisableFeatures;
import org.chromium.base.test.util.Features.EnableFeatures; import org.chromium.base.test.util.Features.EnableFeatures;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.settings.SettingsActivityTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.R; import org.chromium.chrome.test.R;
@ -522,7 +522,7 @@ public class AccessibilitySettingsTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
FontSizePrefs fontSizePrefs = FontSizePrefs fontSizePrefs =
FontSizePrefs.getInstance(Profile.getLastUsedRegularProfile()); FontSizePrefs.getInstance(ProfileManager.getLastUsedRegularProfile());
Assert.assertEquals( Assert.assertEquals(
expectedForceEnableZoom, fontSizePrefs.getForceEnableZoom()); expectedForceEnableZoom, fontSizePrefs.getForceEnableZoom());
Assert.assertEquals( Assert.assertEquals(

@ -43,7 +43,7 @@ import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.layouts.LayoutTestUtils; import org.chromium.chrome.browser.layouts.LayoutTestUtils;
import org.chromium.chrome.browser.layouts.LayoutType; import org.chromium.chrome.browser.layouts.LayoutType;
import org.chromium.chrome.browser.layouts.animation.CompositorAnimationHandler; import org.chromium.chrome.browser.layouts.animation.CompositorAnimationHandler;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.quick_delete.QuickDeleteMetricsDelegate; import org.chromium.chrome.browser.quick_delete.QuickDeleteMetricsDelegate;
import org.chromium.chrome.browser.sync.FakeSyncServiceImpl; import org.chromium.chrome.browser.sync.FakeSyncServiceImpl;
import org.chromium.chrome.browser.sync.SyncServiceFactory; import org.chromium.chrome.browser.sync.SyncServiceFactory;
@ -130,7 +130,7 @@ public class TabbedAppMenuTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
WebsitePreferenceBridge.setCategoryEnabled( WebsitePreferenceBridge.setCategoryEnabled(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
ContentSettingsType.REQUEST_DESKTOP_SITE, ContentSettingsType.REQUEST_DESKTOP_SITE,
false); false);
}); });
@ -358,7 +358,7 @@ public class TabbedAppMenuTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
WebsitePreferenceBridge.setCategoryEnabled( WebsitePreferenceBridge.setCategoryEnabled(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
ContentSettingsType.REQUEST_DESKTOP_SITE, ContentSettingsType.REQUEST_DESKTOP_SITE,
true); true);
tab.reload(); tab.reload();

@ -34,7 +34,7 @@ import org.chromium.base.test.util.RequiresRestart;
import org.chromium.chrome.browser.bookmarks.BookmarkModel; import org.chromium.chrome.browser.bookmarks.BookmarkModel;
import org.chromium.chrome.browser.bookmarks.BookmarkModelObserver; import org.chromium.chrome.browser.bookmarks.BookmarkModelObserver;
import org.chromium.chrome.browser.bookmarks.BookmarkModelTest; import org.chromium.chrome.browser.bookmarks.BookmarkModelTest;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeBrowserTestRule; import org.chromium.chrome.test.ChromeBrowserTestRule;
import org.chromium.chrome.test.util.BookmarkTestUtil; import org.chromium.chrome.test.util.BookmarkTestUtil;
import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkId;
@ -79,7 +79,8 @@ public class BookmarkEditTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
sBookmarkModel = sBookmarkModel =
BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile()); BookmarkModel.getForProfile(
ProfileManager.getLastUsedRegularProfile());
sBookmarkModel.loadEmptyPartnerBookmarkShimForTesting(); sBookmarkModel.loadEmptyPartnerBookmarkShimForTesting();
}); });

@ -49,7 +49,7 @@ import org.chromium.chrome.browser.bookmarks.BookmarkModelObserver;
import org.chromium.chrome.browser.bookmarks.BookmarkUtils; import org.chromium.chrome.browser.bookmarks.BookmarkUtils;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.util.BookmarkTestUtil; import org.chromium.chrome.test.util.BookmarkTestUtil;
import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkId;
@ -92,7 +92,7 @@ public class BookmarkFolderPickerActivityTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
sBookmarkModel = sBookmarkModel =
BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile()); BookmarkModel.getForProfile(ProfileManager.getLastUsedRegularProfile());
sBookmarkModel.loadEmptyPartnerBookmarkShimForTesting(); sBookmarkModel.loadEmptyPartnerBookmarkShimForTesting();
}); });

@ -53,6 +53,7 @@ import org.chromium.chrome.browser.device_reauth.ReauthenticatorBridge;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.settings.SettingsActivity; import org.chromium.chrome.browser.settings.SettingsActivity;
import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.settings.SettingsActivityTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
@ -1152,7 +1153,7 @@ public class AutofillPaymentMethodsFragmentTest {
} }
private static PrefService getPrefService() { private static PrefService getPrefService() {
return UserPrefs.get(Profile.getLastUsedRegularProfile()); return UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
} }
private static Preference getFirstPaymentMethodPreference(SettingsActivity activity) { private static Preference getFirstPaymentMethodPreference(SettingsActivity activity) {

@ -20,7 +20,7 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.background_sync.BackgroundSyncBackgroundTaskScheduler.BackgroundSyncTask; import org.chromium.chrome.browser.background_sync.BackgroundSyncBackgroundTaskScheduler.BackgroundSyncTask;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
@ -234,7 +234,8 @@ public final class PeriodicBackgroundSyncTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
// TODO (https://crbug.com/1063807): Add incognito mode tests. // TODO (https://crbug.com/1063807): Add incognito mode tests.
SiteEngagementService.getForBrowserContext(Profile.getLastUsedRegularProfile()) SiteEngagementService.getForBrowserContext(
ProfileManager.getLastUsedRegularProfile())
.resetBaseScoreForUrl(url, engagement); .resetBaseScoreForUrl(url, engagement);
}); });
} }

@ -38,7 +38,7 @@ import org.chromium.base.test.util.Features.EnableFeatures;
import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.Restriction;
import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.sync.SyncTestRule; import org.chromium.chrome.browser.sync.SyncTestRule;
import org.chromium.chrome.browser.ui.signin.SyncPromoController.SyncPromoState; import org.chromium.chrome.browser.ui.signin.SyncPromoController.SyncPromoState;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
@ -72,7 +72,9 @@ public class AccountBookmarkTest {
BookmarkPromoHeader.forcePromoStateForTesting(SyncPromoState.NO_PROMO); BookmarkPromoHeader.forcePromoStateForTesting(SyncPromoState.NO_PROMO);
mBookmarkModel = mBookmarkModel =
runOnUiThreadBlocking( runOnUiThreadBlocking(
() -> BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile())); () ->
BookmarkModel.getForProfile(
ProfileManager.getLastUsedRegularProfile()));
mSyncTestRule.setUpAccountAndSignInForTesting(); mSyncTestRule.setUpAccountAndSignInForTesting();
mBookmarkManagerCoordinator = mBookmarkManagerCoordinator =
mBookmarkTestRule.showBookmarkManager(mSyncTestRule.getActivity()); mBookmarkTestRule.showBookmarkManager(mSyncTestRule.getActivity());

@ -19,6 +19,7 @@ import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.RequiresRestart; import org.chromium.base.test.util.RequiresRestart;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeBrowserTestRule; import org.chromium.chrome.test.ChromeBrowserTestRule;
import org.chromium.chrome.test.util.BookmarkTestUtil; import org.chromium.chrome.test.util.BookmarkTestUtil;
import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkId;
@ -47,7 +48,7 @@ public class BookmarkBridgeTest {
public void setUp() { public void setUp() {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
mBookmarkBridge = BookmarkBridge.getForProfile(profile); mBookmarkBridge = BookmarkBridge.getForProfile(profile);
mBookmarkBridge.loadFakePartnerBookmarkShimForTesting(); mBookmarkBridge.loadFakePartnerBookmarkShimForTesting();
}); });

@ -48,6 +48,7 @@ import org.chromium.chrome.browser.bookmarks.BookmarkUiPrefs.BookmarkRowDisplayP
import org.chromium.chrome.browser.feature_engagement.TrackerFactory; import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
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.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate; import org.chromium.chrome.test.ChromeJUnit4RunnerDelegate;
import org.chromium.chrome.test.util.ChromeRenderTestRule; import org.chromium.chrome.test.util.ChromeRenderTestRule;
import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkId;
@ -130,7 +131,7 @@ public class BookmarkFolderPickerRenderTest {
mActivity.setTheme(R.style.Theme_BrowserUI_DayNight); mActivity.setTheme(R.style.Theme_BrowserUI_DayNight);
// Setup profile-related factories. // Setup profile-related factories.
Profile.setLastUsedProfileForTesting(mProfile); ProfileManager.setLastUsedProfileForTesting(mProfile);
TrackerFactory.setTrackerForTests(mTracker); TrackerFactory.setTrackerForTests(mTracker);

@ -18,6 +18,7 @@ import org.chromium.base.test.UiThreadTest;
import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeBrowserTestRule; import org.chromium.chrome.test.ChromeBrowserTestRule;
import org.chromium.chrome.test.util.BookmarkTestUtil; import org.chromium.chrome.test.util.BookmarkTestUtil;
import org.chromium.components.bookmarks.BookmarkId; import org.chromium.components.bookmarks.BookmarkId;
@ -55,7 +56,7 @@ public class BookmarkModelTest {
public void setUp() { public void setUp() {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
mBookmarkModel = BookmarkModel.getForProfile(profile); mBookmarkModel = BookmarkModel.getForProfile(profile);
mBookmarkModel.loadEmptyPartnerBookmarkShimForTesting(); mBookmarkModel.loadEmptyPartnerBookmarkShimForTesting();
}); });

@ -41,6 +41,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.user_education.UserEducationHelper; import org.chromium.chrome.browser.user_education.UserEducationHelper;
import org.chromium.chrome.test.ChromeActivityTestRule; import org.chromium.chrome.test.ChromeActivityTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
@ -117,7 +118,7 @@ public class BookmarkSaveFlowTest {
mBottomSheetController, mBottomSheetController,
mShoppingService, mShoppingService,
mUserEducationHelper, mUserEducationHelper,
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
mIdentityManager); mIdentityManager);
}); });

@ -31,7 +31,7 @@ import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.UserActionTester; import org.chromium.base.test.util.UserActionTester;
import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabState; import org.chromium.chrome.browser.tab.TabState;
import org.chromium.chrome.browser.tab.TabStateExtractor; import org.chromium.chrome.browser.tab.TabStateExtractor;
@ -89,7 +89,7 @@ public class BrowsingDataBridgeTest {
private BrowsingDataBridge getBrowsingDataBridge() { private BrowsingDataBridge getBrowsingDataBridge() {
return ThreadUtils.runOnUiThreadBlockingNoException( return ThreadUtils.runOnUiThreadBlockingNoException(
() -> BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile())); () -> BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile()));
} }
/** Test no clear browsing data calls. */ /** Test no clear browsing data calls. */

@ -27,7 +27,7 @@ import org.chromium.chrome.browser.password_manager.FakePasswordStoreAndroidBack
import org.chromium.chrome.browser.password_manager.PasswordStoreAndroidBackendFactory; import org.chromium.chrome.browser.password_manager.PasswordStoreAndroidBackendFactory;
import org.chromium.chrome.browser.password_manager.PasswordStoreBridge; import org.chromium.chrome.browser.password_manager.PasswordStoreBridge;
import org.chromium.chrome.browser.password_manager.PasswordStoreCredential; import org.chromium.chrome.browser.password_manager.PasswordStoreCredential;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule;
@ -74,7 +74,7 @@ public class BrowsingDataTest {
CallbackHelper helper = new CallbackHelper(); CallbackHelper helper = new CallbackHelper();
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile()) BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
.clearBrowsingData( .clearBrowsingData(
helper::notifyCalled, new int[] {dataType}, timePeriod); helper::notifyCalled, new int[] {dataType}, timePeriod);
}); });
@ -95,7 +95,7 @@ public class BrowsingDataTest {
() -> { () -> {
counter[0] = counter[0] =
new BrowsingDataCounterBridge( new BrowsingDataCounterBridge(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
callback, callback,
BrowsingDataType.COOKIES, BrowsingDataType.COOKIES,
ClearBrowsingDataTab.ADVANCED); ClearBrowsingDataTab.ADVANCED);
@ -178,7 +178,7 @@ public class BrowsingDataTest {
CallbackHelper helper = new CallbackHelper(); CallbackHelper helper = new CallbackHelper();
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile()) BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
.clearBrowsingDataIncognitoForTesting( .clearBrowsingDataIncognitoForTesting(
helper::notifyCalled, helper::notifyCalled,
new int[] { new int[] {

@ -71,6 +71,7 @@ import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncher;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager; import org.chromium.chrome.browser.notifications.channels.SiteChannelsManager;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.settings.SettingsActivity; import org.chromium.chrome.browser.settings.SettingsActivity;
import org.chromium.chrome.browser.settings.SettingsActivityTestRule; import org.chromium.chrome.browser.settings.SettingsActivityTestRule;
import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
@ -212,7 +213,7 @@ public class ClearBrowsingDataFragmentTest {
CriteriaHelper.pollUiThread( CriteriaHelper.pollUiThread(
() -> () ->
!IdentityServicesProvider.get() !IdentityServicesProvider.get()
.getIdentityManager(Profile.getLastUsedRegularProfile()) .getIdentityManager(ProfileManager.getLastUsedRegularProfile())
.hasPrimaryAccount(ConsentLevel.SIGNIN), .hasPrimaryAccount(ConsentLevel.SIGNIN),
"Account should be signed out!"); "Account should be signed out!");

@ -69,6 +69,7 @@ import org.chromium.chrome.browser.layouts.LayoutTestUtils;
import org.chromium.chrome.browser.layouts.LayoutType; import org.chromium.chrome.browser.layouts.LayoutType;
import org.chromium.chrome.browser.layouts.animation.CompositorAnimationHandler; import org.chromium.chrome.browser.layouts.animation.CompositorAnimationHandler;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.MockTab; import org.chromium.chrome.browser.tab.MockTab;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabLaunchType;
@ -219,8 +220,8 @@ public class LayoutManagerTest implements MockTabModelDelegate {
mTabModelSelector = mTabModelSelector =
new MockTabModelSelector( new MockTabModelSelector(
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
Profile.getLastUsedRegularProfile().getPrimaryOTRProfile(true), ProfileManager.getLastUsedRegularProfile().getPrimaryOTRProfile(true),
standardTabCount, standardTabCount,
incognitoTabCount, incognitoTabCount,
this); this);
@ -901,7 +902,7 @@ public class LayoutManagerTest implements MockTabModelDelegate {
@Override @Override
public MockTab createTab(int id, boolean incognito) { public MockTab createTab(int id, boolean incognito) {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
return MockTab.createAndInitialize( return MockTab.createAndInitialize(
id, incognito ? profile.getPrimaryOTRProfile(true) : profile); id, incognito ? profile.getPrimaryOTRProfile(true) : profile);
} }

@ -21,6 +21,7 @@ import org.chromium.chrome.browser.browsing_data.BrowsingDataBridge;
import org.chromium.chrome.browser.browsing_data.BrowsingDataType; import org.chromium.chrome.browser.browsing_data.BrowsingDataType;
import org.chromium.chrome.browser.browsing_data.TimePeriod; import org.chromium.chrome.browser.browsing_data.TimePeriod;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeBrowserTestRule; import org.chromium.chrome.test.ChromeBrowserTestRule;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge; import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge;
@ -51,7 +52,7 @@ public class ContentSettingsObserverTest {
CallbackHelper helper = new CallbackHelper(); CallbackHelper helper = new CallbackHelper();
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile()) BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
.clearBrowsingData( .clearBrowsingData(
helper::notifyCalled, helper::notifyCalled,
new int[] {BrowsingDataType.SITE_SETTINGS}, new int[] {BrowsingDataType.SITE_SETTINGS},
@ -64,7 +65,7 @@ public class ContentSettingsObserverTest {
@SmallTest @SmallTest
@UiThreadTest @UiThreadTest
public void testContentSettingChanges() throws TimeoutException { public void testContentSettingChanges() throws TimeoutException {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
ContentSettingsObserver observer = ContentSettingsObserver observer =
new ContentSettingsObserver(profile) { new ContentSettingsObserver(profile) {
@Override @Override

@ -52,6 +52,7 @@ import org.chromium.chrome.browser.firstrun.FirstRunStatus;
import org.chromium.chrome.browser.locale.LocaleManager; import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.locale.LocaleManagerDelegate; import org.chromium.chrome.browser.locale.LocaleManagerDelegate;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule; import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule;
@ -137,7 +138,7 @@ public class ContextualSearchInstrumentationBase {
() -> activity.getLastUserInteractionTime(), () -> activity.getLastUserInteractionTime(),
activity.getEdgeToEdgeControllerSupplierForTesting()); activity.getEdgeToEdgeControllerSupplierForTesting());
setSelectionController(new MockCSSelectionController(activity, this)); setSelectionController(new MockCSSelectionController(activity, this));
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
WebContents webContents = WebContentsFactory.createWebContents(profile, false, false); WebContents webContents = WebContentsFactory.createWebContents(profile, false, false);
ContentView cv = ContentView cv =
ContentView.createContentView( ContentView.createContentView(

@ -24,6 +24,7 @@ import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory; import org.chromium.chrome.browser.search_engines.TemplateUrlServiceFactory;
import org.chromium.chrome.browser.signin.services.UnifiedConsentServiceBridge; import org.chromium.chrome.browser.signin.services.UnifiedConsentServiceBridge;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
@ -61,7 +62,7 @@ public class ContextualSearchPolicyTest {
() -> { () -> {
mPolicy = new ContextualSearchPolicy(null, mMockServer); mPolicy = new ContextualSearchPolicy(null, mMockServer);
mProfile = Profile.getLastUsedRegularProfile(); mProfile = ProfileManager.getLastUsedRegularProfile();
mPolicy.setProfile(mProfile); mPolicy.setProfile(mProfile);
}); });

@ -73,6 +73,7 @@ import org.chromium.chrome.browser.incognito.reauth.IncognitoReauthSettingUtils;
import org.chromium.chrome.browser.lifecycle.StartStopWithNativeObserver; import org.chromium.chrome.browser.lifecycle.StartStopWithNativeObserver;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.translate.TranslateBridge; import org.chromium.chrome.browser.translate.TranslateBridge;
import org.chromium.chrome.browser.translate.TranslateBridgeJni; import org.chromium.chrome.browser.translate.TranslateBridgeJni;
import org.chromium.chrome.browser.ui.appmenu.AppMenuItemProperties; import org.chromium.chrome.browser.ui.appmenu.AppMenuItemProperties;
@ -589,7 +590,7 @@ public class CustomTabActivityIncognitoTest {
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.setBoolean(Pref.INCOGNITO_REAUTHENTICATION_FOR_ANDROID, true); .setBoolean(Pref.INCOGNITO_REAUTHENTICATION_FOR_ANDROID, true);
IncognitoReauthController incognitoReauthController = IncognitoReauthController incognitoReauthController =
customTabActivity customTabActivity
@ -610,7 +611,7 @@ public class CustomTabActivityIncognitoTest {
assertTrue( assertTrue(
"Re-auth screen should be shown.", "Re-auth screen should be shown.",
incognitoReauthController.isReauthPageShowing()); incognitoReauthController.isReauthPageShowing());
UserPrefs.get(Profile.getLastUsedRegularProfile()) UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
.setBoolean(Pref.INCOGNITO_REAUTHENTICATION_FOR_ANDROID, false); .setBoolean(Pref.INCOGNITO_REAUTHENTICATION_FOR_ANDROID, false);
}); });

@ -150,6 +150,7 @@ import org.chromium.chrome.browser.page_load_metrics.PageLoadMetrics;
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
import org.chromium.chrome.browser.preferences.ChromeSharedPreferences; import org.chromium.chrome.browser.preferences.ChromeSharedPreferences;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.EmptyTabObserver; import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.Tab.LoadUrlResult; import org.chromium.chrome.browser.tab.Tab.LoadUrlResult;
@ -1485,7 +1486,7 @@ public class CustomTabActivityTest {
// Needs the browser process to be initialized. // Needs the browser process to be initialized.
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
PrefService prefs = UserPrefs.get(Profile.getLastUsedRegularProfile()); PrefService prefs = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
int old_block_pref = prefs.getInteger(COOKIE_CONTROLS_MODE); int old_block_pref = prefs.getInteger(COOKIE_CONTROLS_MODE);
prefs.setInteger(COOKIE_CONTROLS_MODE, CookieControlsMode.OFF); prefs.setInteger(COOKIE_CONTROLS_MODE, CookieControlsMode.OFF);
Assert.assertTrue(connection.maySpeculate(token)); Assert.assertTrue(connection.maySpeculate(token));

@ -42,7 +42,7 @@ import org.chromium.chrome.browser.browserservices.verification.ChromeOriginVeri
import org.chromium.chrome.browser.document.ChromeLauncherActivity; import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.firstrun.FirstRunStatus; import org.chromium.chrome.browser.firstrun.FirstRunStatus;
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.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.components.content_settings.CookieControlsMode; import org.chromium.components.content_settings.CookieControlsMode;
@ -448,7 +448,7 @@ public class DetachedResourceRequestTest {
mServer = EmbeddedTestServer.createAndStartHTTPSServer(mContext, ServerCertificate.CERT_OK); mServer = EmbeddedTestServer.createAndStartHTTPSServer(mContext, ServerCertificate.CERT_OK);
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
PrefService prefs = UserPrefs.get(Profile.getLastUsedRegularProfile()); PrefService prefs = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
Assert.assertEquals( Assert.assertEquals(
prefs.getInteger(COOKIE_CONTROLS_MODE), prefs.getInteger(COOKIE_CONTROLS_MODE),
CookieControlsMode.INCOGNITO_ONLY); CookieControlsMode.INCOGNITO_ONLY);
@ -493,7 +493,7 @@ public class DetachedResourceRequestTest {
// This isn't blocking third-party cookies by preferences. // This isn't blocking third-party cookies by preferences.
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
PrefService prefs = UserPrefs.get(Profile.getLastUsedRegularProfile()); PrefService prefs = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
Assert.assertEquals( Assert.assertEquals(
prefs.getInteger(COOKIE_CONTROLS_MODE), prefs.getInteger(COOKIE_CONTROLS_MODE),
CookieControlsMode.INCOGNITO_ONLY); CookieControlsMode.INCOGNITO_ONLY);
@ -538,7 +538,7 @@ public class DetachedResourceRequestTest {
mServer = EmbeddedTestServer.createAndStartServer(mContext); mServer = EmbeddedTestServer.createAndStartServer(mContext);
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> { () -> {
PrefService prefs = UserPrefs.get(Profile.getLastUsedRegularProfile()); PrefService prefs = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
Assert.assertEquals( Assert.assertEquals(
prefs.getInteger(COOKIE_CONTROLS_MODE), prefs.getInteger(COOKIE_CONTROLS_MODE),
CookieControlsMode.INCOGNITO_ONLY); CookieControlsMode.INCOGNITO_ONLY);

@ -66,6 +66,7 @@ import org.chromium.chrome.browser.offlinepages.ClientId;
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
import org.chromium.chrome.browser.omnibox.UrlBar; import org.chromium.chrome.browser.omnibox.UrlBar;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tab.TrustedCdn; import org.chromium.chrome.browser.tab.TrustedCdn;
import org.chromium.chrome.browser.test.ScreenShooter; import org.chromium.chrome.browser.test.ScreenShooter;
@ -203,8 +204,8 @@ public class TrustedCdnPublisherUrlTest {
public void testRtl() throws Exception { public void testRtl() throws Exception {
String publisher = String publisher =
"\u200e\u202b\u0645\u0648\u0642\u0639\u002e\u0648\u0632\u0627\u0631" "\u200e\u202b\u0645\u0648\u0642\u0639\u002e\u0648\u0632\u0627\u0631"
+ "\u0629\u002d\u0627\u0644\u0623\u062a\u0635\u0627\u0644\u0627\u062a\u002e\u0645" + "\u0629\u002d\u0627\u0644\u0623\u062a\u0635\u0627\u0644\u0627\u062a\u002e\u0645"
+ "\u0635\u0631\u202c\u200e"; + "\u0635\u0631\u202c\u200e";
runTrustedCdnPublisherUrlTest( runTrustedCdnPublisherUrlTest(
"http://xn--4gbrim.xn----rmckbbajlc6dj7bxne2c.xn--wgbh1c/", "http://xn--4gbrim.xn----rmckbbajlc6dj7bxne2c.xn--wgbh1c/",
"com.example.test", "com.example.test",
@ -355,7 +356,7 @@ public class TrustedCdnPublisherUrlTest {
OfflinePageBridge offlinePageBridge = OfflinePageBridge offlinePageBridge =
TestThreadUtils.runOnUiThreadBlockingNoException( TestThreadUtils.runOnUiThreadBlockingNoException(
() -> { () -> {
Profile profile = Profile.getLastUsedRegularProfile(); Profile profile = ProfileManager.getLastUsedRegularProfile();
return OfflinePageBridge.getForProfile(profile); return OfflinePageBridge.getForProfile(profile);
}); });

@ -37,7 +37,7 @@ import org.chromium.base.test.util.CriteriaHelper;
import org.chromium.base.test.util.JniMocker; import org.chromium.base.test.util.JniMocker;
import org.chromium.base.test.util.MaxAndroidSdkLevel; import org.chromium.base.test.util.MaxAndroidSdkLevel;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.R; import org.chromium.chrome.test.R;
@ -166,7 +166,7 @@ public class BluetoothChooserDialogTest {
"https://origin.example.com/", "https://origin.example.com/",
ConnectionSecurityLevel.SECURE, ConnectionSecurityLevel.SECURE,
new ChromeBluetoothChooserAndroidDelegate( new ChromeBluetoothChooserAndroidDelegate(
Profile.getLastUsedRegularProfile()), ProfileManager.getLastUsedRegularProfile()),
/* nativeBluetoothChooserDialogPtr= */ 42); /* nativeBluetoothChooserDialogPtr= */ 42);
dialog.show(); dialog.show();
return dialog; return dialog;

@ -25,7 +25,7 @@ import org.chromium.base.test.util.Criteria;
import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.CriteriaHelper;
import org.chromium.base.test.util.JniMocker; import org.chromium.base.test.util.JniMocker;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.R; import org.chromium.chrome.test.R;
@ -88,7 +88,7 @@ public class BluetoothScanningPermissionDialogTest {
"https://origin.example.com/", "https://origin.example.com/",
ConnectionSecurityLevel.SECURE, ConnectionSecurityLevel.SECURE,
new ChromeBluetoothScanningPromptAndroidDelegate( new ChromeBluetoothScanningPromptAndroidDelegate(
Profile.getLastUsedRegularProfile()), ProfileManager.getLastUsedRegularProfile()),
/* nativeBluetoothScanningPermissionDialogPtr= */ 42); /* nativeBluetoothScanningPermissionDialogPtr= */ 42);
return dialog; return dialog;
}); });

@ -30,7 +30,7 @@ import org.chromium.base.test.util.Criteria;
import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.CriteriaHelper;
import org.chromium.base.test.util.JniMocker; import org.chromium.base.test.util.JniMocker;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
import org.chromium.chrome.test.R; import org.chromium.chrome.test.R;
@ -93,7 +93,7 @@ public class UsbChooserDialogTest {
UsbChooserDialog dialog = UsbChooserDialog dialog =
new UsbChooserDialog( new UsbChooserDialog(
/* nativeUsbChooserDialogPtr= */ 42, /* nativeUsbChooserDialogPtr= */ 42,
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
dialog.show( dialog.show(
sActivityTestRule.getActivity(), sActivityTestRule.getActivity(),
"https://origin.example.com/", "https://origin.example.com/",
@ -218,7 +218,7 @@ public class UsbChooserDialogTest {
mockWindowAndroid, mockWindowAndroid,
"https://origin.example.com/", "https://origin.example.com/",
ConnectionSecurityLevel.SECURE, ConnectionSecurityLevel.SECURE,
Profile.getLastUsedRegularProfile(), ProfileManager.getLastUsedRegularProfile(),
/* nativeUsbChooserDialogPtr= */ 42); /* nativeUsbChooserDialogPtr= */ 42);
}); });
Assert.assertNull(dialog); Assert.assertNull(dialog);

@ -19,7 +19,7 @@ import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.UiThreadTest; import org.chromium.base.test.UiThreadTest;
import org.chromium.base.test.util.Batch; import org.chromium.base.test.util.Batch;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.test.ChromeBrowserTestRule; import org.chromium.chrome.test.ChromeBrowserTestRule;
import org.chromium.components.dom_distiller.core.DistilledPagePrefs; import org.chromium.components.dom_distiller.core.DistilledPagePrefs;
import org.chromium.components.dom_distiller.core.DomDistillerService; import org.chromium.components.dom_distiller.core.DomDistillerService;
@ -63,7 +63,7 @@ public class DistilledPagePrefsTest {
// TODO (https://crbug.com/1063807): Add incognito mode tests. // TODO (https://crbug.com/1063807): Add incognito mode tests.
DomDistillerService domDistillerService = DomDistillerService domDistillerService =
DomDistillerServiceFactory.getForProfile( DomDistillerServiceFactory.getForProfile(
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
mDistilledPagePrefs = domDistillerService.getDistilledPagePrefs(); mDistilledPagePrefs = domDistillerService.getDistilledPagePrefs();
}); });
} }

@ -65,7 +65,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.flags.ChromeSwitches;
import org.chromium.chrome.browser.incognito.IncognitoNotificationServiceImpl; import org.chromium.chrome.browser.incognito.IncognitoNotificationServiceImpl;
import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; import org.chromium.chrome.browser.offlinepages.OfflinePageUtils;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.ProfileManager;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
import org.chromium.chrome.test.R; import org.chromium.chrome.test.R;
@ -352,7 +352,7 @@ public class ReaderModeTest implements CustomMainActivityStart {
() -> { () -> {
DomDistillerService domDistillerService = DomDistillerService domDistillerService =
DomDistillerServiceFactory.getForProfile( DomDistillerServiceFactory.getForProfile(
Profile.getLastUsedRegularProfile()); ProfileManager.getLastUsedRegularProfile());
prefs.set(domDistillerService.getDistilledPagePrefs()); prefs.set(domDistillerService.getDistilledPagePrefs());
}); });
return prefs.get(); return prefs.get();

Some files were not shown because too many files have changed in this diff Show More