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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, | 1244 {"quickBrownFox", IDS_SETTINGS_QUICK_BROWN_FOX}, |
1237 }; | 1245 }; |
1238 AddLocalizedStringsBulk(html_source, localized_strings, | 1246 AddLocalizedStringsBulk(html_source, localized_strings, |
1239 arraysize(localized_strings)); | 1247 arraysize(localized_strings)); |
1240 } | 1248 } |
1241 | 1249 |
1242 } // namespace | 1250 } // namespace |
1243 | 1251 |
1244 void AddLocalizedStrings(content::WebUIDataSource* html_source, | 1252 void AddLocalizedStrings(content::WebUIDataSource* html_source, |
1245 Profile* profile) { | 1253 Profile* profile) { |
1246 AddCommonStrings(html_source); | 1254 AddCommonStrings(html_source, profile); |
1247 | 1255 |
1248 AddA11yStrings(html_source); | 1256 AddA11yStrings(html_source); |
1249 AddAboutStrings(html_source); | 1257 AddAboutStrings(html_source); |
1250 #if defined(OS_CHROMEOS) | 1258 #if defined(OS_CHROMEOS) |
1251 AddAccountUITweaksStrings(html_source, profile); | 1259 AddAccountUITweaksStrings(html_source, profile); |
1252 #endif | 1260 #endif |
1253 AddAppearanceStrings(html_source); | 1261 AddAppearanceStrings(html_source); |
1254 #if defined(OS_CHROMEOS) | 1262 #if defined(OS_CHROMEOS) |
1255 AddBluetoothStrings(html_source); | 1263 AddBluetoothStrings(html_source); |
1256 #endif | 1264 #endif |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 #endif | 1297 #endif |
1290 AddUsersStrings(html_source); | 1298 AddUsersStrings(html_source); |
1291 AddWebContentStrings(html_source); | 1299 AddWebContentStrings(html_source); |
1292 | 1300 |
1293 policy_indicator::AddLocalizedStrings(html_source); | 1301 policy_indicator::AddLocalizedStrings(html_source); |
1294 | 1302 |
1295 html_source->SetJsonPath(kLocalizedStringsFile); | 1303 html_source->SetJsonPath(kLocalizedStringsFile); |
1296 } | 1304 } |
1297 | 1305 |
1298 } // namespace settings | 1306 } // namespace settings |
OLD | NEW |