| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/options/browser_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 template_url_service_->RemoveObserver(this); | 186 template_url_service_->RemoveObserver(this); |
| 187 // There may be pending file dialogs, we need to tell them that we've gone | 187 // There may be pending file dialogs, we need to tell them that we've gone |
| 188 // away so they don't try and call back to us. | 188 // away so they don't try and call back to us. |
| 189 if (select_folder_dialog_.get()) | 189 if (select_folder_dialog_.get()) |
| 190 select_folder_dialog_->ListenerDestroyed(); | 190 select_folder_dialog_->ListenerDestroyed(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) { | 193 void BrowserOptionsHandler::GetLocalizedValues(base::DictionaryValue* values) { |
| 194 DCHECK(values); | 194 DCHECK(values); |
| 195 | 195 |
| 196 const bool using_new_profiles_ui = switches::IsNewAvatarMenu(); | |
| 197 | |
| 198 #if defined(OS_CHROMEOS) | 196 #if defined(OS_CHROMEOS) |
| 199 const int device_type_resource_id = chromeos::GetChromeDeviceTypeResourceId(); | 197 const int device_type_resource_id = chromeos::GetChromeDeviceTypeResourceId(); |
| 200 #else | 198 #else |
| 201 // TODO(isherman): Set an appropriate device name for non-ChromeOS devices. | 199 // TODO(isherman): Set an appropriate device name for non-ChromeOS devices. |
| 202 const int device_type_resource_id = IDS_EASY_UNLOCK_GENERIC_DEVICE_TYPE; | 200 const int device_type_resource_id = IDS_EASY_UNLOCK_GENERIC_DEVICE_TYPE; |
| 203 #endif // defined(OS_CHROMEOS) | 201 #endif // defined(OS_CHROMEOS) |
| 204 | 202 |
| 205 static OptionsStringResource resources[] = { | 203 static OptionsStringResource resources[] = { |
| 206 { "advancedSectionTitleCloudPrint", IDS_GOOGLE_CLOUD_PRINT }, | 204 { "advancedSectionTitleCloudPrint", IDS_GOOGLE_CLOUD_PRINT }, |
| 207 { "currentUserOnly", IDS_OPTIONS_CURRENT_USER_ONLY }, | 205 { "currentUserOnly", IDS_OPTIONS_CURRENT_USER_ONLY }, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 { "networkPredictionEnabledDescription", | 286 { "networkPredictionEnabledDescription", |
| 289 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION }, | 287 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION }, |
| 290 { "passwordsAndAutofillGroupName", | 288 { "passwordsAndAutofillGroupName", |
| 291 IDS_OPTIONS_PASSWORDS_AND_FORMS_GROUP_NAME }, | 289 IDS_OPTIONS_PASSWORDS_AND_FORMS_GROUP_NAME }, |
| 292 { "passwordManagerEnabled", IDS_OPTIONS_PASSWORD_MANAGER_ENABLE }, | 290 { "passwordManagerEnabled", IDS_OPTIONS_PASSWORD_MANAGER_ENABLE }, |
| 293 { "privacyClearDataButton", IDS_OPTIONS_PRIVACY_CLEAR_DATA_BUTTON }, | 291 { "privacyClearDataButton", IDS_OPTIONS_PRIVACY_CLEAR_DATA_BUTTON }, |
| 294 { "privacyContentSettingsButton", | 292 { "privacyContentSettingsButton", |
| 295 IDS_OPTIONS_PRIVACY_CONTENT_SETTINGS_BUTTON }, | 293 IDS_OPTIONS_PRIVACY_CONTENT_SETTINGS_BUTTON }, |
| 296 { "profileAddPersonEnable", IDS_PROFILE_ADD_PERSON_ENABLE }, | 294 { "profileAddPersonEnable", IDS_PROFILE_ADD_PERSON_ENABLE }, |
| 297 { "profileBrowserGuestEnable", IDS_PROFILE_BROWSER_GUEST_ENABLE }, | 295 { "profileBrowserGuestEnable", IDS_PROFILE_BROWSER_GUEST_ENABLE }, |
| 298 { "profilesCreate", using_new_profiles_ui ? | 296 { "profilesCreate", IDS_NEW_PROFILES_CREATE_BUTTON_LABEL }, |
| 299 IDS_NEW_PROFILES_CREATE_BUTTON_LABEL : | 297 { "profilesDelete", IDS_NEW_PROFILES_DELETE_BUTTON_LABEL }, |
| 300 IDS_PROFILES_CREATE_BUTTON_LABEL }, | 298 { "profilesDeleteSingle", IDS_NEW_PROFILES_DELETE_SINGLE_BUTTON_LABEL }, |
| 301 { "profilesDelete", using_new_profiles_ui ? | |
| 302 IDS_NEW_PROFILES_DELETE_BUTTON_LABEL : | |
| 303 IDS_PROFILES_DELETE_BUTTON_LABEL }, | |
| 304 { "profilesDeleteSingle", using_new_profiles_ui ? | |
| 305 IDS_NEW_PROFILES_DELETE_SINGLE_BUTTON_LABEL : | |
| 306 IDS_PROFILES_DELETE_SINGLE_BUTTON_LABEL }, | |
| 307 { "profilesListItemCurrent", IDS_PROFILES_LIST_ITEM_CURRENT }, | 299 { "profilesListItemCurrent", IDS_PROFILES_LIST_ITEM_CURRENT }, |
| 308 { "profilesManage", IDS_PROFILES_MANAGE_BUTTON_LABEL }, | 300 { "profilesManage", IDS_PROFILES_MANAGE_BUTTON_LABEL }, |
| 309 { "profilesSupervisedDashboardTip", | 301 { "profilesSupervisedDashboardTip", |
| 310 IDS_PROFILES_SUPERVISED_USER_DASHBOARD_TIP }, | 302 IDS_PROFILES_SUPERVISED_USER_DASHBOARD_TIP }, |
| 311 #if defined(ENABLE_SETTINGS_APP) | 303 #if defined(ENABLE_SETTINGS_APP) |
| 312 { "profilesAppListSwitch", IDS_SETTINGS_APP_PROFILES_SWITCH_BUTTON_LABEL }, | 304 { "profilesAppListSwitch", IDS_SETTINGS_APP_PROFILES_SWITCH_BUTTON_LABEL }, |
| 313 #endif | 305 #endif |
| 314 { "proxiesLabelExtension", IDS_OPTIONS_EXTENSION_PROXIES_LABEL }, | 306 { "proxiesLabelExtension", IDS_OPTIONS_EXTENSION_PROXIES_LABEL }, |
| 315 { "proxiesLabelSystem", IDS_OPTIONS_SYSTEM_PROXIES_LABEL, | 307 { "proxiesLabelSystem", IDS_OPTIONS_SYSTEM_PROXIES_LABEL, |
| 316 IDS_PRODUCT_NAME }, | 308 IDS_PRODUCT_NAME }, |
| 317 { "resetProfileSettings", IDS_RESET_PROFILE_SETTINGS_BUTTON }, | 309 { "resetProfileSettings", IDS_RESET_PROFILE_SETTINGS_BUTTON }, |
| 318 { "resetProfileSettingsDescription", | 310 { "resetProfileSettingsDescription", |
| 319 IDS_RESET_PROFILE_SETTINGS_DESCRIPTION }, | 311 IDS_RESET_PROFILE_SETTINGS_DESCRIPTION }, |
| 320 { "resetProfileSettingsSectionTitle", | 312 { "resetProfileSettingsSectionTitle", |
| 321 IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE }, | 313 IDS_RESET_PROFILE_SETTINGS_SECTION_TITLE }, |
| 322 { "safeBrowsingEnableProtection", | 314 { "safeBrowsingEnableProtection", |
| 323 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, | 315 IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION }, |
| 324 { "safeBrowsingEnableExtendedReporting", | 316 { "safeBrowsingEnableExtendedReporting", |
| 325 IDS_OPTIONS_SAFEBROWSING_ENABLE_EXTENDED_REPORTING }, | 317 IDS_OPTIONS_SAFEBROWSING_ENABLE_EXTENDED_REPORTING }, |
| 326 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME }, | 318 { "sectionTitleAppearance", IDS_APPEARANCE_GROUP_NAME }, |
| 327 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME }, | 319 { "sectionTitleDefaultBrowser", IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME }, |
| 328 { "sectionTitleUsers", using_new_profiles_ui ? | 320 { "sectionTitleUsers", IDS_NEW_PROFILES_OPTIONS_GROUP_NAME }, |
| 329 IDS_NEW_PROFILES_OPTIONS_GROUP_NAME : | |
| 330 IDS_PROFILES_OPTIONS_GROUP_NAME }, | |
| 331 { "sectionTitleProxy", IDS_OPTIONS_PROXY_GROUP_NAME }, | 321 { "sectionTitleProxy", IDS_OPTIONS_PROXY_GROUP_NAME }, |
| 332 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, | 322 { "sectionTitleSearch", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, |
| 333 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME }, | 323 { "sectionTitleStartup", IDS_OPTIONS_STARTUP_GROUP_NAME }, |
| 334 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME }, | 324 { "sectionTitleSync", IDS_SYNC_OPTIONS_GROUP_NAME }, |
| 335 { "sectionTitleVoice", IDS_OPTIONS_VOICE_GROUP_NAME }, | 325 { "sectionTitleVoice", IDS_OPTIONS_VOICE_GROUP_NAME }, |
| 336 { "settingsTitle", IDS_SETTINGS_TITLE }, | 326 { "settingsTitle", IDS_SETTINGS_TITLE }, |
| 337 { "showAdvancedSettings", IDS_SETTINGS_SHOW_ADVANCED_SETTINGS }, | 327 { "showAdvancedSettings", IDS_SETTINGS_SHOW_ADVANCED_SETTINGS }, |
| 338 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT }, | 328 { "spellingConfirmMessage", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_TEXT }, |
| 339 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE }, | 329 { "spellingConfirmEnable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_ENABLE }, |
| 340 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE }, | 330 { "spellingConfirmDisable", IDS_CONTENT_CONTEXT_SPELLING_BUBBLE_DISABLE }, |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 #endif | 630 #endif |
| 641 | 631 |
| 642 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); | 632 values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser()); |
| 643 | 633 |
| 644 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); | 634 values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings()); |
| 645 | 635 |
| 646 values->SetBoolean("websiteSettingsManagerEnabled", | 636 values->SetBoolean("websiteSettingsManagerEnabled", |
| 647 CommandLine::ForCurrentProcess()->HasSwitch( | 637 CommandLine::ForCurrentProcess()->HasSwitch( |
| 648 switches::kEnableWebsiteSettingsManager)); | 638 switches::kEnableWebsiteSettingsManager)); |
| 649 | 639 |
| 650 values->SetBoolean("usingNewProfilesUI", using_new_profiles_ui); | 640 values->SetBoolean("usingNewProfilesUI", switches::IsNewAvatarMenu()); |
| 651 } | 641 } |
| 652 | 642 |
| 653 #if defined(ENABLE_FULL_PRINTING) | 643 #if defined(ENABLE_FULL_PRINTING) |
| 654 void BrowserOptionsHandler::RegisterCloudPrintValues( | 644 void BrowserOptionsHandler::RegisterCloudPrintValues( |
| 655 base::DictionaryValue* values) { | 645 base::DictionaryValue* values) { |
| 656 values->SetString("cloudPrintOptionLabel", | 646 values->SetString("cloudPrintOptionLabel", |
| 657 l10n_util::GetStringFUTF16( | 647 l10n_util::GetStringFUTF16( |
| 658 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, | 648 IDS_CLOUD_PRINT_CHROMEOS_OPTION_LABEL, |
| 659 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); | 649 l10n_util::GetStringUTF16(IDS_GOOGLE_CLOUD_PRINT))); |
| 660 } | 650 } |
| (...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 | 1966 |
| 1977 void BrowserOptionsHandler::SetMetricsReportingCheckbox(bool checked, | 1967 void BrowserOptionsHandler::SetMetricsReportingCheckbox(bool checked, |
| 1978 bool disabled) { | 1968 bool disabled) { |
| 1979 web_ui()->CallJavascriptFunction( | 1969 web_ui()->CallJavascriptFunction( |
| 1980 "BrowserOptions.setMetricsReportingCheckboxState", | 1970 "BrowserOptions.setMetricsReportingCheckboxState", |
| 1981 base::FundamentalValue(checked), | 1971 base::FundamentalValue(checked), |
| 1982 base::FundamentalValue(disabled)); | 1972 base::FundamentalValue(disabled)); |
| 1983 } | 1973 } |
| 1984 | 1974 |
| 1985 } // namespace options | 1975 } // namespace options |
| OLD | NEW |