Skip to content

Commit

Permalink
Privacy Sandbox Android: updated the help page URL to be retrieved fr…
Browse files Browse the repository at this point in the history
…om the feature param

Merge approved in crbug.com/1184701

(cherry picked from commit 3e5568b)

Bug: 1152351, 1184701
Change-Id: I8826b08737930a750bce59451d9ce4aeeb3a744b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2735816
Commit-Queue: Andrey Zaytsev <andzaytsev@google.com>
Commit-Queue: Martin Šrámek <msramek@chromium.org>
Auto-Submit: Andrey Zaytsev <andzaytsev@google.com>
Reviewed-by: Martin Šrámek <msramek@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#859797}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2740917
Cr-Commit-Position: refs/branch-heads/4430@{#221}
Cr-Branched-From: e5ce7dc-refs/heads/master@{#857950}
  • Loading branch information
Andrey Zaytsev authored and Chromium LUCI CQ committed Mar 8, 2021
1 parent 2380c82 commit 686705b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions chrome/browser/privacy_sandbox/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android_library("java") {
":java_resources",
"//base:base_java",
"//base:jni_java",
"//chrome/browser/flags:java",
"//chrome/browser/settings:java",
"//chrome/browser/ui/messages/android:java",
"//components/browser_ui/settings/android:java",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.chromium.base.IntentUtils;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
import org.chromium.components.browser_ui.settings.ChromeSwitchPreference;
import org.chromium.components.browser_ui.settings.SettingsUtils;
Expand All @@ -34,8 +35,9 @@
*/
public class PrivacySandboxSettingsFragment
extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener {
public static final String PRIVACY_SANDBOX_URL =
"https://www.google.com/chrome/privacy-sandbox";
public static final String PRIVACY_SANDBOX_DEFAULT_URL =
"https://web.dev/digging-into-the-privacy-sandbox/";
public static final String EXPERIMENT_URL_PARAM = "website-url";
// Key for the argument with which the PrivacySandbox fragment will be launched. The value for
// this argument should be part of the PrivacySandboxReferrer enum, which contains all points of
// entry to the Privacy Sandbox UI.
Expand Down Expand Up @@ -69,7 +71,7 @@ public void onCreatePreferences(Bundle bundle, String s) {
getContext().getString(R.string.privacy_sandbox_description),
new SpanInfo("<link>", "</link>",
new NoUnderlineClickableSpan(getContext().getResources(),
(widget) -> openUrlInCct(PRIVACY_SANDBOX_URL)))));
(widget) -> openUrlInCct(getPrivacySandboxUrl())))));
// Format the toggle description, which has bullet points.
findPreference(TOGGLE_DESCRIPTION_PREFERENCE)
.setSummary(SpanApplier.applySpans(
Expand Down Expand Up @@ -120,7 +122,7 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_targeted_help) {
// Action for the question mark button.
openUrlInCct(PRIVACY_SANDBOX_URL);
openUrlInCct(getPrivacySandboxUrl());
return true;
}
return false;
Expand All @@ -143,6 +145,14 @@ private ChromeManagedPreferenceDelegate createManagedPreferenceDelegate() {
};
}

private String getPrivacySandboxUrl() {
// Get the URL from Finch, if defined.
String url = ChromeFeatureList.getFieldTrialParamByFeature(
ChromeFeatureList.PRIVACY_SANDBOX_SETTINGS, EXPERIMENT_URL_PARAM);
if (url == null || url.isEmpty()) return PRIVACY_SANDBOX_DEFAULT_URL;
return url;
}

private void openUrlInCct(String url) {
assert (mCustomTabHelper != null)
&& (mTrustedIntentHelper != null)
Expand Down

0 comments on commit 686705b

Please sign in to comment.