diff options
author | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-26 04:36:54 +0000 |
---|---|---|
committer | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-26 04:36:54 +0000 |
commit | 8576d3230816c35b6e6b571a43b77d7270ff445e (patch) | |
tree | eba7d1165302cd9691fd0de2d8a0339be42d7d41 | |
parent | 5eddc3ed58ad893c3d1584c38dd27a48e197fb79 (diff) | |
download | chromium_src-8576d3230816c35b6e6b571a43b77d7270ff445e.zip chromium_src-8576d3230816c35b6e6b571a43b77d7270ff445e.tar.gz chromium_src-8576d3230816c35b6e6b571a43b77d7270ff445e.tar.bz2 |
Remove app notifications checkbox and piggy back on Apps checkbox in sync UI.
Review URL: http://codereview.chromium.org/8387021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@107299 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/sync_setup_overlay.html | 8 | ||||
-rw-r--r-- | chrome/browser/resources/sync_setup_overlay.js | 8 | ||||
-rw-r--r-- | chrome/browser/sync/resources/configure.html | 14 | ||||
-rw-r--r-- | chrome/browser/sync/sync_prefs.cc | 37 | ||||
-rw-r--r-- | chrome/browser/sync/sync_prefs_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_flow.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard_unittest.cc | 3 | ||||
-rw-r--r-- | chrome/browser/ui/webui/ntp/ntp_resource_cache.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/personal_options_handler.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/webui/sync_setup_handler.cc | 7 |
10 files changed, 35 insertions, 54 deletions
diff --git a/chrome/browser/resources/sync_setup_overlay.html b/chrome/browser/resources/sync_setup_overlay.html index b01c267..8e1ce71 100644 --- a/chrome/browser/resources/sync_setup_overlay.html +++ b/chrome/browser/resources/sync_setup_overlay.html @@ -238,14 +238,6 @@ il8n-values="title:searchEngines" name="dataTypeLabel"></label> </div> - <div id="app-notifications-item" class="sync-item-show"> - <input id="app-notifications-checkbox" type="checkbox" - name="dataTypeCheckbox"> - <label for="app-notifications-checkbox" - i18n-content="appNotifications" - il8n-values="title:appNotifications" - name="dataTypeLabel"></label> - </div> </div> </div> </div> diff --git a/chrome/browser/resources/sync_setup_overlay.js b/chrome/browser/resources/sync_setup_overlay.js index 2876331..a60b29b 100644 --- a/chrome/browser/resources/sync_setup_overlay.js +++ b/chrome/browser/resources/sync_setup_overlay.js @@ -250,8 +250,6 @@ cr.define('options', function() { "syncTypedUrls": syncAll || $('typed-urls-checkbox').checked, "syncApps": syncAll || $('apps-checkbox').checked, "syncSearchEngines": syncAll || $('search-engines-checkbox').checked, - "syncAppNotifications": syncAll || - $('app-notifications-checkbox').checked, "syncSessions": syncAll || $('sessions-checkbox').checked, "encryptAllData": encryptAllData, "usePassphrase": usePassphrase, @@ -358,12 +356,6 @@ cr.define('options', function() { } else { $('sessions-item').className = "sync-item-hide"; } - if (args.appNotificationsRegistered) { - $('app-notifications-checkbox').checked = args.syncAppNotifications; - $('app-notifications-item').className = "sync-item-show"; - } else { - $('app-notifications-item').className = "sync-item-hide"; - } this.setCheckboxesToKeepEverythingSynced_(args.syncAllDataTypes); }, diff --git a/chrome/browser/sync/resources/configure.html b/chrome/browser/sync/resources/configure.html index 6bb13e6..107f136 100644 --- a/chrome/browser/sync/resources/configure.html +++ b/chrome/browser/sync/resources/configure.html @@ -373,13 +373,6 @@ html[os='mac'] input[type='submit'] { } else {
document.getElementById("sessionsItem").className = "sync-item-hide";
}
- if (args.appNotificationsRegistered) {
- document.getElementById("appNotificationsCheckbox").checked =
- args.syncAppNotifications;
- document.getElementById("appNotificationsItem").className = "sync-item-show";
- } else {
- document.getElementById("appNotificationsItem").className = "sync-item-hide";
- }
setCheckboxesToKeepEverythingSynced(args.syncAllDataTypes); } @@ -472,7 +465,6 @@ html[os='mac'] input[type='submit'] { "syncApps": syncAll || f.appsCheckbox.checked,
"syncSearchEngines": syncAll || f.searchEnginesCheckbox.checked, "syncSessions": syncAll || f.sessionsCheckbox.checked, - "syncAppNotifications": syncAll || f.appNotificationsCheckbox.checked, "usePassphrase": (getRadioCheckedValue() == 'explicit'), "passphrase": f.passphrase.value }); @@ -634,12 +626,6 @@ html[os='mac'] input[type='submit'] { for="searchEnginesCheckbox" i18n-content="searchengines" il8n-values="title:searchengines"></label> </div> - <div class="sync-item-show" id="appNotificationsItem"> - <input id="appNotificationsCheckbox" name="dataTypeCheckbox" type="checkbox"> - <label id="appNotificationsCheckboxLabel" name="dataTypeLabel" - for="appNotificationsCheckbox" i18n-content="appnotifications" - il8n-values="title:appnotifications"></label> - </div> </div> </div> </div> diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc index 18d7456..2be149f 100644 --- a/chrome/browser/sync/sync_prefs.cc +++ b/chrome/browser/sync/sync_prefs.cc @@ -127,12 +127,17 @@ syncable::ModelTypeSet SyncPrefs::GetPreferredDataTypes( return registered_types; } - // Remove autofill_profile since its controlled by autofill (see + // Remove autofill_profile since it's controlled by autofill (see // code below). syncable::ModelTypeSet user_selectable_types(registered_types); DCHECK_EQ(user_selectable_types.count(syncable::NIGORI), 0u); user_selectable_types.erase(syncable::AUTOFILL_PROFILE); + // Remove app_notifications since it's controlled by apps (see + // code below). + // TODO(akalin): Centralize notion of all user selectable data types. + user_selectable_types.erase(syncable::APP_NOTIFICATIONS); + syncable::ModelTypeSet preferred_types; for (syncable::ModelTypeSet::const_iterator it = @@ -151,6 +156,14 @@ syncable::ModelTypeSet SyncPrefs::GetPreferredDataTypes( preferred_types.insert(syncable::AUTOFILL_PROFILE); } + // Set app_notifications to the same enabled/disabled state as + // apps (since only apps is shown on the UI). + if (registered_types.count(syncable::APPS) && + registered_types.count(syncable::APP_NOTIFICATIONS) && + GetDataTypePreferred(syncable::APPS)) { + preferred_types.insert(syncable::APP_NOTIFICATIONS); + } + return preferred_types; } @@ -161,21 +174,31 @@ void SyncPrefs::SetPreferredDataTypes( CHECK(pref_service_); DCHECK(std::includes(registered_types.begin(), registered_types.end(), preferred_types.begin(), preferred_types.end())); - syncable::ModelTypeSet preferred_types_with_autofill(preferred_types); + syncable::ModelTypeSet preferred_types_with_dependents(preferred_types); // Set autofill_profile to the same enabled/disabled state as - // autofill (since only autofill is shown on the UI). + // autofill (since only autofill is shown in the UI). if (registered_types.count(syncable::AUTOFILL) && registered_types.count(syncable::AUTOFILL_PROFILE)) { - if (preferred_types_with_autofill.count(syncable::AUTOFILL)) { - preferred_types_with_autofill.insert(syncable::AUTOFILL_PROFILE); + if (preferred_types_with_dependents.count(syncable::AUTOFILL)) { + preferred_types_with_dependents.insert(syncable::AUTOFILL_PROFILE); + } else { + preferred_types_with_dependents.erase(syncable::AUTOFILL_PROFILE); + } + } + // Set app_notifications to the same enabled/disabled state as + // apps (since only apps is shown in the UI). + if (registered_types.count(syncable::APPS) && + registered_types.count(syncable::APP_NOTIFICATIONS)) { + if (preferred_types_with_dependents.count(syncable::APPS)) { + preferred_types_with_dependents.insert(syncable::APP_NOTIFICATIONS); } else { - preferred_types_with_autofill.erase(syncable::AUTOFILL_PROFILE); + preferred_types_with_dependents.erase(syncable::APP_NOTIFICATIONS); } } for (syncable::ModelTypeSet::const_iterator it = registered_types.begin(); it != registered_types.end(); ++it) { - SetDataTypePreferred(*it, preferred_types_with_autofill.count(*it) > 0); + SetDataTypePreferred(*it, preferred_types_with_dependents.count(*it) > 0); } } diff --git a/chrome/browser/sync/sync_prefs_unittest.cc b/chrome/browser/sync/sync_prefs_unittest.cc index 5bf2e06..fedfa52 100644 --- a/chrome/browser/sync/sync_prefs_unittest.cc +++ b/chrome/browser/sync/sync_prefs_unittest.cc @@ -41,6 +41,7 @@ syncable::ModelTypeSet GetNonPassiveTypes() { syncable::ModelTypeSet GetUserVisibleTypes() { syncable::ModelTypeSet user_visible_types(GetNonPassiveTypes()); user_visible_types.erase(syncable::AUTOFILL_PROFILE); + user_visible_types.erase(syncable::APP_NOTIFICATIONS); return user_visible_types; } @@ -109,6 +110,9 @@ TEST_F(SyncPrefsTest, PreferredTypesNotKeepEverythingSynced) { if (*it == syncable::AUTOFILL) { expected_preferred_types.insert(syncable::AUTOFILL_PROFILE); } + if (*it == syncable::APPS) { + expected_preferred_types.insert(syncable::APP_NOTIFICATIONS); + } sync_prefs.SetPreferredDataTypes(non_passive_types, preferred_types); EXPECT_EQ(expected_preferred_types, sync_prefs.GetPreferredDataTypes(non_passive_types)); diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index c503f61..0218abd 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -142,8 +142,6 @@ void SyncSetupFlow::GetArgsForConfigure(ProfileSyncService* service, registered_types.count(syncable::SEARCH_ENGINES) > 0); args->SetBoolean("sessionsRegistered", registered_types.count(syncable::SESSIONS) > 0); - args->SetBoolean("appNotificationsRegistered", - registered_types.count(syncable::APP_NOTIFICATIONS) > 0); args->SetBoolean("syncBookmarks", service->profile()->GetPrefs()->GetBoolean(prefs::kSyncBookmarks)); args->SetBoolean("syncPreferences", @@ -164,8 +162,6 @@ void SyncSetupFlow::GetArgsForConfigure(ProfileSyncService* service, service->profile()->GetPrefs()->GetBoolean(prefs::kSyncTypedUrls)); args->SetBoolean("syncApps", service->profile()->GetPrefs()->GetBoolean(prefs::kSyncApps)); - args->SetBoolean("syncAppNotifications", - service->profile()->GetPrefs()->GetBoolean(prefs::kSyncAppNotifications)); args->SetBoolean("encryptionEnabled", !CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableSyncEncryption)); diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc index e08c91d..54efad2 100644 --- a/chrome/browser/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc @@ -314,8 +314,7 @@ TEST_F(SyncSetupWizardTest, ChooseDataTypesSetsPrefs) { "\"syncPreferences\":true,\"syncThemes\":false,\"syncPasswords\":false," "\"syncAutofill\":false,\"syncExtensions\":false,\"syncTypedUrls\":true," "\"syncApps\":true,\"syncSearchEngines\":false,\"syncSessions\":false," - "\"syncAppNotifications\":false,\"usePassphrase\":false," - "\"encryptAllData\":false}"; + "\"usePassphrase\":false,\"encryptAllData\":false}"; data_type_choices_value.Append(new StringValue(data_type_choices)); // Simulate the user choosing data types; bookmarks, prefs, typed URLS, and diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc index ff6e9df..6ba45e8 100644 --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc @@ -308,8 +308,6 @@ void NTPResourceCache::CreateNewTabHTML() { l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_SEARCH_ENGINES)); localized_strings.SetString("foreignsessions", l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_TABS)); - localized_strings.SetString("appnotifications", - l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_APP_NOTIFICATIONS)); localized_strings.SetString("closedwindowmultiple", l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE)); localized_strings.SetString("attributionintro", diff --git a/chrome/browser/ui/webui/options/personal_options_handler.cc b/chrome/browser/ui/webui/options/personal_options_handler.cc index d99dda7..0851e4f 100644 --- a/chrome/browser/ui/webui/options/personal_options_handler.cc +++ b/chrome/browser/ui/webui/options/personal_options_handler.cc @@ -189,8 +189,6 @@ void PersonalOptionsHandler::GetLocalizedValues( l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_SEARCH_ENGINES)); localized_strings->SetString("syncsessions", l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_TABS)); - localized_strings->SetString("syncappnotifications", - l10n_util::GetStringUTF16(IDS_SYNC_DATATYPE_APP_NOTIFICATIONS)); #if defined(OS_CHROMEOS) localized_strings->SetString("account", diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc index bd0dd7e..66b7de8 100644 --- a/chrome/browser/ui/webui/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/sync_setup_handler.cc @@ -138,12 +138,6 @@ bool GetConfiguration(const std::string& json, SyncConfiguration* config) { if (sync_apps) config->data_types.insert(syncable::APPS); - bool sync_app_notifications; - if (!result->GetBoolean("syncAppNotifications", &sync_app_notifications)) - return false; - if (sync_app_notifications) - config->data_types.insert(syncable::APP_NOTIFICATIONS); - // Encryption settings. if (!result->GetBoolean("encryptAllData", &config->encrypt_all)) return false; @@ -285,7 +279,6 @@ void SyncSetupHandler::GetStaticLocalizedValues( { "apps", IDS_SYNC_DATATYPE_APPS }, { "searchEngines", IDS_SYNC_DATATYPE_SEARCH_ENGINES }, { "openTabs", IDS_SYNC_DATATYPE_TABS }, - { "appNotifications", IDS_SYNC_DATATYPE_APP_NOTIFICATIONS }, { "syncZeroDataTypesError", IDS_SYNC_ZERO_DATA_TYPES_ERROR }, { "serviceUnavailableError", IDS_SYNC_SETUP_ABORTED_BY_PENDING_CLEAR }, { "encryptAllLabel", IDS_SYNC_ENCRYPT_ALL_LABEL }, |