| 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/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 void AddLocalizedStringsBulk(content::WebUIDataSource* html_source, | 57 void AddLocalizedStringsBulk(content::WebUIDataSource* html_source, |
| 58 LocalizedString localized_strings[], | 58 LocalizedString localized_strings[], |
| 59 size_t num_strings) { | 59 size_t num_strings) { |
| 60 for (size_t i = 0; i < num_strings; i++) { | 60 for (size_t i = 0; i < num_strings; i++) { |
| 61 html_source->AddLocalizedString(localized_strings[i].name, | 61 html_source->AddLocalizedString(localized_strings[i].name, |
| 62 localized_strings[i].id); | 62 localized_strings[i].id); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 void AddCommonStrings(content::WebUIDataSource* html_source) { | 66 void AddCommonStrings(content::WebUIDataSource* html_source, Profile* profile) { |
| 67 LocalizedString localized_strings[] = { | 67 LocalizedString localized_strings[] = { |
| 68 {"add", IDS_ADD}, | 68 {"add", IDS_ADD}, |
| 69 {"cancel", IDS_CANCEL}, | 69 {"cancel", IDS_CANCEL}, |
| 70 {"disable", IDS_DISABLE}, | 70 {"disable", IDS_DISABLE}, |
| 71 {"learnMore", IDS_LEARN_MORE}, | 71 {"learnMore", IDS_LEARN_MORE}, |
| 72 {"ok", IDS_OK}, | 72 {"ok", IDS_OK}, |
| 73 {"save", IDS_SAVE}, | 73 {"save", IDS_SAVE}, |
| 74 {"advancedPageTitle", IDS_SETTINGS_ADVANCED}, | 74 {"advancedPageTitle", IDS_SETTINGS_ADVANCED}, |
| 75 {"basicPageTitle", IDS_SETTINGS_BASIC}, | 75 {"basicPageTitle", IDS_SETTINGS_BASIC}, |
| 76 {"searchPrompt", IDS_SETTINGS_SEARCH_PROMPT}, | 76 {"searchPrompt", IDS_SETTINGS_SEARCH_PROMPT}, |
| 77 // TODO(dpapad); IDS_DOWNLOAD_CLEAR_SEARCH and IDS_MD_HISTORY_CLEAR_SEARCH | 77 // TODO(dpapad); IDS_DOWNLOAD_CLEAR_SEARCH and IDS_MD_HISTORY_CLEAR_SEARCH |
| 78 // are identical, merge them to one and re-use here. | 78 // are identical, merge them to one and re-use here. |
| 79 {"clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH}, | 79 {"clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH}, |
| 80 {"settings", IDS_SETTINGS_SETTINGS}, | 80 {"settings", IDS_SETTINGS_SETTINGS}, |
| 81 {"restart", IDS_SETTINGS_RESTART}, | 81 {"restart", IDS_SETTINGS_RESTART}, |
| 82 }; | 82 }; |
| 83 AddLocalizedStringsBulk(html_source, localized_strings, | 83 AddLocalizedStringsBulk(html_source, localized_strings, |
| 84 arraysize(localized_strings)); | 84 arraysize(localized_strings)); |
| 85 |
| 86 html_source->AddBoolean( |
| 87 "isGuest", |
| 88 #if defined(OS_CHROMEOS) |
| 89 user_manager::UserManager::Get()->IsLoggedInAsGuest()); |
| 90 #else |
| 91 profile->IsOffTheRecord()); |
| 92 #endif |
| 85 } | 93 } |
| 86 | 94 |
| 87 void AddA11yStrings(content::WebUIDataSource* html_source) { | 95 void AddA11yStrings(content::WebUIDataSource* html_source) { |
| 88 LocalizedString localized_strings[] = { | 96 LocalizedString localized_strings[] = { |
| 89 {"a11yPageTitle", IDS_SETTINGS_ACCESSIBILITY}, | 97 {"a11yPageTitle", IDS_SETTINGS_ACCESSIBILITY}, |
| 90 {"moreFeaturesLink", IDS_SETTINGS_MORE_FEATURES_LINK}, | 98 {"moreFeaturesLink", IDS_SETTINGS_MORE_FEATURES_LINK}, |
| 91 #if defined(OS_CHROMEOS) | 99 #if defined(OS_CHROMEOS) |
| 92 {"optionsInMenuLabel", IDS_SETTINGS_OPTIONS_IN_MENU_LABEL}, | 100 {"optionsInMenuLabel", IDS_SETTINGS_OPTIONS_IN_MENU_LABEL}, |
| 93 {"largeMouseCursorLabel", IDS_SETTINGS_LARGE_MOUSE_CURSOR_LABEL}, | 101 {"largeMouseCursorLabel", IDS_SETTINGS_LARGE_MOUSE_CURSOR_LABEL}, |
| 94 {"highContrastLabel", IDS_SETTINGS_HIGH_CONTRAST_LABEL}, | 102 {"highContrastLabel", IDS_SETTINGS_HIGH_CONTRAST_LABEL}, |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1225 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, | 1233 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, |
| 1226 }; | 1234 }; |
| 1227 AddLocalizedStringsBulk(html_source, localized_strings, | 1235 AddLocalizedStringsBulk(html_source, localized_strings, |
| 1228 arraysize(localized_strings)); | 1236 arraysize(localized_strings)); |
| 1229 } | 1237 } |
| 1230 | 1238 |
| 1231 } // namespace | 1239 } // namespace |
| 1232 | 1240 |
| 1233 void AddLocalizedStrings(content::WebUIDataSource* html_source, | 1241 void AddLocalizedStrings(content::WebUIDataSource* html_source, |
| 1234 Profile* profile) { | 1242 Profile* profile) { |
| 1235 AddCommonStrings(html_source); | 1243 AddCommonStrings(html_source, profile); |
| 1236 | 1244 |
| 1237 AddA11yStrings(html_source); | 1245 AddA11yStrings(html_source); |
| 1238 AddAboutStrings(html_source); | 1246 AddAboutStrings(html_source); |
| 1239 #if defined(OS_CHROMEOS) | 1247 #if defined(OS_CHROMEOS) |
| 1240 AddAccountUITweaksStrings(html_source, profile); | 1248 AddAccountUITweaksStrings(html_source, profile); |
| 1241 #endif | 1249 #endif |
| 1242 AddAppearanceStrings(html_source); | 1250 AddAppearanceStrings(html_source); |
| 1243 #if defined(OS_CHROMEOS) | 1251 #if defined(OS_CHROMEOS) |
| 1244 AddBluetoothStrings(html_source); | 1252 AddBluetoothStrings(html_source); |
| 1245 #endif | 1253 #endif |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 #endif | 1286 #endif |
| 1279 AddUsersStrings(html_source); | 1287 AddUsersStrings(html_source); |
| 1280 AddWebContentStrings(html_source); | 1288 AddWebContentStrings(html_source); |
| 1281 | 1289 |
| 1282 policy_indicator::AddLocalizedStrings(html_source); | 1290 policy_indicator::AddLocalizedStrings(html_source); |
| 1283 | 1291 |
| 1284 html_source->SetJsonPath(kLocalizedStringsFile); | 1292 html_source->SetJsonPath(kLocalizedStringsFile); |
| 1285 } | 1293 } |
| 1286 | 1294 |
| 1287 } // namespace settings | 1295 } // namespace settings |
| OLD | NEW |