Commit bb643f57 authored by Side Yilmaz's avatar Side Yilmaz Committed by Commit Bot

Replace deprecated getLastUsedProfile function in OfflinePage classes.

|Profile#getLastUsedProfile| is depreciated and replaced with
|Profile#getLastUsedRegularProfile|. This CL updates OfflinePage
classes.

Note: This change is only code clean-up, does not change any behaviour.

Bug: 1041781, 1067314
Change-Id: I73fa1791aa8c862ee0c9833eeb13db1c92ac411d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2126989
Commit-Queue: Side YILMAZ <sideyilmaz@chromium.org>
Reviewed-by: default avatarCarlos Knippschild <carlosk@chromium.org>
Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756994}
parent 6bf1c454
......@@ -361,7 +361,10 @@ public class AutoFetchNotifier {
}
private static void cancelInProgress() {
AutoFetchNotifierJni.get().cancelInProgress(Profile.getLastUsedProfile());
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
AutoFetchNotifierJni.get().cancelInProgress(Profile.getLastUsedRegularProfile());
}
@NativeMethods
......
......@@ -639,7 +639,7 @@ public class OfflinePageUtils {
*/
public static void getLoadUrlParamsForOpeningOfflineVersion(final String url, long offlineId,
final @LaunchLocation int location, Callback<LoadUrlParams> callback) {
// TODO(https://crbug.com/1041781): Use the current profile (i.e., regular profile or
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
OfflinePageBridge offlinePageBridge =
......@@ -662,7 +662,7 @@ public class OfflinePageUtils {
*/
public static void getLoadUrlParamsForOpeningMhtmlFileOrContent(
final String intentUrl, Callback<LoadUrlParams> callback) {
// TODO(https://crbug.com/1041781): Use the current profile (i.e., regular profile or
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
OfflinePageBridge offlinePageBridge =
......
......@@ -271,7 +271,10 @@ public class OfflineNotificationBackgroundTask extends NativeBackgroundTask {
if (sOfflinePageBridgeForTesting != null) {
return sOfflinePageBridgeForTesting;
}
return OfflinePageBridge.getForProfile(Profile.getLastUsedProfile());
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
return OfflinePageBridge.getForProfile(Profile.getLastUsedRegularProfile());
}
@VisibleForTesting
......
......@@ -41,15 +41,22 @@ public class PrefetchConfiguration {
* user setting to be true. If the current browser Profile is null this method returns false.
*/
public static boolean isPrefetchingEnabled() {
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
return PrefetchConfigurationJni.get().isPrefetchingEnabled(
ProfileKey.getLastUsedProfileKey());
ProfileKey.getLastUsedRegularProfileKey());
}
/**
* Return the value of offline_pages.enabled_by_server pref.
*/
public static boolean isPrefetchingEnabledByServer() {
return PrefetchConfigurationJni.get().isEnabledByServer(ProfileKey.getLastUsedProfileKey());
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
return PrefetchConfigurationJni.get().isEnabledByServer(
ProfileKey.getLastUsedRegularProfileKey());
}
/**
......@@ -58,16 +65,22 @@ public class PrefetchConfiguration {
* since the last check.
*/
public static boolean isForbiddenCheckDue() {
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
return PrefetchConfigurationJni.get().isForbiddenCheckDue(
ProfileKey.getLastUsedProfileKey());
ProfileKey.getLastUsedRegularProfileKey());
}
/**
* Returns true if the GeneratePageBundle-forbidden check has never run and is due to run.
*/
public static boolean isEnabledByServerUnknown() {
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
return PrefetchConfigurationJni.get().isEnabledByServerUnknown(
ProfileKey.getLastUsedProfileKey());
ProfileKey.getLastUsedRegularProfileKey());
}
/**
......@@ -75,8 +88,11 @@ public class PrefetchConfiguration {
* enabled or disabled. If the current browser Profile is null the setting will not be changed.
*/
public static void setPrefetchingEnabledInSettings(boolean enabled) {
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
PrefetchConfigurationJni.get().setPrefetchingEnabledInSettings(
ProfileKey.getLastUsedProfileKey(), enabled);
ProfileKey.getLastUsedRegularProfileKey(), enabled);
}
/**
......@@ -84,8 +100,11 @@ public class PrefetchConfiguration {
* enabled or disabled.
*/
public static boolean isPrefetchingEnabledInSettings() {
// TODO(https://crbug.com/1067314): Use the current profile (i.e., regular profile or
// incognito profile) instead of always using regular profile. It is wrong and need to be
// fixed.
return PrefetchConfigurationJni.get().isPrefetchingEnabledInSettings(
ProfileKey.getLastUsedProfileKey());
ProfileKey.getLastUsedRegularProfileKey());
}
@NativeMethods
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment