OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.preferences.privacy; | 5 package org.chromium.chrome.browser.preferences.privacy; |
6 | 6 |
7 import android.os.Bundle; | 7 import android.os.Bundle; |
8 | 8 |
9 import org.chromium.chrome.R; | 9 import org.chromium.chrome.R; |
10 import org.chromium.chrome.browser.browsing_data.ClearBrowsingDataTab; | 10 import org.chromium.chrome.browser.browsing_data.ClearBrowsingDataTab; |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 historyCheckbox.setLinkClickDelegate(new Runnable() { | 37 historyCheckbox.setLinkClickDelegate(new Runnable() { |
38 @Override | 38 @Override |
39 public void run() { | 39 public void run() { |
40 new TabDelegate(false /* incognito */) | 40 new TabDelegate(false /* incognito */) |
41 .launchUrl(MY_ACTIVITY_URL, TabModel.TabLaunchType.FROM_
CHROME_UI); | 41 .launchUrl(MY_ACTIVITY_URL, TabModel.TabLaunchType.FROM_
CHROME_UI); |
42 } | 42 } |
43 }); | 43 }); |
44 | 44 |
45 if (ChromeSigninController.get().isSignedIn()) { | 45 if (ChromeSigninController.get().isSignedIn()) { |
46 if (isHistorySyncEnabled()) { // is synced | 46 if (isHistorySyncEnabled()) { |
47 historyCheckbox.setSummary(R.string.clear_browsing_history_summa
ry_synced); | 47 historyCheckbox.setSummary(R.string.clear_browsing_history_summa
ry_synced); |
48 } else { | 48 } else { |
49 historyCheckbox.setSummary(R.string.clear_browsing_history_summa
ry_signed_in); | 49 historyCheckbox.setSummary(R.string.clear_browsing_history_summa
ry_signed_in); |
50 } | 50 } |
51 cookiesCheckbox.setSummary( | 51 cookiesCheckbox.setSummary( |
52 R.string.clear_cookies_and_site_data_signed_in_summary_basic
); | 52 R.string.clear_cookies_and_site_data_signed_in_summary_basic
); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 private boolean isHistorySyncEnabled() { | 56 private boolean isHistorySyncEnabled() { |
57 boolean syncEnabled = AndroidSyncSettings.isSyncEnabled(getActivity()); | 57 boolean syncEnabled = AndroidSyncSettings.isSyncEnabled(getActivity()); |
58 ProfileSyncService syncService = ProfileSyncService.get(); | 58 ProfileSyncService syncService = ProfileSyncService.get(); |
59 return syncEnabled && syncService != null | 59 return syncEnabled && syncService != null |
60 && syncService.getPreferredDataTypes().contains(ModelType.TYPED_
URLS); | 60 && syncService.getActiveDataTypes().contains(ModelType.HISTORY_D
ELETE_DIRECTIVES); |
61 } | 61 } |
62 | 62 |
63 @Override | 63 @Override |
64 protected DialogOption[] getDialogOptions() { | 64 protected DialogOption[] getDialogOptions() { |
65 return new DialogOption[] {DialogOption.CLEAR_HISTORY, | 65 return new DialogOption[] {DialogOption.CLEAR_HISTORY, |
66 DialogOption.CLEAR_COOKIES_AND_SITE_DATA, DialogOption.CLEAR_CAC
HE}; | 66 DialogOption.CLEAR_COOKIES_AND_SITE_DATA, DialogOption.CLEAR_CAC
HE}; |
67 } | 67 } |
68 | 68 |
69 @Override | 69 @Override |
70 protected int getPreferenceType() { | 70 protected int getPreferenceType() { |
71 return ClearBrowsingDataTab.BASIC; | 71 return ClearBrowsingDataTab.BASIC; |
72 } | 72 } |
73 } | 73 } |
OLD | NEW |