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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 void AddLocalizedStringsBulk(content::WebUIDataSource* html_source, | 54 void AddLocalizedStringsBulk(content::WebUIDataSource* html_source, |
55 LocalizedString localized_strings[], | 55 LocalizedString localized_strings[], |
56 size_t num_strings) { | 56 size_t num_strings) { |
57 for (size_t i = 0; i < num_strings; i++) { | 57 for (size_t i = 0; i < num_strings; i++) { |
58 html_source->AddLocalizedString(localized_strings[i].name, | 58 html_source->AddLocalizedString(localized_strings[i].name, |
59 localized_strings[i].id); | 59 localized_strings[i].id); |
60 } | 60 } |
61 } | 61 } |
62 | 62 |
63 void AddCommonStrings(content::WebUIDataSource* html_source) { | 63 void AddCommonStrings(content::WebUIDataSource* html_source, Profile* profile) { |
64 LocalizedString localized_strings[] = { | 64 LocalizedString localized_strings[] = { |
65 {"add", IDS_ADD}, | 65 {"add", IDS_ADD}, |
66 {"cancel", IDS_CANCEL}, | 66 {"cancel", IDS_CANCEL}, |
67 {"disable", IDS_DISABLE}, | 67 {"disable", IDS_DISABLE}, |
68 {"learnMore", IDS_LEARN_MORE}, | 68 {"learnMore", IDS_LEARN_MORE}, |
69 {"ok", IDS_OK}, | 69 {"ok", IDS_OK}, |
70 {"save", IDS_SAVE}, | 70 {"save", IDS_SAVE}, |
71 {"advancedPageTitle", IDS_SETTINGS_ADVANCED}, | 71 {"advancedPageTitle", IDS_SETTINGS_ADVANCED}, |
72 {"basicPageTitle", IDS_SETTINGS_BASIC}, | 72 {"basicPageTitle", IDS_SETTINGS_BASIC}, |
73 {"searchPrompt", IDS_SETTINGS_SEARCH_PROMPT}, | 73 {"searchPrompt", IDS_SETTINGS_SEARCH_PROMPT}, |
74 // TODO(dpapad); IDS_DOWNLOAD_CLEAR_SEARCH and IDS_MD_HISTORY_CLEAR_SEARCH | 74 // TODO(dpapad); IDS_DOWNLOAD_CLEAR_SEARCH and IDS_MD_HISTORY_CLEAR_SEARCH |
75 // are identical, merge them to one and re-use here. | 75 // are identical, merge them to one and re-use here. |
76 {"clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH}, | 76 {"clearSearch", IDS_DOWNLOAD_CLEAR_SEARCH}, |
77 {"settings", IDS_SETTINGS_SETTINGS}, | 77 {"settings", IDS_SETTINGS_SETTINGS}, |
78 {"restart", IDS_SETTINGS_RESTART}, | 78 {"restart", IDS_SETTINGS_RESTART}, |
79 }; | 79 }; |
80 AddLocalizedStringsBulk(html_source, localized_strings, | 80 AddLocalizedStringsBulk(html_source, localized_strings, |
81 arraysize(localized_strings)); | 81 arraysize(localized_strings)); |
| 82 |
| 83 html_source->AddBoolean( |
| 84 "isGuest", |
| 85 #if defined(OS_CHROMEOS) |
| 86 user_manager::UserManager::Get()->IsLoggedInAsGuest()); |
| 87 #else |
| 88 profile->IsOffTheRecord()); |
| 89 #endif |
82 } | 90 } |
83 | 91 |
84 void AddA11yStrings(content::WebUIDataSource* html_source) { | 92 void AddA11yStrings(content::WebUIDataSource* html_source) { |
85 LocalizedString localized_strings[] = { | 93 LocalizedString localized_strings[] = { |
86 {"a11yPageTitle", IDS_SETTINGS_ACCESSIBILITY}, | 94 {"a11yPageTitle", IDS_SETTINGS_ACCESSIBILITY}, |
87 {"moreFeaturesLink", IDS_SETTINGS_MORE_FEATURES_LINK}, | 95 {"moreFeaturesLink", IDS_SETTINGS_MORE_FEATURES_LINK}, |
88 #if defined(OS_CHROMEOS) | 96 #if defined(OS_CHROMEOS) |
89 {"optionsInMenuLabel", IDS_SETTINGS_OPTIONS_IN_MENU_LABEL}, | 97 {"optionsInMenuLabel", IDS_SETTINGS_OPTIONS_IN_MENU_LABEL}, |
90 {"largeMouseCursorLabel", IDS_SETTINGS_LARGE_MOUSE_CURSOR_LABEL}, | 98 {"largeMouseCursorLabel", IDS_SETTINGS_LARGE_MOUSE_CURSOR_LABEL}, |
91 {"highContrastLabel", IDS_SETTINGS_HIGH_CONTRAST_LABEL}, | 99 {"highContrastLabel", IDS_SETTINGS_HIGH_CONTRAST_LABEL}, |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, | 1295 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, |
1288 }; | 1296 }; |
1289 AddLocalizedStringsBulk(html_source, localized_strings, | 1297 AddLocalizedStringsBulk(html_source, localized_strings, |
1290 arraysize(localized_strings)); | 1298 arraysize(localized_strings)); |
1291 } | 1299 } |
1292 | 1300 |
1293 } // namespace | 1301 } // namespace |
1294 | 1302 |
1295 void AddLocalizedStrings(content::WebUIDataSource* html_source, | 1303 void AddLocalizedStrings(content::WebUIDataSource* html_source, |
1296 Profile* profile) { | 1304 Profile* profile) { |
1297 AddCommonStrings(html_source); | 1305 AddCommonStrings(html_source, profile); |
1298 | 1306 |
1299 AddA11yStrings(html_source); | 1307 AddA11yStrings(html_source); |
1300 AddAboutStrings(html_source); | 1308 AddAboutStrings(html_source); |
1301 #if defined(OS_CHROMEOS) | 1309 #if defined(OS_CHROMEOS) |
1302 AddAccountUITweaksStrings(html_source, profile); | 1310 AddAccountUITweaksStrings(html_source, profile); |
1303 #endif | 1311 #endif |
1304 AddAppearanceStrings(html_source); | 1312 AddAppearanceStrings(html_source); |
1305 #if defined(OS_CHROMEOS) | 1313 #if defined(OS_CHROMEOS) |
1306 AddBluetoothStrings(html_source); | 1314 AddBluetoothStrings(html_source); |
1307 #endif | 1315 #endif |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 #endif | 1348 #endif |
1341 AddUsersStrings(html_source); | 1349 AddUsersStrings(html_source); |
1342 AddWebContentStrings(html_source); | 1350 AddWebContentStrings(html_source); |
1343 | 1351 |
1344 policy_indicator::AddLocalizedStrings(html_source); | 1352 policy_indicator::AddLocalizedStrings(html_source); |
1345 | 1353 |
1346 html_source->SetJsonPath(kLocalizedStringsFile); | 1354 html_source->SetJsonPath(kLocalizedStringsFile); |
1347 } | 1355 } |
1348 | 1356 |
1349 } // namespace settings | 1357 } // namespace settings |
OLD | NEW |