Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/md_settings_localized_strings_provide r.h" | 5 #include "chrome/browser/ui/webui/settings/md_settings_localized_strings_provide r.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 | 27 |
| 28 #if defined(OS_CHROMEOS) | 28 #if defined(OS_CHROMEOS) |
| 29 #include "ash/system/chromeos/devicetype_utils.h" | 29 #include "ash/system/chromeos/devicetype_utils.h" |
| 30 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 30 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 31 #include "chrome/browser/signin/easy_unlock_service.h" | 31 #include "chrome/browser/signin/easy_unlock_service.h" |
| 32 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" | 32 #include "chrome/browser/ui/webui/chromeos/ui_account_tweaks.h" |
| 33 #include "chromeos/chromeos_switches.h" | 33 #include "chromeos/chromeos_switches.h" |
| 34 #include "components/user_manager/user.h" | 34 #include "components/user_manager/user.h" |
| 35 #include "components/user_manager/user_manager.h" | 35 #include "components/user_manager/user_manager.h" |
| 36 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" | 36 #include "ui/chromeos/strings/grit/ui_chromeos_strings.h" |
| 37 #else | |
| 38 #include "chrome/browser/ui/webui/settings/system_handler.h" | |
| 37 #endif | 39 #endif |
| 38 | 40 |
| 41 namespace settings { | |
| 39 namespace { | 42 namespace { |
| 40 | 43 |
| 41 // Note that settings.html contains a <script> tag which imports a script of | 44 // Note that settings.html contains a <script> tag which imports a script of |
| 42 // the following name. These names must be kept in sync. | 45 // the following name. These names must be kept in sync. |
| 43 const char kLocalizedStringsFile[] = "strings.js"; | 46 const char kLocalizedStringsFile[] = "strings.js"; |
| 44 | 47 |
| 45 struct LocalizedString { | 48 struct LocalizedString { |
| 46 const char* name; | 49 const char* name; |
| 47 int id; | 50 int id; |
| 48 }; | 51 }; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 60 LocalizedString localized_strings[] = { | 63 LocalizedString localized_strings[] = { |
| 61 {"add", IDS_ADD}, | 64 {"add", IDS_ADD}, |
| 62 {"cancel", IDS_CANCEL}, | 65 {"cancel", IDS_CANCEL}, |
| 63 {"disable", IDS_DISABLE}, | 66 {"disable", IDS_DISABLE}, |
| 64 {"learnMore", IDS_LEARN_MORE}, | 67 {"learnMore", IDS_LEARN_MORE}, |
| 65 {"ok", IDS_OK}, | 68 {"ok", IDS_OK}, |
| 66 {"save", IDS_SAVE}, | 69 {"save", IDS_SAVE}, |
| 67 {"advancedPageTitle", IDS_SETTINGS_ADVANCED}, | 70 {"advancedPageTitle", IDS_SETTINGS_ADVANCED}, |
| 68 {"basicPageTitle", IDS_SETTINGS_BASIC}, | 71 {"basicPageTitle", IDS_SETTINGS_BASIC}, |
| 69 {"settings", IDS_SETTINGS_SETTINGS}, | 72 {"settings", IDS_SETTINGS_SETTINGS}, |
| 73 {"restart", IDS_SETTINGS_RESTART}, | |
| 70 }; | 74 }; |
| 71 AddLocalizedStringsBulk(html_source, localized_strings, | 75 AddLocalizedStringsBulk(html_source, localized_strings, |
| 72 arraysize(localized_strings)); | 76 arraysize(localized_strings)); |
| 73 } | 77 } |
| 74 | 78 |
| 75 void AddA11yStrings(content::WebUIDataSource* html_source) { | 79 void AddA11yStrings(content::WebUIDataSource* html_source) { |
| 76 LocalizedString localized_strings[] = { | 80 LocalizedString localized_strings[] = { |
| 77 {"a11yPageTitle", IDS_SETTINGS_ACCESSIBILITY}, | 81 {"a11yPageTitle", IDS_SETTINGS_ACCESSIBILITY}, |
| 78 #if defined(OS_CHROMEOS) | 82 #if defined(OS_CHROMEOS) |
| 79 {"moreFeaturesLink", IDS_SETTINGS_MORE_FEATURES_LINK}, | 83 {"moreFeaturesLink", IDS_SETTINGS_MORE_FEATURES_LINK}, |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 LocalizedString localized_strings[] = { | 363 LocalizedString localized_strings[] = { |
| 360 {"resetPageTitle", IDS_SETTINGS_RESET}, | 364 {"resetPageTitle", IDS_SETTINGS_RESET}, |
| 361 {"resetPageDescription", IDS_RESET_PROFILE_SETTINGS_DESCRIPTION}, | 365 {"resetPageDescription", IDS_RESET_PROFILE_SETTINGS_DESCRIPTION}, |
| 362 {"resetPageExplanation", IDS_RESET_PROFILE_SETTINGS_EXPLANATION}, | 366 {"resetPageExplanation", IDS_RESET_PROFILE_SETTINGS_EXPLANATION}, |
| 363 {"resetPageCommit", IDS_RESET_PROFILE_SETTINGS_COMMIT_BUTTON}, | 367 {"resetPageCommit", IDS_RESET_PROFILE_SETTINGS_COMMIT_BUTTON}, |
| 364 {"resetPageFeedback", IDS_RESET_PROFILE_SETTINGS_FEEDBACK}, | 368 {"resetPageFeedback", IDS_RESET_PROFILE_SETTINGS_FEEDBACK}, |
| 365 #if defined(OS_CHROMEOS) | 369 #if defined(OS_CHROMEOS) |
| 366 {"powerwashTitle", IDS_OPTIONS_FACTORY_RESET}, | 370 {"powerwashTitle", IDS_OPTIONS_FACTORY_RESET}, |
| 367 {"powerwashDialogTitle", IDS_OPTIONS_FACTORY_RESET_HEADING}, | 371 {"powerwashDialogTitle", IDS_OPTIONS_FACTORY_RESET_HEADING}, |
| 368 {"powerwashDialogExplanation", IDS_OPTIONS_FACTORY_RESET_WARNING}, | 372 {"powerwashDialogExplanation", IDS_OPTIONS_FACTORY_RESET_WARNING}, |
| 369 {"powerwashDialogButton", IDS_RELAUNCH_BUTTON}, | 373 {"powerwashDialogButton", IDS_RELAUNCH_BUTTON}, |
|
dpapad
2016/03/21 18:17:38
Can you add a TODO here for re-using the new IDS_S
Dan Beam
2016/03/22 02:16:59
Done. (just did it like we talked about on chat)
| |
| 370 {"powerwashLearnMoreUrl", IDS_FACTORY_RESET_HELP_URL}, | 374 {"powerwashLearnMoreUrl", IDS_FACTORY_RESET_HELP_URL}, |
| 371 #endif | 375 #endif |
| 372 // Automatic reset banner. | 376 // Automatic reset banner. |
| 373 {"resetProfileBannerButton", | 377 {"resetProfileBannerButton", |
| 374 IDS_AUTOMATIC_SETTINGS_RESET_BANNER_RESET_BUTTON_TEXT}, | 378 IDS_AUTOMATIC_SETTINGS_RESET_BANNER_RESET_BUTTON_TEXT}, |
| 375 {"resetProfileBannerDescription", IDS_AUTOMATIC_SETTINGS_RESET_BANNER_TEXT}, | 379 {"resetProfileBannerDescription", IDS_AUTOMATIC_SETTINGS_RESET_BANNER_TEXT}, |
| 376 }; | 380 }; |
| 377 AddLocalizedStringsBulk(html_source, localized_strings, | 381 AddLocalizedStringsBulk(html_source, localized_strings, |
| 378 arraysize(localized_strings)); | 382 arraysize(localized_strings)); |
| 379 | 383 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 490 {"cannotBeDisplayedInThisLanguage", | 494 {"cannotBeDisplayedInThisLanguage", |
| 491 IDS_SETTINGS_LANGUAGES_CANNOT_BE_DISPLAYED_IN_THIS_LANGUAGE}, | 495 IDS_SETTINGS_LANGUAGES_CANNOT_BE_DISPLAYED_IN_THIS_LANGUAGE}, |
| 492 {"isDisplayedInThisLanguage", | 496 {"isDisplayedInThisLanguage", |
| 493 IDS_SETTINGS_LANGUAGES_IS_DISPLAYED_IN_THIS_LANGUAGE}, | 497 IDS_SETTINGS_LANGUAGES_IS_DISPLAYED_IN_THIS_LANGUAGE}, |
| 494 {"displayInThisLanguage", | 498 {"displayInThisLanguage", |
| 495 IDS_SETTINGS_LANGUAGES_DISPLAY_IN_THIS_LANGUAGE}, | 499 IDS_SETTINGS_LANGUAGES_DISPLAY_IN_THIS_LANGUAGE}, |
| 496 {"offerToTranslateInThisLanguage", | 500 {"offerToTranslateInThisLanguage", |
| 497 IDS_OPTIONS_LANGUAGES_OFFER_TO_TRANSLATE_IN_THIS_LANGUAGE}, | 501 IDS_OPTIONS_LANGUAGES_OFFER_TO_TRANSLATE_IN_THIS_LANGUAGE}, |
| 498 {"cannotTranslateInThisLanguage", | 502 {"cannotTranslateInThisLanguage", |
| 499 IDS_OPTIONS_LANGUAGES_CANNOT_TRANSLATE_IN_THIS_LANGUAGE}, | 503 IDS_OPTIONS_LANGUAGES_CANNOT_TRANSLATE_IN_THIS_LANGUAGE}, |
| 500 {"restart", IDS_OPTIONS_SETTINGS_LANGUAGES_RELAUNCH_BUTTON}, | |
| 501 {"editDictionaryPageTitle", IDS_SETTINGS_LANGUAGES_EDIT_DICTIONARY_TITLE}, | 504 {"editDictionaryPageTitle", IDS_SETTINGS_LANGUAGES_EDIT_DICTIONARY_TITLE}, |
| 502 {"addDictionaryWordLabel", IDS_SETTINGS_LANGUAGES_ADD_DICTIONARY_WORD}, | 505 {"addDictionaryWordLabel", IDS_SETTINGS_LANGUAGES_ADD_DICTIONARY_WORD}, |
| 503 {"addDictionaryWordButton", | 506 {"addDictionaryWordButton", |
| 504 IDS_SETTINGS_LANGUAGES_ADD_DICTIONARY_WORD_BUTTON}, | 507 IDS_SETTINGS_LANGUAGES_ADD_DICTIONARY_WORD_BUTTON}, |
| 505 {"customDictionaryWords", IDS_SETTINGS_LANGUAGES_DICTIONARY_WORDS}, | 508 {"customDictionaryWords", IDS_SETTINGS_LANGUAGES_DICTIONARY_WORDS}, |
| 506 }; | 509 }; |
| 507 AddLocalizedStringsBulk(html_source, localized_strings, | 510 AddLocalizedStringsBulk(html_source, localized_strings, |
| 508 arraysize(localized_strings)); | 511 arraysize(localized_strings)); |
| 509 } | 512 } |
| 510 | 513 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 {"systemPageTitle", IDS_SETTINGS_SYSTEM}, | 806 {"systemPageTitle", IDS_SETTINGS_SYSTEM}, |
| 804 #if !defined(OS_MACOSX) | 807 #if !defined(OS_MACOSX) |
| 805 {"backgroundAppsLabel", IDS_SETTINGS_SYSTEM_BACKGROUND_APPS_LABEL}, | 808 {"backgroundAppsLabel", IDS_SETTINGS_SYSTEM_BACKGROUND_APPS_LABEL}, |
| 806 #endif | 809 #endif |
| 807 {"hardwareAccelerationLabel", | 810 {"hardwareAccelerationLabel", |
| 808 IDS_SETTINGS_SYSTEM_HARDWARE_ACCELERATION_LABEL}, | 811 IDS_SETTINGS_SYSTEM_HARDWARE_ACCELERATION_LABEL}, |
| 809 {"changeProxySettings", IDS_SETTINGS_SYSTEM_PROXY_SETTINGS_BUTTON}, | 812 {"changeProxySettings", IDS_SETTINGS_SYSTEM_PROXY_SETTINGS_BUTTON}, |
| 810 }; | 813 }; |
| 811 AddLocalizedStringsBulk(html_source, localized_strings, | 814 AddLocalizedStringsBulk(html_source, localized_strings, |
| 812 arraysize(localized_strings)); | 815 arraysize(localized_strings)); |
| 816 | |
| 817 // TODO(dbeam): we probably shouldn't name this class "strings" but add all | |
|
dpapad
2016/03/21 18:17:38
I guess you are referring to the file name "md_set
Dan Beam
2016/03/22 02:16:59
Done.
| |
| 818 // kinds of other stuff as well (and pull logic from handlers to this file). | |
| 819 SystemHandler::AddLoadTimeData(html_source); | |
| 813 } | 820 } |
| 814 #endif | 821 #endif |
| 815 | 822 |
| 816 void AddWebContentStrings(content::WebUIDataSource* html_source) { | 823 void AddWebContentStrings(content::WebUIDataSource* html_source) { |
| 817 LocalizedString localized_strings[] = { | 824 LocalizedString localized_strings[] = { |
| 818 {"webContent", IDS_SETTINGS_WEB_CONTENT}, | 825 {"webContent", IDS_SETTINGS_WEB_CONTENT}, |
| 819 {"pageZoom", IDS_SETTINGS_PAGE_ZOOM_LABEL}, | 826 {"pageZoom", IDS_SETTINGS_PAGE_ZOOM_LABEL}, |
| 820 {"fontSize", IDS_SETTINGS_FONT_SIZE_LABEL}, | 827 {"fontSize", IDS_SETTINGS_FONT_SIZE_LABEL}, |
| 821 {"verySmall", IDS_SETTINGS_VERY_SMALL_FONT}, | 828 {"verySmall", IDS_SETTINGS_VERY_SMALL_FONT}, |
| 822 {"small", IDS_SETTINGS_SMALL_FONT}, | 829 {"small", IDS_SETTINGS_SMALL_FONT}, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 839 {"advancedFontSettings", IDS_SETTINGS_ADVANCED_FONT_SETTINGS}, | 846 {"advancedFontSettings", IDS_SETTINGS_ADVANCED_FONT_SETTINGS}, |
| 840 {"requiresWebStoreExtension", IDS_SETTINGS_REQUIRES_WEB_STORE_EXTENSION}, | 847 {"requiresWebStoreExtension", IDS_SETTINGS_REQUIRES_WEB_STORE_EXTENSION}, |
| 841 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, | 848 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, |
| 842 }; | 849 }; |
| 843 AddLocalizedStringsBulk(html_source, localized_strings, | 850 AddLocalizedStringsBulk(html_source, localized_strings, |
| 844 arraysize(localized_strings)); | 851 arraysize(localized_strings)); |
| 845 } | 852 } |
| 846 | 853 |
| 847 } // namespace | 854 } // namespace |
| 848 | 855 |
| 849 namespace settings { | |
| 850 | |
| 851 void AddLocalizedStrings(content::WebUIDataSource* html_source, | 856 void AddLocalizedStrings(content::WebUIDataSource* html_source, |
| 852 Profile* profile) { | 857 Profile* profile) { |
| 853 AddCommonStrings(html_source); | 858 AddCommonStrings(html_source); |
| 854 | 859 |
| 855 AddA11yStrings(html_source); | 860 AddA11yStrings(html_source); |
| 856 AddAboutStrings(html_source); | 861 AddAboutStrings(html_source); |
| 857 #if defined(OS_CHROMEOS) | 862 #if defined(OS_CHROMEOS) |
| 858 AddAccountUITweaksStrings(html_source, profile); | 863 AddAccountUITweaksStrings(html_source, profile); |
| 859 #endif | 864 #endif |
| 860 AddAppearanceStrings(html_source); | 865 AddAppearanceStrings(html_source); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 895 #endif | 900 #endif |
| 896 AddUsersStrings(html_source); | 901 AddUsersStrings(html_source); |
| 897 AddWebContentStrings(html_source); | 902 AddWebContentStrings(html_source); |
| 898 | 903 |
| 899 policy_indicator::AddLocalizedStrings(html_source); | 904 policy_indicator::AddLocalizedStrings(html_source); |
| 900 | 905 |
| 901 html_source->SetJsonPath(kLocalizedStringsFile); | 906 html_source->SetJsonPath(kLocalizedStringsFile); |
| 902 } | 907 } |
| 903 | 908 |
| 904 } // namespace settings | 909 } // namespace settings |
| OLD | NEW |