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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, | 1259 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, |
1252 }; | 1260 }; |
1253 AddLocalizedStringsBulk(html_source, localized_strings, | 1261 AddLocalizedStringsBulk(html_source, localized_strings, |
1254 arraysize(localized_strings)); | 1262 arraysize(localized_strings)); |
1255 } | 1263 } |
1256 | 1264 |
1257 } // namespace | 1265 } // namespace |
1258 | 1266 |
1259 void AddLocalizedStrings(content::WebUIDataSource* html_source, | 1267 void AddLocalizedStrings(content::WebUIDataSource* html_source, |
1260 Profile* profile) { | 1268 Profile* profile) { |
1261 AddCommonStrings(html_source); | 1269 AddCommonStrings(html_source, profile); |
1262 | 1270 |
1263 AddA11yStrings(html_source); | 1271 AddA11yStrings(html_source); |
1264 AddAboutStrings(html_source); | 1272 AddAboutStrings(html_source); |
1265 #if defined(OS_CHROMEOS) | 1273 #if defined(OS_CHROMEOS) |
1266 AddAccountUITweaksStrings(html_source, profile); | 1274 AddAccountUITweaksStrings(html_source, profile); |
1267 #endif | 1275 #endif |
1268 AddAppearanceStrings(html_source); | 1276 AddAppearanceStrings(html_source); |
1269 #if defined(OS_CHROMEOS) | 1277 #if defined(OS_CHROMEOS) |
1270 AddBluetoothStrings(html_source); | 1278 AddBluetoothStrings(html_source); |
1271 #endif | 1279 #endif |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 #endif | 1312 #endif |
1305 AddUsersStrings(html_source); | 1313 AddUsersStrings(html_source); |
1306 AddWebContentStrings(html_source); | 1314 AddWebContentStrings(html_source); |
1307 | 1315 |
1308 policy_indicator::AddLocalizedStrings(html_source); | 1316 policy_indicator::AddLocalizedStrings(html_source); |
1309 | 1317 |
1310 html_source->SetJsonPath(kLocalizedStringsFile); | 1318 html_source->SetJsonPath(kLocalizedStringsFile); |
1311 } | 1319 } |
1312 | 1320 |
1313 } // namespace settings | 1321 } // namespace settings |
OLD | NEW |