Commit c04b20cd authored by Natalie Chouinard's avatar Natalie Chouinard Committed by Commit Bot

Extract site settings code from PreferencesLauncher

Remove feature-specific method from PreferencesLauncher to the class
where it's used.

Bug: 1029194
Change-Id: I845474b13e67df8d562a661fa916e47ac05e9405
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1941307
Commit-Queue: Natalie Chouinard <chouinard@chromium.org>
Reviewed-by: default avatarPavel Shmakov <pshmakov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721140}
parent 6c8601ff
......@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.browserservices;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
......@@ -13,6 +14,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.settings.PreferencesLauncher;
import org.chromium.chrome.browser.settings.website.SettingsNavigationSource;
import org.chromium.chrome.browser.settings.website.SingleCategoryPreferences;
import org.chromium.chrome.browser.settings.website.SingleWebsitePreferences;
import org.chromium.chrome.browser.settings.website.SiteSettingsCategory;
import java.util.ArrayList;
......@@ -67,7 +69,7 @@ public class TrustedWebActivitySettingsLauncher {
}
private static void openSingleWebsitePrefs(Context context, String origin) {
context.startActivity(PreferencesLauncher.createIntentForSingleWebsitePreferences(
context.startActivity(createIntentForSingleWebsitePreferences(
context, origin, SettingsNavigationSource.TWA_CLEAR_DATA_DIALOG));
}
......@@ -84,4 +86,15 @@ public class TrustedWebActivitySettingsLauncher {
PreferencesLauncher.launchSettingsPage(context, SingleCategoryPreferences.class, extras);
}
/**
* Creates an intent to launch single website preferences for the specified {@param url}.
*/
private static Intent createIntentForSingleWebsitePreferences(
Context context, String url, @SettingsNavigationSource int navigationSource) {
Bundle args = SingleWebsitePreferences.createFragmentArgsForSite(url);
args.putInt(SettingsNavigationSource.EXTRA_KEY, navigationSource);
return PreferencesLauncher.createIntentForSettingsPage(
context, SingleWebsitePreferences.class.getName(), args);
}
}
......@@ -16,8 +16,6 @@ import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.browser.settings.autofill.AutofillPaymentMethodsFragment;
import org.chromium.chrome.browser.settings.autofill.AutofillProfilesFragment;
import org.chromium.chrome.browser.settings.website.SettingsNavigationSource;
import org.chromium.chrome.browser.settings.website.SingleWebsitePreferences;
import org.chromium.chrome.browser.util.IntentUtils;
import org.chromium.content_public.browser.WebContents;
......@@ -89,16 +87,6 @@ public class PreferencesLauncher {
return intent;
}
/**
* Creates an intent to launch single website preferences for the specified {@param url}.
*/
public static Intent createIntentForSingleWebsitePreferences(
Context context, String url, @SettingsNavigationSource int navigationSource) {
Bundle args = SingleWebsitePreferences.createFragmentArgsForSite(url);
args.putInt(SettingsNavigationSource.EXTRA_KEY, navigationSource);
return createIntentForSettingsPage(context, SingleWebsitePreferences.class.getName(), args);
}
@CalledByNative
private static void showAutofillProfileSettings(WebContents webContents) {
RecordUserAction.record("AutofillAddressesViewed");
......
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