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:

committed by
Chromium LUCI CQ

parent
6929fef6bb
commit
f486e3fc74
PRESUBMIT.pyPRESUBMIT_test.py
chrome
android
features
keyboard_accessory
internal
java
src
org
chromium
chrome
browser
keyboard_accessory
start_surface
java
src
javatests
src
org
chromium
chrome
features
start_surface
junit
src
org
chromium
chrome
features
tab_ui
java
src
org
chromium
chrome
browser
tasks
tab_groups
javatests
src
org
chromium
chrome
browser
tasks
feed
core
java
src
org
chromium
chrome
browser
javatests
src
org
chromium
chrome
browser
feed
java
src
org
chromium
chrome
browser
BackupSigninProcessor.javaChromeActivitySessionTracker.javaChromeBackupAgentImpl.javaChromeBackupWatcher.javaIntentHandler.javaSynchronousInitializationActivity.javaWarmupManager.java
app
download
background_task_scheduler
bookmarkswidget
browsing_data
compositor
customtabs
dependency_injection
dom_distiller
download
feature_guide
notifications
homepage
incognito
init
ActivityProfileProvider.javaAsyncInitializationActivity.javaChromeBrowserInitializer.javaProcessInitializationHandler.java
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
AccountBookmarkTest.javaBookmarkBridgeTest.javaBookmarkFolderPickerRenderTest.javaBookmarkModelTest.javaBookmarkSaveFlowTest.java
browsing_data
compositor
layouts
content_settings
contextualsearch
customtabs
CustomTabActivityIncognitoTest.javaCustomTabActivityTest.javaDetachedResourceRequestTest.javaTrustedCdnPublisherUrlTest.java
device_dialog
dom_distiller
download
feedback
firstrun
gesturenav
history
incognito
infobar
input
locale
notifications
ntp
IncognitoNewTabPageTest.javaNewTabPageTest.javaRecentlyClosedBridgeTest.javaRevampedIncognitoNewTabPageTest.java
offlinepages
OfflinePageArchivePublisherBridgeTest.javaOfflinePageBridgeTest.javaOfflinePageSavePageLaterEvaluationTest.javaOfflinePageUtilsTest.javaOfflineTestUtil.javaRequestCoordinatorBridgeTest.java
omnibox
page_info
password_manager
permissions
privacy
settings
profiles
search_engines
DefaultSearchEngineDialogHelperUtils.javaDefaultSearchEnginePromoDialogTest.javaTemplateUrlServiceTest.java
settings
settings
share
signin
AccountsReloadingTest.javaSigninCheckerTest.javaSigninFirstRunFragmentTest.javaSigninManagerIntegrationTest.javaSigninSignoutIntegrationTest.javaSyncConsentFragmentTest.java
site_settings
AllSiteSettingsTest.javaChromeSiteSettingsDelegateTest.javaCookieControlsBridgeTest.javaCookieControlsServiceBridgeTest.javaFamilyLinkControlsTest.javaPermissionInfoTest.javaSingleWebsiteSettingsTest.javaSiteSettingsTest.javaSiteSettingsTestUtils.javaWebsitePermissionsFetcherTest.javaWebsitePreferenceBridgeTest.java
suggestions
sync
AccountManagementFragmentTest.javaBookmarksTest.javaGoogleServicesSettingsTest.javaManageSyncSettingsTest.javaSyncErrorCardPreferenceTest.javaSyncTest.javaSyncTestRule.java
tab
tabmodel
toolbar
junit
src
org
chromium
chrome
browser
ChromeBackupAgentTest.java
bookmarks
BookmarkFolderPickerMediatorTest.javaImprovedBookmarkQueryHandlerTest.javaLegacyBookmarkQueryHandlerTest.java
contextmenu
customtabs
download
feed
homepage
init
new_tab_url
ntp
search_engines
settings
signin
suggestions
survey
tabbed_mode
toolbar
browser
android
browserservices
verification
java
src
org
chromium
chrome
browser
browserservices
httpclient
java
src
org
chromium
chrome
browser
android
httpclient
metrics
javatests
src
org
chromium
chrome
browser
metrics
autofill
android
java
src
org
chromium
chrome
browser
autofill
javatest
src
org
chromium
chrome
browser
autofill
editors
banners
android
java
src
org
chromium
chrome
browser
banners
commerce
android
java
src
org
chromium
chrome
browser
commerce
merchant_viewer
android
javatests
src
org
chromium
chrome
browser
price_tracking
android
java
src
org
chromium
chrome
browser
javatests
src
org
chromium
chrome
browser
subscriptions
test
android
java
src
org
chromium
chrome
browser
subscriptions
data_sharing
android
java
src
org
chromium
chrome
browser
data_sharing
download
internal
android
java
src
org
chromium
chrome
browser
download
home
engagement
android
java
src
org
chromium
chrome
browser
engagement
feed
android
java
src
org
chromium
chrome
browser
feed
gsa
java
src
org
chromium
chrome
browser
image_descriptions
android
java
src
org
chromium
chrome
browser
image_descriptions
incognito
android
java
src
org
chromium
chrome
browser
javatests
src
org
chromium
chrome
browser
incognito
locale
java
src
org
chromium
chrome
browser
magic_stack
android
junit
src
org
chromium
chrome
browser
magic_stack
optimization_guide
android
java
src
org
chromium
javatests
src
org
chromium
chrome
browser
optimization_guide
password_check
android
internal
java
src
org
chromium
chrome
browser
password_check
password_manager
android
java
src
org
chromium
chrome
browser
password_manager
junit
src
org
chromium
chrome
browser
password_manager
pwd_check_wrapper
java
src
org
chromium
chrome
browser
pwd_check_wrapper
privacy_guide
android
javatests
src
org
chromium
chrome
browser
privacy_guide
privacy_sandbox
android
javatests
src
org
chromium
profiles
android
java
src
org
chromium
chrome
browser
quick_delete
android
javatests
src
org
chromium
chrome
recent_tabs
internal
android
java
src
org
chromium
chrome
browser
safe_browsing
android
javatests
src
org
chromium
chrome
browser
safe_browsing
safety_check
android
javatests
src
org
chromium
chrome
browser
safety_check
search_engines
android
java
src
org
chromium
chrome
browser
segmentation_platform
android
javatests
src
org
chromium
chrome
browser
segmentation_platform
share
android
java
src
org
chromium
chrome
browser
share
send_tab_to_self
javatests
src
org
chromium
chrome
browser
share
sync
test
android
java
src
org
chromium
chrome
browser
tab
java
src
org
chromium
chrome
touch_to_fill
password_manager
android
internal
java
src
org
chromium
chrome
browser
touch_to_fill
ui
android
hats
internal
java
src
org
chromium
chrome
browser
logo
java
src
org
chromium
chrome
browser
night_mode
java
src
org
chromium
chrome
browser
omnibox
java
src
org
chromium
chrome
browser
page_insights
java
src
org
chromium
chrome
searchactivityutils
java
src
org
chromium
chrome
browser
ui
signin
java
src
org
chromium
chrome
browser
ui
signin
toolbar
java
src
org
chromium
chrome
webid
internal
java
src
org
chromium
chrome
browser
ui
android
user_education
java
src
org
chromium
chrome
browser
user_education
test
android
javatests
src
org
chromium
chrome
test
util
@ -260,7 +260,7 @@ _BANNED_JAVA_FUNCTIONS : Sequence[BanRule] = (
|
||||
),
|
||||
),
|
||||
BanRule(
|
||||
'Profile.getLastUsedRegularProfile()',
|
||||
'ProfileManager.getLastUsedRegularProfile()',
|
||||
(
|
||||
'Prefer passing in the Profile reference instead of relying on the '
|
||||
'static getLastUsedRegularProfile() call. Only top level entry points '
|
||||
|
@ -2800,7 +2800,7 @@ class BannedTypeCheckTest(unittest.TestCase):
|
||||
MockFile('some/java/problematic/requestlayout.java',
|
||||
['requestLayout();']),
|
||||
MockFile('some/java/problematic/lastprofile.java',
|
||||
['Profile.getLastUsedRegularProfile();']),
|
||||
['ProfileManager.getLastUsedRegularProfile();']),
|
||||
MockFile('some/java/problematic/getdrawable1.java',
|
||||
['ResourcesCompat.getDrawable();']),
|
||||
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.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.components.browser_ui.widget.textbubble.TextBubble;
|
||||
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,
|
||||
// but it is not safe.
|
||||
final Tracker tracker =
|
||||
TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile());
|
||||
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
if (!tracker.isInitialized()) return null;
|
||||
return tracker;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import org.chromium.base.Callback;
|
||||
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.components.browser_ui.widget.RoundedIconGenerator;
|
||||
import org.chromium.components.favicon.LargeIconBridge;
|
||||
@ -74,7 +74,7 @@ public class FaviconHelper {
|
||||
*/
|
||||
public void fetchFavicon(String origin, Callback<Drawable> setIconCallback) {
|
||||
final LargeIconBridge mIconBridge =
|
||||
new LargeIconBridge(Profile.getLastUsedRegularProfile());
|
||||
new LargeIconBridge(ProfileManager.getLastUsedRegularProfile());
|
||||
final GURL gurlOrigin = new GURL(origin);
|
||||
if (!gurlOrigin.isValid()) return;
|
||||
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.ntp.NewTabPageLaunchOrigin;
|
||||
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.tab.Tab;
|
||||
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
|
||||
@ -107,7 +108,7 @@ class ExploreSurfaceCoordinatorFactory {
|
||||
boolean isInNightMode,
|
||||
boolean isPlaceholderShown,
|
||||
@NewTabPageLaunchOrigin int launchOrigin) {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
|
||||
return new ExploreSurfaceCoordinator(
|
||||
profile,
|
||||
|
@ -11,7 +11,7 @@ import androidx.annotation.Nullable;
|
||||
import org.chromium.chrome.browser.feed.FeedSurfaceCoordinator;
|
||||
import org.chromium.chrome.browser.feed.FeedSurfaceLifecycleManager;
|
||||
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;
|
||||
|
||||
/** Explore surface feed lifecycle manager. */
|
||||
@ -32,7 +32,7 @@ class ExploreSurfaceFeedLifecycleManager extends FeedSurfaceLifecycleManager {
|
||||
}
|
||||
|
||||
private boolean shouldShowFeed() {
|
||||
return UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
return UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.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.styles.OmniboxResourceProvider;
|
||||
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.suggestions.tile.MostVisitedTilesCoordinator;
|
||||
import org.chromium.chrome.browser.suggestions.tile.TileGroupDelegateImpl;
|
||||
@ -572,7 +573,7 @@ public class StartSurfaceCoordinator implements StartSurface {
|
||||
mStartSurfaceMediator.initWithNative(
|
||||
mIsStartSurfaceEnabled ? mOmniboxStubSupplier.get() : null,
|
||||
mExploreSurfaceCoordinatorFactory,
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile()),
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile()),
|
||||
mSnackbarManager);
|
||||
|
||||
if (mGridTabSwitcher != null) {
|
||||
@ -1340,7 +1341,7 @@ public class StartSurfaceCoordinator implements StartSurface {
|
||||
return;
|
||||
}
|
||||
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
MostVisitedTileNavigationDelegate navigationDelegate =
|
||||
new MostVisitedTileNavigationDelegate(mActivity, profile, mParentTabSupplier);
|
||||
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.RequestCoordinatorBridge;
|
||||
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.tab.Tab;
|
||||
import org.chromium.chrome.browser.tabmodel.document.ChromeAsyncTabLauncher;
|
||||
@ -86,7 +87,7 @@ public class MostVisitedTileNavigationDelegate extends SuggestionsNavigationDele
|
||||
private void saveUrlForOffline(String url) {
|
||||
// TODO(crbug.com/1193816): Namespace shouldn't be NTP_SUGGESTIONS_NAMESPACE since it's
|
||||
// not on NTP.
|
||||
RequestCoordinatorBridge.getForProfile(Profile.getLastUsedRegularProfile())
|
||||
RequestCoordinatorBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
|
||||
.savePageLater(
|
||||
url,
|
||||
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.omnibox.OmniboxStub;
|
||||
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.TileGroupDelegateImpl;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
@ -179,7 +180,7 @@ public class TasksSurfaceCoordinator implements TasksSurface {
|
||||
View.OnClickListener incognitoLearnMoreClickListener =
|
||||
v -> {
|
||||
Profile profile =
|
||||
Profile.getLastUsedRegularProfile()
|
||||
ProfileManager.getLastUsedRegularProfile()
|
||||
.getPrimaryOTRProfile(/* createIfNeeded= */ true);
|
||||
HelpAndFeedbackLauncherImpl.getForProfile(profile)
|
||||
.show(
|
||||
@ -228,7 +229,7 @@ public class TasksSurfaceCoordinator implements TasksSurface {
|
||||
return;
|
||||
}
|
||||
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
MostVisitedTileNavigationDelegate navigationDelegate =
|
||||
new MostVisitedTileNavigationDelegate(mActivity, profile, mParentTabSupplier);
|
||||
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.preferences.Pref;
|
||||
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.components.browser_ui.styles.ChromeColors;
|
||||
import org.chromium.components.browser_ui.widget.CoordinatorLayoutForPointer;
|
||||
@ -471,7 +472,7 @@ public class TasksView extends CoordinatorLayoutForPointer {
|
||||
|
||||
boolean shouldShowTrackingProtectionNtp() {
|
||||
Profile profile =
|
||||
Profile.getLastUsedRegularProfile()
|
||||
ProfileManager.getLastUsedRegularProfile()
|
||||
.getPrimaryOTRProfile(/* createIfNeeded= */ true);
|
||||
return (UserPrefs.get(profile).getBoolean(Pref.TRACKING_PROTECTION3PCD_ENABLED)
|
||||
|| 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.ChromeSwitches;
|
||||
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.test.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
|
||||
@ -147,7 +147,7 @@ public class InstantStartFeedTest {
|
||||
// FEED_ARTICLES_LIST_VISIBLE should equal to ARTICLES_LIST_VISIBLE.
|
||||
CriteriaHelper.pollUiThread(
|
||||
() ->
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.getBoolean(Pref.ARTICLES_LIST_VISIBLE)
|
||||
== ReturnToChromeUtil.getFeedArticlesVisibility());
|
||||
|
||||
@ -158,7 +158,7 @@ public class InstantStartFeedTest {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() ->
|
||||
Assert.assertEquals(
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.getBoolean(Pref.ARTICLES_LIST_VISIBLE),
|
||||
ReturnToChromeUtil.getFeedArticlesVisibility()));
|
||||
|
||||
@ -169,7 +169,7 @@ public class InstantStartFeedTest {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() ->
|
||||
Assert.assertEquals(
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.getBoolean(Pref.ARTICLES_LIST_VISIBLE),
|
||||
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.LayoutTestUtils;
|
||||
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.TabLaunchType;
|
||||
import org.chromium.chrome.browser.tasks.ReturnToChromeUtil;
|
||||
@ -913,7 +913,8 @@ public class StartSurfaceTest {
|
||||
// SpareTab should be created when the start surface is shown.
|
||||
CriteriaHelper.pollUiThread(
|
||||
() -> {
|
||||
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile());
|
||||
WarmupManager.getInstance()
|
||||
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
|
||||
});
|
||||
|
||||
// The spareTab initializes a renderer process.
|
||||
@ -927,7 +928,7 @@ public class StartSurfaceTest {
|
||||
CriteriaHelper.pollUiThread(
|
||||
() ->
|
||||
!WarmupManager.getInstance()
|
||||
.hasSpareTab(Profile.getLastUsedRegularProfile()));
|
||||
.hasSpareTab(ProfileManager.getLastUsedRegularProfile()));
|
||||
Assert.assertEquals(
|
||||
1,
|
||||
RecordHistogram.getHistogramValueCountForTesting(
|
||||
@ -956,7 +957,8 @@ public class StartSurfaceTest {
|
||||
// SpareTab should be created when the start surface is shown.
|
||||
CriteriaHelper.pollUiThread(
|
||||
() -> {
|
||||
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile());
|
||||
WarmupManager.getInstance()
|
||||
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
|
||||
});
|
||||
|
||||
// Navigate from StartSurface using search box.
|
||||
@ -972,7 +974,7 @@ public class StartSurfaceTest {
|
||||
CriteriaHelper.pollUiThread(
|
||||
() ->
|
||||
!WarmupManager.getInstance()
|
||||
.hasSpareTab(Profile.getLastUsedRegularProfile()));
|
||||
.hasSpareTab(ProfileManager.getLastUsedRegularProfile()));
|
||||
Assert.assertEquals(
|
||||
1,
|
||||
RecordHistogram.getHistogramValueCountForTesting(
|
||||
@ -999,7 +1001,8 @@ public class StartSurfaceTest {
|
||||
// SpareTab should be created when the start surface is shown.
|
||||
CriteriaHelper.pollUiThread(
|
||||
() -> {
|
||||
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile());
|
||||
WarmupManager.getInstance()
|
||||
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
|
||||
});
|
||||
|
||||
// Navigate from StartSurface using carousel tab switcher.
|
||||
@ -1010,7 +1013,7 @@ public class StartSurfaceTest {
|
||||
CriteriaHelper.pollUiThread(
|
||||
() ->
|
||||
!WarmupManager.getInstance()
|
||||
.hasSpareTab(Profile.getLastUsedRegularProfile()));
|
||||
.hasSpareTab(ProfileManager.getLastUsedRegularProfile()));
|
||||
Assert.assertEquals(
|
||||
1,
|
||||
RecordHistogram.getHistogramValueCountForTesting(
|
||||
@ -1038,7 +1041,8 @@ public class StartSurfaceTest {
|
||||
// SpareTab should be created when the start surface is shown.
|
||||
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
|
||||
@ -1067,7 +1071,8 @@ public class StartSurfaceTest {
|
||||
// SpareTab should be created when the start surface is shown.
|
||||
CriteriaHelper.pollUiThread(
|
||||
() -> {
|
||||
WarmupManager.getInstance().hasSpareTab(Profile.getLastUsedRegularProfile());
|
||||
WarmupManager.getInstance()
|
||||
.hasSpareTab(ProfileManager.getLastUsedRegularProfile());
|
||||
});
|
||||
|
||||
// Navigate from start surface using link
|
||||
@ -1077,7 +1082,7 @@ public class StartSurfaceTest {
|
||||
CriteriaHelper.pollUiThread(
|
||||
() ->
|
||||
!WarmupManager.getInstance()
|
||||
.hasSpareTab(Profile.getLastUsedRegularProfile()));
|
||||
.hasSpareTab(ProfileManager.getLastUsedRegularProfile()));
|
||||
Assert.assertEquals(
|
||||
1,
|
||||
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.preferences.PrefChangeRegistrar;
|
||||
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.signin.services.IdentityServicesProvider;
|
||||
import org.chromium.chrome.browser.signin.services.IdentityServicesProviderJni;
|
||||
@ -113,8 +114,8 @@ public class StartSurfaceCoordinatorUnitTestRule implements TestRule {
|
||||
List<TabModel> tabModels = new ArrayList<>();
|
||||
MockTabModelSelector selector =
|
||||
new MockTabModelSelector(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
Profile.getLastUsedRegularProfile().getPrimaryOTRProfile(true),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile().getPrimaryOTRProfile(true),
|
||||
0,
|
||||
0,
|
||||
null);
|
||||
@ -180,7 +181,7 @@ public class StartSurfaceCoordinatorUnitTestRule implements TestRule {
|
||||
Mockito.when(profile.getPrimaryOTRProfile(Mockito.anyBoolean()))
|
||||
.thenReturn(incognitoProfile);
|
||||
PrefService prefService = Mockito.mock(PrefService.class);
|
||||
Profile.setLastUsedProfileForTesting(profile);
|
||||
ProfileManager.setLastUsedProfileForTesting(profile);
|
||||
|
||||
mSuggestionsDeps.getFactory().offlinePageBridge = new FakeOfflinePageBridge();
|
||||
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.voice.VoiceRecognitionHandler;
|
||||
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.tab.MockTab;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
@ -216,7 +217,7 @@ public class StartSurfaceMediatorUnitTest {
|
||||
|
||||
doReturn(false).when(mProfile).isOffTheRecord();
|
||||
mProfileSupplier.set(mProfile);
|
||||
Profile.setLastUsedProfileForTesting(mProfile);
|
||||
ProfileManager.setLastUsedProfileForTesting(mProfile);
|
||||
TemplateUrlServiceFactory.setInstanceForTesting(mTemplateUrlService);
|
||||
|
||||
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.preferences.Pref;
|
||||
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.prefs.PrefService;
|
||||
import org.chromium.components.user_prefs.UserPrefs;
|
||||
@ -103,7 +104,7 @@ public class TasksViewBinderUnitTest {
|
||||
|
||||
mJniMocker.mock(UserPrefsJni.TEST_HOOKS, mUserPrefsJniMock);
|
||||
when(mProfile.getPrimaryOTRProfile(true)).thenReturn(mProfile);
|
||||
Profile.setLastUsedProfileForTesting(mProfile);
|
||||
ProfileManager.setLastUsedProfileForTesting(mProfile);
|
||||
when(mUserPrefsJniMock.get(mProfile)).thenReturn(mPrefService);
|
||||
createTasksView(R.layout.tasks_view_layout);
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import androidx.annotation.StringRes;
|
||||
import org.chromium.base.ApplicationStatus;
|
||||
import org.chromium.chrome.browser.ChromeTabbedActivity;
|
||||
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.tabmodel.TabModel;
|
||||
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
|
||||
@ -64,7 +64,7 @@ public class TabGroupUtils {
|
||||
}
|
||||
|
||||
final Tracker tracker =
|
||||
TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile());
|
||||
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
if (!tracker.isInitialized()) 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.PriceTrackingFeatures;
|
||||
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.test.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
|
||||
@ -135,7 +135,7 @@ public class PriceAlertsMessageCardTest {
|
||||
return TestThreadUtils.runOnUiThreadBlockingNoException(
|
||||
() -> {
|
||||
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.price_tracking.PriceTrackingFeatures;
|
||||
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.Tab;
|
||||
import org.chromium.chrome.browser.tab.state.LevelDBPersistedDataStorage;
|
||||
@ -351,7 +352,7 @@ public class TabListViewHolderTest extends BlankUiTestActivityTestCase {
|
||||
doReturn(false).when(mProfile).isOffTheRecord();
|
||||
LevelDBPersistedDataStorage.setSkipNativeAssertionsForTesting(true);
|
||||
|
||||
Profile.setLastUsedProfileForTesting(mProfile);
|
||||
ProfileManager.setLastUsedProfileForTesting(mProfile);
|
||||
PriceTrackingFeatures.setPriceTrackingEnabledForTesting(false);
|
||||
|
||||
mMocker.mock(UrlUtilitiesJni.TEST_HOOKS, mUrlUtilitiesJniMock);
|
||||
|
@ -10,7 +10,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import org.chromium.base.ResettersForTesting;
|
||||
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.Tab;
|
||||
import org.chromium.chrome.browser.tab.TabHidingType;
|
||||
@ -144,7 +144,7 @@ public class NtpFeedSurfaceLifecycleManager extends FeedSurfaceLifecycleManager
|
||||
|
||||
private PrefService getPrefService() {
|
||||
if (sPrefServiceForTesting != null) return sPrefServiceForTesting;
|
||||
return UserPrefs.get(Profile.getLastUsedRegularProfile());
|
||||
return UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
static void setPrefServiceForTesting(PrefService prefServiceForTesting) {
|
||||
|
@ -8,7 +8,7 @@ import com.google.protobuf.CodedOutputStream;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.base.test.util.UrlUtils;
|
||||
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.content_public.browser.test.util.TestThreadUtils;
|
||||
import org.chromium.net.test.util.WebServer;
|
||||
@ -31,9 +31,9 @@ public class TestFeedServer implements WebServer.RequestHandler {
|
||||
mServer = new WebServer(0, false);
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.setString(Pref.HOST_OVERRIDE_HOST, getBaseUrl());
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.setString(Pref.DISCOVER_API_ENDPOINT_OVERRIDE, getBaseUrl());
|
||||
});
|
||||
mServer.setRequestHandler(this);
|
||||
|
@ -12,6 +12,7 @@ import androidx.annotation.NonNull;
|
||||
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
|
||||
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.SigninManager;
|
||||
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.
|
||||
SigninManager signinManager =
|
||||
IdentityServicesProvider.get()
|
||||
.getSigninManager(Profile.getLastUsedRegularProfile());
|
||||
.getSigninManager(ProfileManager.getLastUsedRegularProfile());
|
||||
final String accountEmail = getBackupFlowSigninAccountEmail();
|
||||
if (!signinManager.isSyncOptInAllowed() || TextUtils.isEmpty(accountEmail)) {
|
||||
setBackupFlowSigninComplete();
|
||||
@ -85,7 +86,7 @@ public final class BackupSigninProcessor {
|
||||
|
||||
private static void signinAndEnableSync(
|
||||
@NonNull CoreAccountInfo coreAccountInfo, Activity activity) {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
SigninManager signinManager = IdentityServicesProvider.get().getSigninManager(profile);
|
||||
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.ChromeSharedPreferences;
|
||||
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.tabmodel.TabModelSelector;
|
||||
import org.chromium.chrome.browser.translate.TranslateBridge;
|
||||
@ -157,9 +157,10 @@ public class ChromeActivitySessionTracker {
|
||||
TraceEvent.scoped("ChromeActivitySessionTracker.onForegroundSessionStart")) {
|
||||
UmaUtils.recordForegroundStartTimeWithNative();
|
||||
updatePasswordEchoState();
|
||||
FontSizePrefs.getInstance(Profile.getLastUsedRegularProfile())
|
||||
FontSizePrefs.getInstance(ProfileManager.getLastUsedRegularProfile())
|
||||
.onSystemFontScaleChanged();
|
||||
DeviceAccessibilitySettingsHandler.getInstance(Profile.getLastUsedRegularProfile())
|
||||
DeviceAccessibilitySettingsHandler.getInstance(
|
||||
ProfileManager.getLastUsedRegularProfile())
|
||||
.updateFontWeightAdjustment();
|
||||
ChromeLocalizationUtils.recordUiLanguageStatus();
|
||||
updateAcceptLanguages();
|
||||
@ -192,7 +193,8 @@ public class ChromeActivitySessionTracker {
|
||||
IntentHandler.clearPendingReferrer();
|
||||
IntentHandler.clearPendingIncognitoUrl();
|
||||
|
||||
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile());
|
||||
Tracker tracker =
|
||||
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
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
|
||||
// OnBrowsingDataRemoverDone() is called, in which case we may have to reload as
|
||||
// well. Check if it can happen.
|
||||
BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile())
|
||||
BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
|
||||
.clearBrowsingData(
|
||||
null, new int[] {BrowsingDataType.CACHE}, TimePeriod.ALL_TIME);
|
||||
}
|
||||
@ -253,13 +255,13 @@ public class ChromeActivitySessionTracker {
|
||||
Settings.System.TEXT_SHOW_PASSWORD,
|
||||
1)
|
||||
== 1;
|
||||
if (UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
if (UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.getBoolean(Pref.WEB_KIT_PASSWORD_ECHO_ENABLED)
|
||||
== systemEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.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.ChromeBrowserInitializer;
|
||||
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.SigninManager;
|
||||
import org.chromium.components.signin.AccountManagerFacade;
|
||||
@ -217,12 +217,14 @@ public class ChromeBackupAgentImpl extends ChromeBackupAgent.Impl {
|
||||
|
||||
syncAccount.set(
|
||||
IdentityServicesProvider.get()
|
||||
.getIdentityManager(Profile.getLastUsedRegularProfile())
|
||||
.getIdentityManager(
|
||||
ProfileManager.getLastUsedRegularProfile())
|
||||
.getPrimaryAccountInfo(ConsentLevel.SYNC));
|
||||
|
||||
signedInAccount.set(
|
||||
IdentityServicesProvider.get()
|
||||
.getIdentityManager(Profile.getLastUsedRegularProfile())
|
||||
.getIdentityManager(
|
||||
ProfileManager.getLastUsedRegularProfile())
|
||||
.getPrimaryAccountInfo(ConsentLevel.SIGNIN));
|
||||
|
||||
if (syncAccount.get() != null
|
||||
@ -599,7 +601,7 @@ public class ChromeBackupAgentImpl extends ChromeBackupAgent.Impl {
|
||||
() -> {
|
||||
SigninManager signinManager =
|
||||
IdentityServicesProvider.get()
|
||||
.getSigninManager(Profile.getLastUsedRegularProfile());
|
||||
.getSigninManager(ProfileManager.getLastUsedRegularProfile());
|
||||
final AccountManagerFacade accountManagerFacade =
|
||||
AccountManagerFacadeProvider.getInstance();
|
||||
|
||||
|
@ -17,7 +17,7 @@ import org.chromium.base.StrictModeContext;
|
||||
import org.chromium.base.shared_preferences.SharedPreferencesManager;
|
||||
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
|
||||
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.components.signin.identitymanager.IdentityManager;
|
||||
import org.chromium.components.signin.identitymanager.PrimaryAccountChangeEvent;
|
||||
@ -67,7 +67,7 @@ public class ChromeBackupWatcher {
|
||||
// Update the backup if the sign-in status changes.
|
||||
IdentityManager identityManager =
|
||||
IdentityServicesProvider.get()
|
||||
.getIdentityManager(Profile.getLastUsedRegularProfile());
|
||||
.getIdentityManager(ProfileManager.getLastUsedRegularProfile());
|
||||
identityManager.addObserver(
|
||||
new IdentityManager.Observer() {
|
||||
@Override
|
||||
|
@ -42,6 +42,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
|
||||
import org.chromium.chrome.browser.gsa.GSAState;
|
||||
import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteControllerProvider;
|
||||
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.search_engines.TemplateUrlServiceFactory;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
@ -631,7 +632,7 @@ public class IntentHandler {
|
||||
}
|
||||
String query = results.get(0);
|
||||
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
AutocompleteMatch match;
|
||||
try (var controller = AutocompleteControllerProvider.createCloseableController(profile)) {
|
||||
match = controller.get().classify(query);
|
||||
|
@ -40,7 +40,7 @@ public abstract class SynchronousInitializationActivity extends ChromeBaseAppCom
|
||||
assert ProfileManager.isInitialized();
|
||||
// TODO(crbug/1410601): Pass the Profile information via the launching Intent and remove
|
||||
// getLastUsedRegularProfile below.
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
return new ProfileProvider() {
|
||||
@NonNull
|
||||
@Override
|
||||
|
@ -38,6 +38,7 @@ import org.chromium.chrome.browser.content.WebContentsFactory;
|
||||
import org.chromium.chrome.browser.crash.ChromePureJavaExceptionReporter;
|
||||
import org.chromium.chrome.browser.customtabs.CustomTabDelegateFactory;
|
||||
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.Tab;
|
||||
import org.chromium.chrome.browser.tab.TabBuilder;
|
||||
@ -563,7 +564,7 @@ public class WarmupManager {
|
||||
mSpareWebContents =
|
||||
new WebContentsFactory()
|
||||
.createWebContentsWithWarmRenderer(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
/* initiallyHidden= */ true);
|
||||
mObserver = new RenderProcessGoneObserver();
|
||||
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.profiles.OTRProfileID;
|
||||
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.ui.messages.snackbar.SnackbarManager;
|
||||
import org.chromium.components.browser_ui.settings.SettingsLauncher;
|
||||
@ -39,10 +40,10 @@ class DownloadManagerCoordinatorFactoryHelper {
|
||||
ModalDialogManager modalDialogManager) {
|
||||
Profile profile =
|
||||
OTRProfileID.isOffTheRecord(config.otrProfileID)
|
||||
? Profile.getLastUsedRegularProfile()
|
||||
? ProfileManager.getLastUsedRegularProfile()
|
||||
.getOffTheRecordProfile(
|
||||
config.otrProfileID, /* createIfNeeded= */ true)
|
||||
: Profile.getLastUsedRegularProfile();
|
||||
: ProfileManager.getLastUsedRegularProfile();
|
||||
Callback<Context> settingsLaunchHelper =
|
||||
DownloadManagerCoordinatorFactoryHelper::settingsLaunchHelper;
|
||||
return DownloadManagerCoordinatorFactory.create(
|
||||
|
5
chrome/android/java/src/org/chromium/chrome/browser/background_task_scheduler/ProxyNativeTask.java
5
chrome/android/java/src/org/chromium/chrome/browser/background_task_scheduler/ProxyNativeTask.java
@ -12,6 +12,7 @@ import org.chromium.base.Callback;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.profiles.ProfileKey;
|
||||
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.TaskInfo;
|
||||
import org.chromium.components.background_task_scheduler.TaskParameters;
|
||||
@ -55,7 +56,7 @@ public final class ProxyNativeTask extends NativeBackgroundTask {
|
||||
.startBackgroundTaskWithFullBrowser(
|
||||
mNativeProxyNativeTask,
|
||||
ProxyNativeTask.this,
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
} else {
|
||||
ProxyNativeTaskJni.get()
|
||||
.startBackgroundTaskInReducedMode(
|
||||
@ -72,7 +73,7 @@ public final class ProxyNativeTask extends NativeBackgroundTask {
|
||||
.onFullBrowserLoaded(
|
||||
mNativeProxyNativeTask,
|
||||
ProxyNativeTask.this,
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
10
chrome/android/java/src/org/chromium/chrome/browser/bookmarkswidget/BookmarkWidgetServiceImpl.java
10
chrome/android/java/src/org/chromium/chrome/browser/bookmarkswidget/BookmarkWidgetServiceImpl.java
@ -34,7 +34,7 @@ import org.chromium.chrome.browser.bookmarks.BookmarkModel;
|
||||
import org.chromium.chrome.browser.bookmarks.BookmarkModelObserver;
|
||||
import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
|
||||
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.components.bookmarks.BookmarkId;
|
||||
import org.chromium.components.bookmarks.BookmarkItem;
|
||||
@ -173,13 +173,14 @@ public class BookmarkWidgetServiceImpl extends BookmarkWidgetService.Impl {
|
||||
mCallback = callback;
|
||||
|
||||
Resources res = context.getResources();
|
||||
mLargeIconBridge = new LargeIconBridge(Profile.getLastUsedRegularProfile());
|
||||
mLargeIconBridge = new LargeIconBridge(ProfileManager.getLastUsedRegularProfile());
|
||||
mMinIconSizeDp = (int) res.getDimension(R.dimen.default_favicon_min_size);
|
||||
mDisplayedIconSize = res.getDimensionPixelSize(R.dimen.default_favicon_size);
|
||||
mIconGenerator = FaviconUtils.createRoundedRectangleIconGenerator(context);
|
||||
|
||||
mRemainingTaskCount = 1;
|
||||
mBookmarkModel = BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile());
|
||||
mBookmarkModel =
|
||||
BookmarkModel.getForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
mBookmarkModel.finishLoadingBookmarkModel(
|
||||
new Runnable() {
|
||||
@Override
|
||||
@ -306,7 +307,8 @@ public class BookmarkWidgetServiceImpl extends BookmarkWidgetService.Impl {
|
||||
RecordUserAction.record("BookmarkNavigatorWidgetAdded");
|
||||
}
|
||||
|
||||
mBookmarkModel = BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile());
|
||||
mBookmarkModel =
|
||||
BookmarkModel.getForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
mBookmarkModel.addObserver(
|
||||
new BookmarkModelObserver() {
|
||||
@Override
|
||||
|
@ -32,6 +32,7 @@ import org.chromium.base.CollectionUtil;
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.chrome.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.webapps.WebappRegistry;
|
||||
import org.chromium.components.browser_ui.util.ConversionUtils;
|
||||
@ -276,7 +277,7 @@ public class ConfirmImportantSitesDialogFragment extends DialogFragment {
|
||||
mFaviconURLs = new String[0];
|
||||
dismiss();
|
||||
}
|
||||
mProfile = Profile.getLastUsedRegularProfile();
|
||||
mProfile = ProfileManager.getLastUsedRegularProfile();
|
||||
mLargeIconBridge = new LargeIconBridge(mProfile);
|
||||
ActivityManager activityManager =
|
||||
((ActivityManager)
|
||||
|
@ -17,6 +17,7 @@ import org.jni_zero.NativeMethods;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.compositor.layouts.content.TitleBitmapFactory;
|
||||
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.TabFavicon;
|
||||
import org.chromium.chrome.browser.tabmodel.TabModelSelector;
|
||||
@ -175,8 +176,8 @@ public class LayerTitleCache {
|
||||
// to get the correct profile.
|
||||
Profile profile =
|
||||
!tab.isIncognito()
|
||||
? Profile.getLastUsedRegularProfile()
|
||||
: Profile.getLastUsedRegularProfile()
|
||||
? ProfileManager.getLastUsedRegularProfile()
|
||||
: ProfileManager.getLastUsedRegularProfile()
|
||||
.getPrimaryOTRProfile(/* createIfNeeded= */ true);
|
||||
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.contextualsearch.ContextualSearchManagementDelegate;
|
||||
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.SheetState;
|
||||
import org.chromium.components.browser_ui.bottomsheet.BottomSheetObserver;
|
||||
@ -94,7 +95,7 @@ public class ContextualSearchPanelCoordinator implements ContextualSearchPanelIn
|
||||
}
|
||||
|
||||
private void createWebContents() {
|
||||
final Profile profile = Profile.getLastUsedRegularProfile();
|
||||
final Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
mWebContents = WebContentsFactory.createWebContents(profile, false, false);
|
||||
mWebContentView = ContentView.createContentView(mContext, null, mWebContents);
|
||||
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.SceneOverlayLayer;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.profiles.ProfileManager;
|
||||
import org.chromium.content_public.browser.WebContents;
|
||||
import org.chromium.ui.resources.ResourceManager;
|
||||
|
||||
@ -214,7 +215,7 @@ public class ContextualSearchSceneLayer extends SceneOverlayLayer {
|
||||
touchHighlightVisible,
|
||||
touchHighlightXOffset,
|
||||
touchHighlightWidth,
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
roundedBarTopResourceId,
|
||||
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.privacy.settings.PrivacyPreferencesManagerImpl;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.profiles.ProfileManager;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
import org.chromium.components.content_settings.CookieControlsMode;
|
||||
import org.chromium.components.embedder_support.util.Origin;
|
||||
@ -481,7 +482,7 @@ public class CustomTabsConnection {
|
||||
try (TraceEvent e =
|
||||
TraceEvent.scoped("WarmupInternalFinishInitialization")) {
|
||||
// (4)
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
WarmupManager.startPreconnectPredictorInitialization(profile);
|
||||
|
||||
// (5) The throttling database uses shared preferences, that can cause
|
||||
@ -568,7 +569,7 @@ public class CustomTabsConnection {
|
||||
boolean atLeastOneUrl = false;
|
||||
if (likelyBundles == null) return false;
|
||||
WarmupManager warmupManager = WarmupManager.getInstance();
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
for (Bundle bundle : likelyBundles) {
|
||||
Uri uri;
|
||||
try {
|
||||
@ -664,7 +665,7 @@ public class CustomTabsConnection {
|
||||
try (TraceEvent e = TraceEvent.scoped("CustomTabsConnection.mayLaunchUrlOnUiThread")) {
|
||||
// doMayLaunchUrlInternal() is always called once the native level initialization is
|
||||
// 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
|
||||
// once.
|
||||
if (!BrowserStartupController.getInstance().isFullBrowserStarted()) {
|
||||
@ -1028,7 +1029,7 @@ public class CustomTabsConnection {
|
||||
|
||||
WarmupManager.getInstance()
|
||||
.maybePreconnectUrlAndSubResources(
|
||||
Profile.getLastUsedRegularProfile(), redirectEndpoint.toString());
|
||||
ProfileManager.getLastUsedRegularProfile(), redirectEndpoint.toString());
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
@ -1102,7 +1103,7 @@ public class CustomTabsConnection {
|
||||
String packageName = mClientManager.getClientPackageNameForSession(session);
|
||||
CustomTabsConnectionJni.get()
|
||||
.createAndStartDetachedResourceRequest(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
session,
|
||||
packageName,
|
||||
urlString,
|
||||
@ -1149,7 +1150,7 @@ public class CustomTabsConnection {
|
||||
// Session is null because we don't need completion notifications.
|
||||
CustomTabsConnectionJni.get()
|
||||
.createAndStartDetachedResourceRequest(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
null,
|
||||
null,
|
||||
urlString,
|
||||
@ -1789,7 +1790,8 @@ public class CustomTabsConnection {
|
||||
if (!DeviceClassManager.enablePrerendering()) {
|
||||
return false;
|
||||
}
|
||||
if (UserPrefs.get(Profile.getLastUsedRegularProfile()).getInteger(COOKIE_CONTROLS_MODE)
|
||||
if (UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.getInteger(COOKIE_CONTROLS_MODE)
|
||||
== CookieControlsMode.BLOCK_THIRD_PARTY) {
|
||||
return false;
|
||||
}
|
||||
@ -1817,7 +1819,7 @@ public class CustomTabsConnection {
|
||||
Bundle extras,
|
||||
int uid) {
|
||||
WarmupManager warmupManager = WarmupManager.getInstance();
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
|
||||
// At most one on-going speculation, clears the previous one.
|
||||
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.preferences.ChromeSharedPreferences;
|
||||
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.webapps.WebappRegistry;
|
||||
|
||||
@ -42,7 +43,7 @@ public class ChromeAppModule {
|
||||
@Provides
|
||||
@Named(LAST_USED_REGULAR_PROFILE)
|
||||
public Profile provideLastUsedRegularProfile() {
|
||||
return Profile.getLastUsedRegularProfile();
|
||||
return ProfileManager.getLastUsedRegularProfile();
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@ -24,7 +24,7 @@ import android.widget.TextView;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
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.dom_distiller.mojom.FontFamily;
|
||||
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
|
||||
// it is not safe.
|
||||
mDistilledPagePrefs =
|
||||
DomDistillerServiceFactory.getForProfile(Profile.getLastUsedRegularProfile())
|
||||
DomDistillerServiceFactory.getForProfile(ProfileManager.getLastUsedRegularProfile())
|
||||
.getDistilledPagePrefs();
|
||||
mColorModeButtons = new HashMap<Integer /* Theme */, RadioButton>();
|
||||
mPercentageFormatter = NumberFormat.getPercentInstance(Locale.getDefault());
|
||||
|
@ -1075,7 +1075,7 @@ public class DownloadManagerService implements DownloadServiceDelegate, ProfileM
|
||||
}
|
||||
|
||||
if (BrowserStartupController.getInstance().isFullBrowserStarted()) {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
if (OTRProfileID.isOffTheRecord(info.getOTRProfileId())) {
|
||||
profile =
|
||||
profile.getOffTheRecordProfile(
|
||||
@ -1310,7 +1310,7 @@ public class DownloadManagerService implements DownloadServiceDelegate, ProfileM
|
||||
*/
|
||||
// TODO(shaktisahu): Drive this from a similar observer.
|
||||
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.
|
||||
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.ChromeSharedPreferences;
|
||||
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.browser_ui.notifications.NotificationManagerProxy;
|
||||
import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl;
|
||||
@ -799,7 +799,7 @@ public class DownloadNotificationService {
|
||||
public void cancelOffTheRecordDownloads() {
|
||||
boolean cancelActualDownload =
|
||||
BrowserStartupController.getInstance().isFullBrowserStarted()
|
||||
&& Profile.getLastUsedRegularProfile().hasPrimaryOTRProfile();
|
||||
&& ProfileManager.getLastUsedRegularProfile().hasPrimaryOTRProfile();
|
||||
|
||||
List<DownloadSharedPreferenceEntry> entries = mDownloadSharedPreferenceHelper.getEntries();
|
||||
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 (OTRProfileID.isOffTheRecord(otrProfileID)
|
||||
&& !Profile.getLastUsedRegularProfile().hasOffTheRecordProfile(otrProfileID)) {
|
||||
&& !ProfileManager.getLastUsedRegularProfile()
|
||||
.hasOffTheRecordProfile(otrProfileID)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -173,8 +174,8 @@ public class DownloadUtils {
|
||||
if (BrowserStartupController.getInstance().isFullBrowserStarted()) {
|
||||
Profile profile =
|
||||
otrProfileID == null
|
||||
? Profile.getLastUsedRegularProfile()
|
||||
: Profile.getLastUsedRegularProfile()
|
||||
? ProfileManager.getLastUsedRegularProfile()
|
||||
: ProfileManager.getLastUsedRegularProfile()
|
||||
.getOffTheRecordProfile(
|
||||
otrProfileID, /* createIfNeeded= */ true);
|
||||
Tracker tracker = TrackerFactory.getTrackerForProfile(profile);
|
||||
@ -207,7 +208,7 @@ public class DownloadUtils {
|
||||
OTRProfileID otrProfileID = OTRProfileID.deserializeWithoutVerify(serializedId);
|
||||
|
||||
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.browser.feature_engagement.TrackerFactory;
|
||||
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.ui.default_browser_promo.DefaultBrowserPromoDeps;
|
||||
import org.chromium.chrome.browser.ui.default_browser_promo.DefaultBrowserPromoUtils;
|
||||
@ -57,7 +56,7 @@ public final class FeatureNotificationUtils {
|
||||
() -> {
|
||||
Tracker tracker =
|
||||
TrackerFactory.getTrackerForProfile(
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
tracker.setPriorityNotification(
|
||||
FeatureNotificationUtils
|
||||
.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. */
|
||||
public static void registerIPHCallback(@FeatureType int featureType, Runnable showIphCallback) {
|
||||
if (!ProfileManager.isInitialized()) return;
|
||||
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile());
|
||||
Tracker tracker =
|
||||
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
tracker.registerPriorityNotificationHandler(
|
||||
getIPHFeatureForNotificationFeatureType(featureType), showIphCallback);
|
||||
}
|
||||
@ -75,7 +75,8 @@ public final class FeatureNotificationUtils {
|
||||
/** Unregisters any IPH callbacks associated with the feature type. */
|
||||
public static void unregisterIPHCallback(@FeatureType int featureType) {
|
||||
if (!ProfileManager.isInitialized()) return;
|
||||
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile());
|
||||
Tracker tracker =
|
||||
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
tracker.unregisterPriorityNotificationHandler(
|
||||
getIPHFeatureForNotificationFeatureType(featureType));
|
||||
}
|
||||
@ -86,7 +87,8 @@ public final class FeatureNotificationUtils {
|
||||
*/
|
||||
public static boolean willShowIPH(@FeatureType int featureType) {
|
||||
String iphFeature = getIPHFeatureForNotificationFeatureType(featureType);
|
||||
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile());
|
||||
Tracker tracker =
|
||||
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
return TextUtils.equals(tracker.getPendingPriorityNotification(), iphFeature);
|
||||
}
|
||||
|
||||
@ -179,7 +181,7 @@ public final class FeatureNotificationUtils {
|
||||
if (featureType == FeatureType.DEFAULT_BROWSER) {
|
||||
return !shouldShowDefaultBrowserPromo();
|
||||
} 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 false;
|
||||
|
@ -23,7 +23,6 @@ import org.chromium.chrome.browser.partnercustomizations.HomepageCharacterizatio
|
||||
import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations;
|
||||
import org.chromium.chrome.browser.preferences.ChromePreferenceKeys;
|
||||
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.settings.SettingsLauncherImpl;
|
||||
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
|
||||
* 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
|
||||
* called.
|
||||
* <p>This function needs to be called on UI thread since
|
||||
* ProfileManager.getLastUsedRegularProfile() is called.
|
||||
*
|
||||
* <p>This function checks different sources to get the current homepage, which is listed below
|
||||
* according to their priority:
|
||||
@ -138,13 +137,14 @@ public class HomepageManager
|
||||
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
|
||||
// the home button may redirect to the DSE's new Tab URL, rather than showing an incognito
|
||||
// NTP.
|
||||
return DseNewTabUrlManager.maybeGetOverrideUrl(
|
||||
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.PrefChangeRegistrar;
|
||||
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.user_prefs.UserPrefs;
|
||||
import org.chromium.url.GURL;
|
||||
@ -221,7 +221,7 @@ public class HomepagePolicyManager implements PrefObserver {
|
||||
|
||||
private PrefService getPrefService() {
|
||||
if (sPrefServiceForTesting != null) return sPrefServiceForTesting;
|
||||
return UserPrefs.get(Profile.getLastUsedRegularProfile());
|
||||
return UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
public static void setPrefServiceForTesting(PrefService prefService) {
|
||||
|
5
chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationServiceImpl.java
5
chrome/android/java/src/org/chromium/chrome/browser/incognito/IncognitoNotificationServiceImpl.java
@ -22,7 +22,6 @@ import org.chromium.base.task.PostTask;
|
||||
import org.chromium.base.task.TaskTraits;
|
||||
import org.chromium.chrome.browser.ChromeTabbedActivity;
|
||||
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.tabmodel.IncognitoTabHostUtils;
|
||||
import org.chromium.chrome.browser.util.AndroidTaskUtils;
|
||||
@ -67,9 +66,9 @@ public class IncognitoNotificationServiceImpl extends IncognitoNotificationServi
|
||||
IncognitoNotificationManager.dismissIncognitoNotification();
|
||||
|
||||
if (BrowserStartupController.getInstance().isFullBrowserStarted()) {
|
||||
if (Profile.getLastUsedRegularProfile().hasPrimaryOTRProfile()) {
|
||||
if (ProfileManager.getLastUsedRegularProfile().hasPrimaryOTRProfile()) {
|
||||
ProfileManager.destroyWhenAppropriate(
|
||||
Profile.getLastUsedRegularProfile()
|
||||
ProfileManager.getLastUsedRegularProfile()
|
||||
.getPrimaryOTRProfile(/* createIfNeeded= */ false));
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class ActivityProfileProvider extends OneshotSupplierImpl<ProfileProvider
|
||||
@NonNull
|
||||
@Override
|
||||
public Profile getOriginalProfile() {
|
||||
return Profile.getLastUsedRegularProfile();
|
||||
return ProfileManager.getLastUsedRegularProfile();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -40,7 +40,7 @@ import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;
|
||||
import org.chromium.chrome.browser.metrics.SimpleStartupForegroundSessionDetector;
|
||||
import org.chromium.chrome.browser.multiwindow.MultiWindowModeStateDispatcher;
|
||||
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.tasks.tab_management.TabUiFeatureUtilities;
|
||||
import org.chromium.chrome.features.start_surface.StartSurfaceConfiguration;
|
||||
@ -268,7 +268,7 @@ public abstract class AsyncInitializationActivity extends ChromeBaseAppCompatAct
|
||||
if (!IntentHandler.hasAnyIncognitoExtra(intent.getExtras())) {
|
||||
WarmupManager.getInstance()
|
||||
.maybePreconnectUrlAndSubResources(
|
||||
Profile.getLastUsedRegularProfile(), url);
|
||||
ProfileManager.getLastUsedRegularProfile(), url);
|
||||
}
|
||||
} finally {
|
||||
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.metrics.UmaUtils;
|
||||
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.webapps.ChromeWebApkHost;
|
||||
import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerFactory;
|
||||
@ -359,7 +359,7 @@ public class ChromeBrowserInitializer {
|
||||
LibraryProcessType.PROCESS_BROWSER,
|
||||
/* singleProcess= */ false,
|
||||
/* startGpuProcess= */ startGpuProcess);
|
||||
SigninCheckerProvider.get(Profile.getLastUsedRegularProfile());
|
||||
SigninCheckerProvider.get(ProfileManager.getLastUsedRegularProfile());
|
||||
} finally {
|
||||
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.privacy.settings.PrivacyPreferencesManagerImpl;
|
||||
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.quickactionsearchwidget.QuickActionSearchWidgetProvider;
|
||||
import org.chromium.chrome.browser.rlz.RevenueStats;
|
||||
@ -432,7 +433,7 @@ public class ProcessInitializationHandler {
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SigninCheckerProvider.get(Profile.getLastUsedRegularProfile())
|
||||
SigninCheckerProvider.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.onMainActivityStart();
|
||||
RevenueStats.getInstance().retrieveAndApplyTrackingIds();
|
||||
}
|
||||
@ -489,7 +490,7 @@ public class ProcessInitializationHandler {
|
||||
() -> {
|
||||
// OptimizationTypes which we give a guarantee will be registered when we pass
|
||||
// the onDeferredStartup() signal to OptimizationGuide.
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
List<HintsProto.OptimizationType> registeredTypesAllowList = new ArrayList<>();
|
||||
registeredTypesAllowList.addAll(
|
||||
ShoppingPersistedTabData.getShoppingHintsToRegisterOnDeferredStartup(
|
||||
@ -508,7 +509,7 @@ public class ProcessInitializationHandler {
|
||||
() -> {
|
||||
if (ChromeFeatureList.isEnabled(ChromeFeatureList.FEATURE_NOTIFICATION_GUIDE)) {
|
||||
FeatureNotificationGuideServiceFactory.getForProfile(
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
});
|
||||
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.notifications.channels.SiteChannelsManager;
|
||||
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.usage_stats.UsageStatsService;
|
||||
import org.chromium.chrome.browser.webapps.ChromeWebApkHost;
|
||||
@ -592,7 +593,7 @@ public class NotificationPlatformBridge {
|
||||
final boolean silent,
|
||||
final ActionInfo[] actions) {
|
||||
final boolean vibrateEnabled =
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.getBoolean(NOTIFICATIONS_VIBRATE_ENABLED);
|
||||
final boolean incognito = profile.isOffTheRecord();
|
||||
// TODO(peter): by-pass this check for non-Web Notification types.
|
||||
@ -1203,7 +1204,7 @@ public class NotificationPlatformBridge {
|
||||
NotificationIdentifyingAttributes identifyingAttributes) {
|
||||
// TODO(crbug.com/1521432): Verify if we can/need to use the correct profile here.
|
||||
NotificationSuspender suspender =
|
||||
new NotificationSuspender(Profile.getLastUsedRegularProfile());
|
||||
new NotificationSuspender(ProfileManager.getLastUsedRegularProfile());
|
||||
List<String> notificationIdsToCancel =
|
||||
suspender.storeNotificationResourcesFromOrigins(
|
||||
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.
|
||||
NotificationSuspender suspender =
|
||||
new NotificationSuspender(Profile.getLastUsedRegularProfile());
|
||||
new NotificationSuspender(ProfileManager.getLastUsedRegularProfile());
|
||||
suspender.unsuspendNotificationsFromOrigins(
|
||||
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.preferences.ChromePreferenceKeys;
|
||||
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.components.segmentation_platform.PredictionOptions;
|
||||
import org.chromium.components.segmentation_platform.SegmentationPlatformService;
|
||||
@ -121,7 +121,7 @@ public class FeedPositionUtils {
|
||||
public static void cacheSegmentationResult() {
|
||||
SegmentationPlatformService segmentationPlatformService =
|
||||
SegmentationPlatformServiceFactory.getForProfile(
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
PredictionOptions options = new PredictionOptions(/* onDemandExecution= */ false);
|
||||
segmentationPlatformService.getClassificationResult(
|
||||
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.search.SearchBoxCoordinator;
|
||||
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.TileGroup;
|
||||
import org.chromium.chrome.browser.suggestions.tile.TileGroup.Delegate;
|
||||
@ -247,7 +248,7 @@ public class NewTabPageLayout extends LinearLayout {
|
||||
mIsNtpAsHomeSurfaceOnTablet = isNtpAsHomeSurfaceOnTablet;
|
||||
mIsSurfacePolishEnabled = isSurfacePolishEnabled;
|
||||
mIsSurfacePolishOmniboxColorEnabled = isSurfacePolishOmniboxColorEnabled;
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
mIsTablet = isTablet;
|
||||
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.ChromeSharedPreferences;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.profiles.ProfileManager;
|
||||
import org.chromium.chrome.browser.tab.TabLaunchType;
|
||||
import org.chromium.components.browser_ui.notifications.NotificationManagerProxy;
|
||||
import org.chromium.components.browser_ui.notifications.NotificationManagerProxyImpl;
|
||||
@ -294,7 +295,7 @@ public class AutoFetchNotifier {
|
||||
showCompleteNotificationWithParams(
|
||||
pageTitle, tabId, offlineId, originalUrl, finalUrl, params);
|
||||
},
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
private static void showCompleteNotificationWithParams(
|
||||
@ -384,7 +385,7 @@ public class AutoFetchNotifier {
|
||||
|
||||
private static void cancelInProgress() {
|
||||
// Using regular profile here, since this function is only called in regular mode.
|
||||
AutoFetchNotifierJni.get().cancelInProgress(Profile.getLastUsedRegularProfile());
|
||||
AutoFetchNotifierJni.get().cancelInProgress(ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
@NativeMethods
|
||||
|
@ -29,7 +29,7 @@ import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider;
|
||||
import org.chromium.chrome.browser.download.DownloadManagerService;
|
||||
import org.chromium.chrome.browser.offlinepages.OfflinePageOrigin;
|
||||
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.TabLaunchType;
|
||||
import org.chromium.chrome.browser.tabmodel.AsyncTabCreationParams;
|
||||
@ -103,7 +103,7 @@ public class OfflinePageDownloadBridge {
|
||||
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.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.profiles.ProfileManager;
|
||||
import org.chromium.chrome.browser.uid.SettingsSecureBasedIdentificationGenerator;
|
||||
|
||||
import java.util.List;
|
||||
@ -39,7 +40,7 @@ public class RlzPingHandler {
|
||||
|
||||
RlzPingHandlerJni.get()
|
||||
.startPing(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
brand,
|
||||
Locale.getDefault().getLanguage(),
|
||||
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.PriceTrackingUtilsJni;
|
||||
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.tab.Tab;
|
||||
import org.chromium.components.bookmarks.BookmarkId;
|
||||
@ -134,7 +135,7 @@ public class PriceTrackingActionProviderTest {
|
||||
SignalAccumulator accumulator = new SignalAccumulator(new Handler(), mMockTab, providers);
|
||||
// URL supports price tracking.
|
||||
setIsUrlPriceTrackableResult(true);
|
||||
Profile.setLastUsedProfileForTesting(mProfile);
|
||||
ProfileManager.setLastUsedProfileForTesting(mProfile);
|
||||
// URL is already bookmarked.
|
||||
doReturn(new BookmarkId(1L, 0)).when(mBookmarkModel).getUserBookmarkIdForTab(mMockTab);
|
||||
// Bookmark has price tracking information.
|
||||
@ -153,7 +154,7 @@ public class PriceTrackingActionProviderTest {
|
||||
SignalAccumulator accumulator = new SignalAccumulator(new Handler(), mMockTab, providers);
|
||||
// URL does not support price tracking.
|
||||
setIsUrlPriceTrackableResult(false);
|
||||
Profile.setLastUsedProfileForTesting(mProfile);
|
||||
ProfileManager.setLastUsedProfileForTesting(mProfile);
|
||||
// URL is bookmarked.
|
||||
doReturn(new BookmarkId(1L, 0)).when(mBookmarkModel).getUserBookmarkIdForTab(mMockTab);
|
||||
// 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.PrivacySandboxSettingsBaseFragment;
|
||||
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.safe_browsing.settings.SafeBrowsingSettingsFragmentBase;
|
||||
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
|
||||
// recreate a fragment, and a fragment might depend on the native library.
|
||||
ChromeBrowserInitializer.getInstance().handleSynchronousStartup();
|
||||
mProfile = Profile.getLastUsedRegularProfile();
|
||||
mProfile = ProfileManager.getLastUsedRegularProfile();
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
@ -9,6 +9,7 @@ import org.jni_zero.NativeMethods;
|
||||
|
||||
import org.chromium.base.Callback;
|
||||
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_device_info.FormFactor;
|
||||
|
||||
@ -31,7 +32,7 @@ public class SharingServiceProxy {
|
||||
if (sNativeSharingServiceProxyAndroid == 0) {
|
||||
// The service hasn't been created yet.
|
||||
Natives jni = SharingServiceProxyJni.get();
|
||||
jni.initSharingService(Profile.getLastUsedRegularProfile());
|
||||
jni.initSharingService(ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
sInstance = new SharingServiceProxy();
|
||||
|
@ -11,7 +11,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import org.chromium.base.ResettersForTesting;
|
||||
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.SigninManager;
|
||||
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) {
|
||||
SigninManager signinManager =
|
||||
IdentityServicesProvider.get()
|
||||
.getSigninManager(Profile.getLastUsedRegularProfile());
|
||||
.getSigninManager(ProfileManager.getLastUsedRegularProfile());
|
||||
if (signinManager.isSyncOptInAllowed()) {
|
||||
launchInternal(context, SyncConsentFragmentBase.createArguments(accessPoint, null));
|
||||
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.ChromeSharedPreferences;
|
||||
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.ui.searchactivityutils.SearchActivityPreferencesManager;
|
||||
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. */
|
||||
private void refreshStorageNumbers() {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(profile);
|
||||
fetcher.fetchPreferencesForCategory(
|
||||
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.
|
||||
*/
|
||||
public void clearData() {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
WebsitePermissionsFetcher fetcher = new WebsitePermissionsFetcher(profile, true);
|
||||
fetcher.fetchPreferencesForCategory(
|
||||
SiteSettingsCategory.createFromType(
|
||||
@ -322,7 +323,7 @@ public class ManageSpaceActivity extends AppCompatActivity implements View.OnCli
|
||||
if (site.getLocalStorageInfo() == null
|
||||
|| !site.getLocalStorageInfo().isDomainImportant()) {
|
||||
mNumSitesClearing++;
|
||||
site.clearAllStoredData(Profile.getLastUsedRegularProfile(), this);
|
||||
site.clearAllStoredData(ProfileManager.getLastUsedRegularProfile(), this);
|
||||
} else {
|
||||
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.ChromeSharedPreferences;
|
||||
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;
|
||||
|
||||
/** 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() {
|
||||
RecordHistogram.recordBooleanHistogram(
|
||||
"NewTabPage.ContentSuggestions.ArticlesListVisible",
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.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.offlinepages.OfflinePageBridge;
|
||||
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.SuggestionsDependencyFactory;
|
||||
import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
|
||||
@ -140,7 +141,7 @@ public class MostVisitedTilesCoordinator implements ConfigurationChangedObserver
|
||||
TileGroup.Delegate tileGroupDelegate,
|
||||
TouchEnabledDelegate touchEnabledDelegate) {
|
||||
mActivityLifecycleDispatcher.register(this);
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
if (mRenderer == null) {
|
||||
mRenderer =
|
||||
new TileRenderer(
|
||||
|
4
chrome/android/java/src/org/chromium/chrome/browser/suggestions/tile/MostVisitedTilesMediator.java
4
chrome/android/java/src/org/chromium/chrome/browser/suggestions/tile/MostVisitedTilesMediator.java
@ -25,7 +25,7 @@ import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.flags.ChromeFeatureList;
|
||||
import org.chromium.chrome.browser.native_page.ContextMenuManager;
|
||||
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.suggestions.SiteSuggestion;
|
||||
import org.chromium.chrome.browser.suggestions.SuggestionsUiDelegate;
|
||||
@ -142,7 +142,7 @@ public class MostVisitedTilesMediator implements TileGroup.Observer, TemplateUrl
|
||||
mTileGroup.startObserving(MAX_RESULTS);
|
||||
|
||||
mTemplateUrlService =
|
||||
TemplateUrlServiceFactory.getForProfile(Profile.getLastUsedRegularProfile());
|
||||
TemplateUrlServiceFactory.getForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
mTemplateUrlService.addObserver(this);
|
||||
|
||||
onSearchEngineHasLogoChanged();
|
||||
|
@ -25,7 +25,7 @@ import org.chromium.base.task.TaskTraits;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
|
||||
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.suggestions.ImageFetcher;
|
||||
import org.chromium.chrome.browser.suggestions.SiteSuggestion;
|
||||
@ -172,7 +172,8 @@ public class TileRenderer {
|
||||
|
||||
/** Record that a tile was clicked for IPH reasons. */
|
||||
private void recordTileClickedForIPH(String eventName) {
|
||||
Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedRegularProfile());
|
||||
Tracker tracker =
|
||||
TrackerFactory.getTrackerForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
tracker.notifyEvent(eventName);
|
||||
}
|
||||
|
||||
@ -253,7 +254,7 @@ public class TileRenderer {
|
||||
/** @return True, if the tile represents a Search query. */
|
||||
private boolean isSearchTile(Tile tile) {
|
||||
TemplateUrlService searchService =
|
||||
TemplateUrlServiceFactory.getForProfile(Profile.getLastUsedRegularProfile());
|
||||
TemplateUrlServiceFactory.getForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
return searchService != null
|
||||
&& searchService.isSearchResultsPageFromDefaultSearchProvider(tile.getUrl());
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
|
||||
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.sync.SyncErrorNotifier;
|
||||
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
|
||||
// process and this wouldn't be necessary.
|
||||
ChromeBrowserInitializer.getInstance().handleSynchronousStartup();
|
||||
mProfile = Profile.getLastUsedRegularProfile();
|
||||
mProfile = ProfileManager.getLastUsedRegularProfile();
|
||||
mIdentityManager = IdentityServicesProvider.get().getIdentityManager(mProfile);
|
||||
mSyncService = SyncServiceFactory.getForProfile(mProfile);
|
||||
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.PrefChangeRegistrar;
|
||||
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.tab.Tab;
|
||||
import org.chromium.chrome.browser.tab.TabLaunchType;
|
||||
@ -843,7 +844,7 @@ public final class ReturnToChromeUtil {
|
||||
public static void cacheReturnTimeFromSegmentation() {
|
||||
SegmentationPlatformService segmentationPlatformService =
|
||||
SegmentationPlatformServiceFactory.getForProfile(
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
PredictionOptions predictionOptions = new PredictionOptions(false);
|
||||
segmentationPlatformService.getClassificationResult(
|
||||
START_V2_SEGMENTATION_PLATFORM_KEY,
|
||||
@ -902,7 +903,7 @@ public final class ReturnToChromeUtil {
|
||||
}
|
||||
|
||||
private static void updateFeedVisibility() {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
ChromeSharedPreferences.getInstance()
|
||||
.writeBoolean(
|
||||
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.price_tracking.PriceTrackingButtonController;
|
||||
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.QuickDeleteDelegateImpl;
|
||||
import org.chromium.chrome.browser.readaloud.ReadAloudController;
|
||||
@ -547,7 +548,7 @@ public class RootUiCoordinator
|
||||
|
||||
@Override
|
||||
public BrowserContextHandle getBrowserContextHandle() {
|
||||
return Profile.getLastUsedRegularProfile();
|
||||
return ProfileManager.getLastUsedRegularProfile();
|
||||
}
|
||||
});
|
||||
mFoldTransitionController =
|
||||
@ -872,7 +873,7 @@ public class RootUiCoordinator
|
||||
if (DeviceFormFactor.isWindowOnTablet(mWindowAndroid)
|
||||
&& (RequestDesktopUtils.maybeDefaultEnableGlobalSetting(
|
||||
getPrimaryDisplaySizeInInches(),
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
mActivity))) {
|
||||
// TODO(crbug.com/1350274): Remove this explicit load when this bug is addressed.
|
||||
if (mActivityTabProvider != null && mActivityTabProvider.get() != null) {
|
||||
@ -883,7 +884,7 @@ public class RootUiCoordinator
|
||||
}
|
||||
|
||||
RequestDesktopUtils.maybeDefaultEnableWindowSetting(
|
||||
mActivity, Profile.getLastUsedRegularProfile());
|
||||
mActivity, ProfileManager.getLastUsedRegularProfile());
|
||||
|
||||
if (ChromeFeatureList.isEnabled(ChromeFeatureList.READALOUD)) {
|
||||
TabModelSelector tabModelSelector = mTabModelSelectorSupplier.get();
|
||||
@ -1001,7 +1002,7 @@ public class RootUiCoordinator
|
||||
}
|
||||
|
||||
private void initMerchantTrustSignals() {
|
||||
if (ShoppingServiceFactory.getForProfile(Profile.getLastUsedRegularProfile())
|
||||
if (ShoppingServiceFactory.getForProfile(ProfileManager.getLastUsedRegularProfile())
|
||||
.isMerchantViewerEnabled()
|
||||
&& shouldInitializeMerchantTrustSignals()) {
|
||||
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.preferences.Pref;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.profiles.ProfileManager;
|
||||
import org.chromium.components.user_prefs.UserPrefs;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@ -80,7 +81,7 @@ public class UsageStatsService {
|
||||
|
||||
@VisibleForTesting
|
||||
UsageStatsService() {
|
||||
mProfile = Profile.getLastUsedRegularProfile();
|
||||
mProfile = ProfileManager.getLastUsedRegularProfile();
|
||||
mBridge = new UsageStatsBridge(mProfile, this);
|
||||
mEventTracker = new EventTracker(mBridge);
|
||||
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.CommandLineFlags;
|
||||
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.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.components.image_fetcher.ImageFetcher;
|
||||
@ -76,7 +76,7 @@ public class ImageFetcherIntegrationTest {
|
||||
ImageFetcher imageFetcher =
|
||||
ImageFetcherFactory.createImageFetcher(
|
||||
ImageFetcherConfig.NETWORK_ONLY,
|
||||
Profile.getLastUsedRegularProfile().getProfileKey());
|
||||
ProfileManager.getLastUsedRegularProfile().getProfileKey());
|
||||
imageFetcher.fetchImage(params, callbackWaiter);
|
||||
return null;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import org.jni_zero.NativeMethods;
|
||||
import org.chromium.base.test.util.CallbackHelper;
|
||||
import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.profiles.ProfileManager;
|
||||
import org.chromium.content_public.browser.test.util.TestThreadUtils;
|
||||
|
||||
/** Static methods for use in tests to manipulate the PWA App list for restoring. */
|
||||
@ -24,7 +25,7 @@ public class PwaRestoreBottomSheetTestUtils {
|
||||
ChromeBrowserInitializer.getInstance().handleSynchronousStartup();
|
||||
PwaRestoreBottomSheetTestUtilsJni.get()
|
||||
.waitForWebApkDatabaseInitialization(
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
});
|
||||
sCallbackHelper.waitForNext();
|
||||
}
|
||||
@ -36,7 +37,9 @@ public class PwaRestoreBottomSheetTestUtils {
|
||||
() -> {
|
||||
PwaRestoreBottomSheetTestUtilsJni.get()
|
||||
.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.chrome.browser.app.metrics.LaunchCauseMetrics;
|
||||
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.test.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
|
||||
@ -58,7 +58,7 @@ public class ShareIntentTest {
|
||||
ThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
ShareHelper.setLastShareComponentName(
|
||||
Profile.getLastUsedRegularProfile(), target);
|
||||
ProfileManager.getLastUsedRegularProfile(), target);
|
||||
mActivityTestRule
|
||||
.getActivity()
|
||||
.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.chrome.browser.flags.ChromeSwitches;
|
||||
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.ChromeTabbedActivityTestRule;
|
||||
import org.chromium.components.prefs.PrefService;
|
||||
@ -56,7 +56,7 @@ public class VirtualKeyboardResizeTest {
|
||||
private EmbeddedTestServer mTestServer;
|
||||
|
||||
private static PrefService getPrefService() {
|
||||
return UserPrefs.get(Profile.getLastUsedRegularProfile());
|
||||
return UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
@Before
|
||||
|
@ -42,6 +42,7 @@ import org.chromium.chrome.browser.flags.ChromeSwitches;
|
||||
import org.chromium.chrome.browser.init.ChromeBrowserInitializer;
|
||||
import org.chromium.chrome.browser.profiles.OTRProfileID;
|
||||
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.TabLaunchType;
|
||||
import org.chromium.chrome.browser.tabmodel.TabCreator;
|
||||
@ -232,7 +233,7 @@ public class WarmupManagerTest {
|
||||
(Callable<Profile>)
|
||||
() -> {
|
||||
OTRProfileID otrProfileID = OTRProfileID.createUnique("CCT:Incognito");
|
||||
return Profile.getLastUsedRegularProfile()
|
||||
return ProfileManager.getLastUsedRegularProfile()
|
||||
.getOffTheRecordProfile(
|
||||
otrProfileID, /* createIfNeeded= */ true);
|
||||
});
|
||||
@ -242,13 +243,13 @@ public class WarmupManagerTest {
|
||||
return TestThreadUtils.runOnUiThreadBlockingNoException(
|
||||
(Callable<Profile>)
|
||||
() ->
|
||||
Profile.getLastUsedRegularProfile()
|
||||
ProfileManager.getLastUsedRegularProfile()
|
||||
.getPrimaryOTRProfile(/* createIfNeeded= */ true));
|
||||
}
|
||||
|
||||
private static Profile getRegularProfile() {
|
||||
return TestThreadUtils.runOnUiThreadBlockingNoException(
|
||||
(Callable<Profile>) () -> Profile.getLastUsedRegularProfile());
|
||||
(Callable<Profile>) () -> ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
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.chrome.browser.preferences.ChromePreferenceKeys;
|
||||
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.components.browser_ui.accessibility.FontSizePrefs;
|
||||
import org.chromium.components.browser_ui.accessibility.FontSizePrefs.FontSizePrefsObserver;
|
||||
@ -190,7 +190,7 @@ public class FontSizePrefsTest {
|
||||
|
||||
private FontSizePrefs getFontSizePrefs(final Context context) {
|
||||
return TestThreadUtils.runOnUiThreadBlockingNoException(
|
||||
() -> FontSizePrefs.getInstance(Profile.getLastUsedRegularProfile()));
|
||||
() -> FontSizePrefs.getInstance(ProfileManager.getLastUsedRegularProfile()));
|
||||
}
|
||||
|
||||
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.DisableFeatures;
|
||||
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.test.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.chrome.test.R;
|
||||
@ -522,7 +522,7 @@ public class AccessibilitySettingsTest {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
FontSizePrefs fontSizePrefs =
|
||||
FontSizePrefs.getInstance(Profile.getLastUsedRegularProfile());
|
||||
FontSizePrefs.getInstance(ProfileManager.getLastUsedRegularProfile());
|
||||
Assert.assertEquals(
|
||||
expectedForceEnableZoom, fontSizePrefs.getForceEnableZoom());
|
||||
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.LayoutType;
|
||||
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.sync.FakeSyncServiceImpl;
|
||||
import org.chromium.chrome.browser.sync.SyncServiceFactory;
|
||||
@ -130,7 +130,7 @@ public class TabbedAppMenuTest {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
WebsitePreferenceBridge.setCategoryEnabled(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
ContentSettingsType.REQUEST_DESKTOP_SITE,
|
||||
false);
|
||||
});
|
||||
@ -358,7 +358,7 @@ public class TabbedAppMenuTest {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
WebsitePreferenceBridge.setCategoryEnabled(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
ContentSettingsType.REQUEST_DESKTOP_SITE,
|
||||
true);
|
||||
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.BookmarkModelObserver;
|
||||
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.util.BookmarkTestUtil;
|
||||
import org.chromium.components.bookmarks.BookmarkId;
|
||||
@ -79,7 +79,8 @@ public class BookmarkEditTest {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
sBookmarkModel =
|
||||
BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile());
|
||||
BookmarkModel.getForProfile(
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
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.flags.ChromeFeatureList;
|
||||
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.util.BookmarkTestUtil;
|
||||
import org.chromium.components.bookmarks.BookmarkId;
|
||||
@ -92,7 +92,7 @@ public class BookmarkFolderPickerActivityTest {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
sBookmarkModel =
|
||||
BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile());
|
||||
BookmarkModel.getForProfile(ProfileManager.getLastUsedRegularProfile());
|
||||
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.preferences.Pref;
|
||||
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.SettingsActivityTestRule;
|
||||
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
|
||||
@ -1152,7 +1153,7 @@ public class AutofillPaymentMethodsFragmentTest {
|
||||
}
|
||||
|
||||
private static PrefService getPrefService() {
|
||||
return UserPrefs.get(Profile.getLastUsedRegularProfile());
|
||||
return UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
|
||||
}
|
||||
|
||||
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.chrome.browser.background_sync.BackgroundSyncBackgroundTaskScheduler.BackgroundSyncTask;
|
||||
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.test.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.chrome.test.ChromeTabbedActivityTestRule;
|
||||
@ -234,7 +234,8 @@ public final class PeriodicBackgroundSyncTest {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
// TODO (https://crbug.com/1063807): Add incognito mode tests.
|
||||
SiteEngagementService.getForBrowserContext(Profile.getLastUsedRegularProfile())
|
||||
SiteEngagementService.getForBrowserContext(
|
||||
ProfileManager.getLastUsedRegularProfile())
|
||||
.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.chrome.browser.flags.ChromeFeatureList;
|
||||
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.ui.signin.SyncPromoController.SyncPromoState;
|
||||
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
|
||||
@ -72,7 +72,9 @@ public class AccountBookmarkTest {
|
||||
BookmarkPromoHeader.forcePromoStateForTesting(SyncPromoState.NO_PROMO);
|
||||
mBookmarkModel =
|
||||
runOnUiThreadBlocking(
|
||||
() -> BookmarkModel.getForProfile(Profile.getLastUsedRegularProfile()));
|
||||
() ->
|
||||
BookmarkModel.getForProfile(
|
||||
ProfileManager.getLastUsedRegularProfile()));
|
||||
mSyncTestRule.setUpAccountAndSignInForTesting();
|
||||
mBookmarkManagerCoordinator =
|
||||
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.RequiresRestart;
|
||||
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.util.BookmarkTestUtil;
|
||||
import org.chromium.components.bookmarks.BookmarkId;
|
||||
@ -47,7 +48,7 @@ public class BookmarkBridgeTest {
|
||||
public void setUp() {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
mBookmarkBridge = BookmarkBridge.getForProfile(profile);
|
||||
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.flags.ChromeFeatureList;
|
||||
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.util.ChromeRenderTestRule;
|
||||
import org.chromium.components.bookmarks.BookmarkId;
|
||||
@ -130,7 +131,7 @@ public class BookmarkFolderPickerRenderTest {
|
||||
mActivity.setTheme(R.style.Theme_BrowserUI_DayNight);
|
||||
|
||||
// Setup profile-related factories.
|
||||
Profile.setLastUsedProfileForTesting(mProfile);
|
||||
ProfileManager.setLastUsedProfileForTesting(mProfile);
|
||||
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.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.util.BookmarkTestUtil;
|
||||
import org.chromium.components.bookmarks.BookmarkId;
|
||||
@ -55,7 +56,7 @@ public class BookmarkModelTest {
|
||||
public void setUp() {
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
mBookmarkModel = BookmarkModel.getForProfile(profile);
|
||||
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.partnerbookmarks.PartnerBookmarksShim;
|
||||
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.test.ChromeActivityTestRule;
|
||||
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
|
||||
@ -117,7 +118,7 @@ public class BookmarkSaveFlowTest {
|
||||
mBottomSheetController,
|
||||
mShoppingService,
|
||||
mUserEducationHelper,
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
mIdentityManager);
|
||||
});
|
||||
|
||||
|
4
chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataBridgeTest.java
4
chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataBridgeTest.java
@ -31,7 +31,7 @@ import org.chromium.base.test.util.CommandLineFlags;
|
||||
import org.chromium.base.test.util.UserActionTester;
|
||||
import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider;
|
||||
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.TabState;
|
||||
import org.chromium.chrome.browser.tab.TabStateExtractor;
|
||||
@ -89,7 +89,7 @@ public class BrowsingDataBridgeTest {
|
||||
|
||||
private BrowsingDataBridge getBrowsingDataBridge() {
|
||||
return ThreadUtils.runOnUiThreadBlockingNoException(
|
||||
() -> BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile()));
|
||||
() -> BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile()));
|
||||
}
|
||||
|
||||
/** 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.PasswordStoreBridge;
|
||||
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.ChromeTabbedActivityTestRule;
|
||||
import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule;
|
||||
@ -74,7 +74,7 @@ public class BrowsingDataTest {
|
||||
CallbackHelper helper = new CallbackHelper();
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile())
|
||||
BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
|
||||
.clearBrowsingData(
|
||||
helper::notifyCalled, new int[] {dataType}, timePeriod);
|
||||
});
|
||||
@ -95,7 +95,7 @@ public class BrowsingDataTest {
|
||||
() -> {
|
||||
counter[0] =
|
||||
new BrowsingDataCounterBridge(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
callback,
|
||||
BrowsingDataType.COOKIES,
|
||||
ClearBrowsingDataTab.ADVANCED);
|
||||
@ -178,7 +178,7 @@ public class BrowsingDataTest {
|
||||
CallbackHelper helper = new CallbackHelper();
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile())
|
||||
BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
|
||||
.clearBrowsingDataIncognitoForTesting(
|
||||
helper::notifyCalled,
|
||||
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.notifications.channels.SiteChannelsManager;
|
||||
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.SettingsActivityTestRule;
|
||||
import org.chromium.chrome.browser.signin.services.IdentityServicesProvider;
|
||||
@ -212,7 +213,7 @@ public class ClearBrowsingDataFragmentTest {
|
||||
CriteriaHelper.pollUiThread(
|
||||
() ->
|
||||
!IdentityServicesProvider.get()
|
||||
.getIdentityManager(Profile.getLastUsedRegularProfile())
|
||||
.getIdentityManager(ProfileManager.getLastUsedRegularProfile())
|
||||
.hasPrimaryAccount(ConsentLevel.SIGNIN),
|
||||
"Account should be signed out!");
|
||||
|
||||
|
7
chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java
7
chrome/android/javatests/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerTest.java
@ -69,6 +69,7 @@ import org.chromium.chrome.browser.layouts.LayoutTestUtils;
|
||||
import org.chromium.chrome.browser.layouts.LayoutType;
|
||||
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.tab.MockTab;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
import org.chromium.chrome.browser.tab.TabLaunchType;
|
||||
@ -219,8 +220,8 @@ public class LayoutManagerTest implements MockTabModelDelegate {
|
||||
|
||||
mTabModelSelector =
|
||||
new MockTabModelSelector(
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
Profile.getLastUsedRegularProfile().getPrimaryOTRProfile(true),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile().getPrimaryOTRProfile(true),
|
||||
standardTabCount,
|
||||
incognitoTabCount,
|
||||
this);
|
||||
@ -901,7 +902,7 @@ public class LayoutManagerTest implements MockTabModelDelegate {
|
||||
|
||||
@Override
|
||||
public MockTab createTab(int id, boolean incognito) {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
return MockTab.createAndInitialize(
|
||||
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.TimePeriod;
|
||||
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.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge;
|
||||
@ -51,7 +52,7 @@ public class ContentSettingsObserverTest {
|
||||
CallbackHelper helper = new CallbackHelper();
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
BrowsingDataBridge.getForProfile(Profile.getLastUsedRegularProfile())
|
||||
BrowsingDataBridge.getForProfile(ProfileManager.getLastUsedRegularProfile())
|
||||
.clearBrowsingData(
|
||||
helper::notifyCalled,
|
||||
new int[] {BrowsingDataType.SITE_SETTINGS},
|
||||
@ -64,7 +65,7 @@ public class ContentSettingsObserverTest {
|
||||
@SmallTest
|
||||
@UiThreadTest
|
||||
public void testContentSettingChanges() throws TimeoutException {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
ContentSettingsObserver observer =
|
||||
new ContentSettingsObserver(profile) {
|
||||
@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.LocaleManagerDelegate;
|
||||
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.test.ChromeTabbedActivityTestRule;
|
||||
import org.chromium.chrome.test.batch.BlankCTATabInitialStateRule;
|
||||
@ -137,7 +138,7 @@ public class ContextualSearchInstrumentationBase {
|
||||
() -> activity.getLastUserInteractionTime(),
|
||||
activity.getEdgeToEdgeControllerSupplierForTesting());
|
||||
setSelectionController(new MockCSSelectionController(activity, this));
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
WebContents webContents = WebContentsFactory.createWebContents(profile, false, false);
|
||||
ContentView cv =
|
||||
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.preferences.Pref;
|
||||
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.signin.services.UnifiedConsentServiceBridge;
|
||||
import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
|
||||
@ -61,7 +62,7 @@ public class ContextualSearchPolicyTest {
|
||||
() -> {
|
||||
mPolicy = new ContextualSearchPolicy(null, mMockServer);
|
||||
|
||||
mProfile = Profile.getLastUsedRegularProfile();
|
||||
mProfile = ProfileManager.getLastUsedRegularProfile();
|
||||
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.preferences.Pref;
|
||||
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.TranslateBridgeJni;
|
||||
import org.chromium.chrome.browser.ui.appmenu.AppMenuItemProperties;
|
||||
@ -589,7 +590,7 @@ public class CustomTabActivityIncognitoTest {
|
||||
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.setBoolean(Pref.INCOGNITO_REAUTHENTICATION_FOR_ANDROID, true);
|
||||
IncognitoReauthController incognitoReauthController =
|
||||
customTabActivity
|
||||
@ -610,7 +611,7 @@ public class CustomTabActivityIncognitoTest {
|
||||
assertTrue(
|
||||
"Re-auth screen should be shown.",
|
||||
incognitoReauthController.isReauthPageShowing());
|
||||
UserPrefs.get(Profile.getLastUsedRegularProfile())
|
||||
UserPrefs.get(ProfileManager.getLastUsedRegularProfile())
|
||||
.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.ChromeSharedPreferences;
|
||||
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.Tab;
|
||||
import org.chromium.chrome.browser.tab.Tab.LoadUrlResult;
|
||||
@ -1485,7 +1486,7 @@ public class CustomTabActivityTest {
|
||||
// Needs the browser process to be initialized.
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
PrefService prefs = UserPrefs.get(Profile.getLastUsedRegularProfile());
|
||||
PrefService prefs = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
|
||||
int old_block_pref = prefs.getInteger(COOKIE_CONTROLS_MODE);
|
||||
prefs.setInteger(COOKIE_CONTROLS_MODE, CookieControlsMode.OFF);
|
||||
Assert.assertTrue(connection.maySpeculate(token));
|
||||
|
8
chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java
8
chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/DetachedResourceRequestTest.java
@ -42,7 +42,7 @@ import org.chromium.chrome.browser.browserservices.verification.ChromeOriginVeri
|
||||
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
|
||||
import org.chromium.chrome.browser.firstrun.FirstRunStatus;
|
||||
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.test.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.components.content_settings.CookieControlsMode;
|
||||
@ -448,7 +448,7 @@ public class DetachedResourceRequestTest {
|
||||
mServer = EmbeddedTestServer.createAndStartHTTPSServer(mContext, ServerCertificate.CERT_OK);
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
PrefService prefs = UserPrefs.get(Profile.getLastUsedRegularProfile());
|
||||
PrefService prefs = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
|
||||
Assert.assertEquals(
|
||||
prefs.getInteger(COOKIE_CONTROLS_MODE),
|
||||
CookieControlsMode.INCOGNITO_ONLY);
|
||||
@ -493,7 +493,7 @@ public class DetachedResourceRequestTest {
|
||||
// This isn't blocking third-party cookies by preferences.
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
PrefService prefs = UserPrefs.get(Profile.getLastUsedRegularProfile());
|
||||
PrefService prefs = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
|
||||
Assert.assertEquals(
|
||||
prefs.getInteger(COOKIE_CONTROLS_MODE),
|
||||
CookieControlsMode.INCOGNITO_ONLY);
|
||||
@ -538,7 +538,7 @@ public class DetachedResourceRequestTest {
|
||||
mServer = EmbeddedTestServer.createAndStartServer(mContext);
|
||||
TestThreadUtils.runOnUiThreadBlocking(
|
||||
() -> {
|
||||
PrefService prefs = UserPrefs.get(Profile.getLastUsedRegularProfile());
|
||||
PrefService prefs = UserPrefs.get(ProfileManager.getLastUsedRegularProfile());
|
||||
Assert.assertEquals(
|
||||
prefs.getInteger(COOKIE_CONTROLS_MODE),
|
||||
CookieControlsMode.INCOGNITO_ONLY);
|
||||
|
7
chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java
7
chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java
@ -66,6 +66,7 @@ import org.chromium.chrome.browser.offlinepages.ClientId;
|
||||
import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
|
||||
import org.chromium.chrome.browser.omnibox.UrlBar;
|
||||
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.TrustedCdn;
|
||||
import org.chromium.chrome.browser.test.ScreenShooter;
|
||||
@ -203,8 +204,8 @@ public class TrustedCdnPublisherUrlTest {
|
||||
public void testRtl() throws Exception {
|
||||
String publisher =
|
||||
"\u200e\u202b\u0645\u0648\u0642\u0639\u002e\u0648\u0632\u0627\u0631"
|
||||
+ "\u0629\u002d\u0627\u0644\u0623\u062a\u0635\u0627\u0644\u0627\u062a\u002e\u0645"
|
||||
+ "\u0635\u0631\u202c\u200e";
|
||||
+ "\u0629\u002d\u0627\u0644\u0623\u062a\u0635\u0627\u0644\u0627\u062a\u002e\u0645"
|
||||
+ "\u0635\u0631\u202c\u200e";
|
||||
runTrustedCdnPublisherUrlTest(
|
||||
"http://xn--4gbrim.xn----rmckbbajlc6dj7bxne2c.xn--wgbh1c/",
|
||||
"com.example.test",
|
||||
@ -355,7 +356,7 @@ public class TrustedCdnPublisherUrlTest {
|
||||
OfflinePageBridge offlinePageBridge =
|
||||
TestThreadUtils.runOnUiThreadBlockingNoException(
|
||||
() -> {
|
||||
Profile profile = Profile.getLastUsedRegularProfile();
|
||||
Profile profile = ProfileManager.getLastUsedRegularProfile();
|
||||
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.MaxAndroidSdkLevel;
|
||||
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.ChromeTabbedActivityTestRule;
|
||||
import org.chromium.chrome.test.R;
|
||||
@ -166,7 +166,7 @@ public class BluetoothChooserDialogTest {
|
||||
"https://origin.example.com/",
|
||||
ConnectionSecurityLevel.SECURE,
|
||||
new ChromeBluetoothChooserAndroidDelegate(
|
||||
Profile.getLastUsedRegularProfile()),
|
||||
ProfileManager.getLastUsedRegularProfile()),
|
||||
/* nativeBluetoothChooserDialogPtr= */ 42);
|
||||
dialog.show();
|
||||
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.JniMocker;
|
||||
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.ChromeTabbedActivityTestRule;
|
||||
import org.chromium.chrome.test.R;
|
||||
@ -88,7 +88,7 @@ public class BluetoothScanningPermissionDialogTest {
|
||||
"https://origin.example.com/",
|
||||
ConnectionSecurityLevel.SECURE,
|
||||
new ChromeBluetoothScanningPromptAndroidDelegate(
|
||||
Profile.getLastUsedRegularProfile()),
|
||||
ProfileManager.getLastUsedRegularProfile()),
|
||||
/* nativeBluetoothScanningPermissionDialogPtr= */ 42);
|
||||
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.JniMocker;
|
||||
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.ChromeTabbedActivityTestRule;
|
||||
import org.chromium.chrome.test.R;
|
||||
@ -93,7 +93,7 @@ public class UsbChooserDialogTest {
|
||||
UsbChooserDialog dialog =
|
||||
new UsbChooserDialog(
|
||||
/* nativeUsbChooserDialogPtr= */ 42,
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
dialog.show(
|
||||
sActivityTestRule.getActivity(),
|
||||
"https://origin.example.com/",
|
||||
@ -218,7 +218,7 @@ public class UsbChooserDialogTest {
|
||||
mockWindowAndroid,
|
||||
"https://origin.example.com/",
|
||||
ConnectionSecurityLevel.SECURE,
|
||||
Profile.getLastUsedRegularProfile(),
|
||||
ProfileManager.getLastUsedRegularProfile(),
|
||||
/* nativeUsbChooserDialogPtr= */ 42);
|
||||
});
|
||||
Assert.assertNull(dialog);
|
||||
|
4
chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java
4
chrome/android/javatests/src/org/chromium/chrome/browser/dom_distiller/DistilledPagePrefsTest.java
@ -19,7 +19,7 @@ import org.chromium.base.test.BaseJUnit4ClassRunner;
|
||||
import org.chromium.base.test.UiThreadTest;
|
||||
import org.chromium.base.test.util.Batch;
|
||||
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.components.dom_distiller.core.DistilledPagePrefs;
|
||||
import org.chromium.components.dom_distiller.core.DomDistillerService;
|
||||
@ -63,7 +63,7 @@ public class DistilledPagePrefsTest {
|
||||
// TODO (https://crbug.com/1063807): Add incognito mode tests.
|
||||
DomDistillerService domDistillerService =
|
||||
DomDistillerServiceFactory.getForProfile(
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
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.incognito.IncognitoNotificationServiceImpl;
|
||||
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.test.ChromeJUnit4ClassRunner;
|
||||
import org.chromium.chrome.test.R;
|
||||
@ -352,7 +352,7 @@ public class ReaderModeTest implements CustomMainActivityStart {
|
||||
() -> {
|
||||
DomDistillerService domDistillerService =
|
||||
DomDistillerServiceFactory.getForProfile(
|
||||
Profile.getLastUsedRegularProfile());
|
||||
ProfileManager.getLastUsedRegularProfile());
|
||||
prefs.set(domDistillerService.getDistilledPagePrefs());
|
||||
});
|
||||
return prefs.get();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user