| Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java
|
| index 8241c0ac83ab6c5c76f28bb861042559ae87885d..de1fe974a8407d729a8bb1574993f51fdd805996 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesBasic.java
|
| @@ -4,13 +4,62 @@
|
|
|
| package org.chromium.chrome.browser.preferences.privacy;
|
|
|
| +import android.os.Bundle;
|
| +
|
| +import org.chromium.chrome.R;
|
| import org.chromium.chrome.browser.browsing_data.ClearBrowsingDataTab;
|
| +import org.chromium.chrome.browser.preferences.ClearBrowsingDataTabCheckBoxPreference;
|
| +import org.chromium.chrome.browser.sync.ProfileSyncService;
|
| +import org.chromium.chrome.browser.tabmodel.TabModel;
|
| +import org.chromium.chrome.browser.tabmodel.document.TabDelegate;
|
| +import org.chromium.components.signin.ChromeSigninController;
|
| +import org.chromium.components.sync.AndroidSyncSettings;
|
| +import org.chromium.components.sync.ModelType;
|
|
|
| /**
|
| * A simpler version of {@link ClearBrowsingDataPreferences} with fewer dialog options and more
|
| * explanatory text.
|
| */
|
| public class ClearBrowsingDataPreferencesBasic extends ClearBrowsingDataPreferencesTab {
|
| + /** The my activity URL. */
|
| + private static final String MY_ACTIVITY_URL =
|
| + "https://myactivity.google.com/myactivity/?utm_source=chrome_cbd";
|
| +
|
| + @Override
|
| + public void onCreate(Bundle savedInstanceState) {
|
| + super.onCreate(savedInstanceState);
|
| +
|
| + ClearBrowsingDataTabCheckBoxPreference historyCheckbox =
|
| + (ClearBrowsingDataTabCheckBoxPreference) findPreference(PREF_HISTORY);
|
| + ClearBrowsingDataTabCheckBoxPreference cookiesCheckbox =
|
| + (ClearBrowsingDataTabCheckBoxPreference) findPreference(PREF_COOKIES);
|
| +
|
| + historyCheckbox.setLinkClickDelegate(new Runnable() {
|
| + @Override
|
| + public void run() {
|
| + new TabDelegate(false /* incognito */)
|
| + .launchUrl(MY_ACTIVITY_URL, TabModel.TabLaunchType.FROM_CHROME_UI);
|
| + }
|
| + });
|
| +
|
| + if (ChromeSigninController.get(getActivity()).isSignedIn()) {
|
| + if (isHistorySyncEnabled()) { // is synced
|
| + historyCheckbox.setSummary(R.string.clear_browsing_history_summary_synced);
|
| + } else {
|
| + historyCheckbox.setSummary(R.string.clear_browsing_history_summary_signed_in);
|
| + }
|
| + cookiesCheckbox.setSummary(
|
| + R.string.clear_cookies_and_site_data_signed_in_summary_basic);
|
| + }
|
| + }
|
| +
|
| + private boolean isHistorySyncEnabled() {
|
| + boolean syncEnabled = AndroidSyncSettings.isSyncEnabled(getActivity());
|
| + ProfileSyncService syncService = ProfileSyncService.get();
|
| + return syncEnabled && syncService != null
|
| + && syncService.getPreferredDataTypes().contains(ModelType.TYPED_URLS);
|
| + }
|
| +
|
| @Override
|
| protected DialogOption[] getDialogOptions() {
|
| return new DialogOption[] {DialogOption.CLEAR_HISTORY,
|
|
|