Skip to content

Commit

Permalink
[M103] Add missing READING_LIST toggle to Android sync settings
Browse files Browse the repository at this point in the history
More details on the linked bug. This is only a temporary solution, the
long-term one should be to address crbug.com/1067282, i.e. auto-generate
the UI from the UserSelectableType enum.

Desktop and iOS follow no particular order for the toggles, so this
CL picks something close to the desktop order crbug.com/1326825#c1.

(cherry picked from commit c4ebfbf)

Fixed: 1326825
Change-Id: I185984fc154eb222bf9a09210d2b3face4884bea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3652327
Reviewed-by: Marc Treib <treib@chromium.org>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#1005740}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3660231
Auto-Submit: Victor Vianna <victorvianna@google.com>
Cr-Commit-Position: refs/branch-heads/5060@{#218}
Cr-Branched-From: b83393d-refs/heads/main@{#1002911}
  • Loading branch information
Victor Hugo Vianna Silva authored and Chromium LUCI CQ committed May 24, 2022
1 parent 1865175 commit 92c74c1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions chrome/android/java/res/xml/manage_sync_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
android:title="@string/sync_passwords"
android:persistent="false"/>

<org.chromium.components.browser_ui.settings.ChromeBaseCheckBoxPreference
android:key="sync_reading_list"
android:title="@string/sync_reading_list"
android:persistent="false"/>

<org.chromium.components.browser_ui.settings.ChromeBaseCheckBoxPreference
android:key="sync_recent_tabs"
android:title="@string/sync_recent_tabs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
@VisibleForTesting
public static final String PREF_SYNC_PASSWORDS = "sync_passwords";
@VisibleForTesting
public static final String PREF_SYNC_READING_LIST = "sync_reading_list";
@VisibleForTesting
public static final String PREF_SYNC_RECENT_TABS = "sync_recent_tabs";
@VisibleForTesting
public static final String PREF_SYNC_SETTINGS = "sync_settings";
Expand Down Expand Up @@ -138,6 +140,7 @@ public class ManageSyncSettings extends PreferenceFragmentCompat
private CheckBoxPreference mSyncPaymentsIntegration;
private CheckBoxPreference mSyncHistory;
private CheckBoxPreference mSyncPasswords;
private CheckBoxPreference mSyncReadingList;
private CheckBoxPreference mSyncRecentTabs;
private CheckBoxPreference mSyncSettings;
// Contains preferences for all sync data types.
Expand Down Expand Up @@ -188,6 +191,7 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, String root
(CheckBoxPreference) findPreference(PREF_SYNC_PAYMENTS_INTEGRATION);
mSyncHistory = (CheckBoxPreference) findPreference(PREF_SYNC_HISTORY);
mSyncPasswords = (CheckBoxPreference) findPreference(PREF_SYNC_PASSWORDS);
mSyncReadingList = (CheckBoxPreference) findPreference(PREF_SYNC_READING_LIST);
mSyncRecentTabs = (CheckBoxPreference) findPreference(PREF_SYNC_RECENT_TABS);
mSyncSettings = (CheckBoxPreference) findPreference(PREF_SYNC_SETTINGS);

Expand Down Expand Up @@ -241,9 +245,9 @@ public void onCreatePreferences(@Nullable Bundle savedInstanceState, String root
mReviewSyncData.setOnPreferenceClickListener(SyncSettingsUtils.toOnClickListener(
this, () -> SyncSettingsUtils.openSyncDashboard(getActivity())));

mSyncTypePreferences =
new CheckBoxPreference[] {mSyncAutofill, mSyncBookmarks, mSyncPaymentsIntegration,
mSyncHistory, mSyncPasswords, mSyncRecentTabs, mSyncSettings};
mSyncTypePreferences = new CheckBoxPreference[] {mSyncAutofill, mSyncBookmarks,
mSyncPaymentsIntegration, mSyncHistory, mSyncPasswords, mSyncReadingList,
mSyncRecentTabs, mSyncSettings};
for (CheckBoxPreference type : mSyncTypePreferences) {
type.setOnPreferenceChangeListener(this);
}
Expand Down Expand Up @@ -467,6 +471,7 @@ private Set<Integer> getSelectedModelTypes() {
if (mSyncBookmarks.isChecked()) types.add(ModelType.BOOKMARKS);
if (mSyncHistory.isChecked()) types.add(ModelType.TYPED_URLS);
if (mSyncPasswords.isChecked()) types.add(ModelType.PASSWORDS);
if (mSyncReadingList.isChecked()) types.add(ModelType.READING_LIST);
if (mSyncRecentTabs.isChecked()) types.add(ModelType.PROXY_TABS);
if (mSyncSettings.isChecked()) types.add(ModelType.PREFERENCES);
return types;
Expand Down Expand Up @@ -636,6 +641,8 @@ private void updateDataTypeState() {
mSyncHistory.setEnabled(true);
mSyncPasswords.setChecked(syncTypes.contains(ModelType.PASSWORDS));
mSyncPasswords.setEnabled(true);
mSyncReadingList.setChecked(syncTypes.contains(ModelType.READING_LIST));
mSyncReadingList.setEnabled(true);
mSyncRecentTabs.setChecked(syncTypes.contains(ModelType.PROXY_TABS));
mSyncRecentTabs.setEnabled(true);
mSyncSettings.setChecked(syncTypes.contains(ModelType.PREFERENCES));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
public class ManageSyncSettingsTest {
private static final String TAG = "ManageSyncSettingsTest";

private static final int RENDER_TEST_REVISION = 4;
private static final int RENDER_TEST_REVISION = 5;

/**
* Maps ModelTypes to their UI element IDs.
Expand All @@ -83,6 +83,7 @@ public class ManageSyncSettingsTest {
UI_DATATYPES.put(ModelType.BOOKMARKS, ManageSyncSettings.PREF_SYNC_BOOKMARKS);
UI_DATATYPES.put(ModelType.TYPED_URLS, ManageSyncSettings.PREF_SYNC_HISTORY);
UI_DATATYPES.put(ModelType.PASSWORDS, ManageSyncSettings.PREF_SYNC_PASSWORDS);
UI_DATATYPES.put(ModelType.READING_LIST, ManageSyncSettings.PREF_SYNC_READING_LIST);
UI_DATATYPES.put(ModelType.PROXY_TABS, ManageSyncSettings.PREF_SYNC_RECENT_TABS);
UI_DATATYPES.put(ModelType.PREFERENCES, ManageSyncSettings.PREF_SYNC_SETTINGS);
}
Expand Down
3 changes: 3 additions & 0 deletions chrome/browser/ui/android/strings/android_chrome_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,9 @@ Your Google account may have other forms of browsing history like searches and a
<message name="IDS_SYNC_PASSWORDS" desc="Title for preference which enables sync'ing of passwords. [CHAR_LIMIT=32]">
Passwords
</message>
<message name="IDS_SYNC_READING_LIST" desc="Title for preference which enables sync'ing of reading list. [CHAR_LIMIT=32]">
Reading list
</message>
<message name="IDS_SYNC_RECENT_TABS" desc="Title for preference which enables sync'ing of open tabs. [CHAR_LIMIT=32]">
Open tabs
</message>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c6e16d7f5ed6930b205152e3c3dd0b152b675451

0 comments on commit 92c74c1

Please sign in to comment.