Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: chrome/browser/ui/webui/help/help_handler.cc

Issue 1332353003: Move resources for version_ui to //components/version_ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/flash_ui.cc ('k') | chrome/browser/ui/webui/nacl_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/help/help_handler.h" 5 #include "chrome/browser/ui/webui/help/help_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 20 matching lines...) Expand all
31 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
32 #include "chrome/grit/chromium_strings.h" 32 #include "chrome/grit/chromium_strings.h"
33 #include "chrome/grit/generated_resources.h" 33 #include "chrome/grit/generated_resources.h"
34 #include "components/google/core/browser/google_util.h" 34 #include "components/google/core/browser/google_util.h"
35 #include "components/version_info/version_info.h" 35 #include "components/version_info/version_info.h"
36 #include "content/public/browser/browser_thread.h" 36 #include "content/public/browser/browser_thread.h"
37 #include "content/public/browser/notification_service.h" 37 #include "content/public/browser/notification_service.h"
38 #include "content/public/browser/web_contents.h" 38 #include "content/public/browser/web_contents.h"
39 #include "content/public/browser/web_ui.h" 39 #include "content/public/browser/web_ui.h"
40 #include "content/public/common/user_agent.h" 40 #include "content/public/common/user_agent.h"
41 #include "grit/components_chromium_strings.h"
42 #include "grit/components_google_chrome_strings.h"
41 #include "grit/components_strings.h" 43 #include "grit/components_strings.h"
42 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
43 #include "v8/include/v8.h" 45 #include "v8/include/v8.h"
44 46
45 #if defined(OS_MACOSX) 47 #if defined(OS_MACOSX)
46 #include "chrome/browser/mac/obsolete_system.h" 48 #include "chrome/browser/mac/obsolete_system.h"
47 #endif 49 #endif
48 50
49 #if defined(OS_CHROMEOS) 51 #if defined(OS_CHROMEOS)
50 #include "base/files/file_util_proxy.h" 52 #include "base/files/file_util_proxy.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 HelpHandler::~HelpHandler() { 211 HelpHandler::~HelpHandler() {
210 } 212 }
211 213
212 void HelpHandler::GetLocalizedValues(base::DictionaryValue* localized_strings) { 214 void HelpHandler::GetLocalizedValues(base::DictionaryValue* localized_strings) {
213 struct L10nResources { 215 struct L10nResources {
214 const char* name; 216 const char* name;
215 int ids; 217 int ids;
216 }; 218 };
217 219
218 static L10nResources resources[] = { 220 static L10nResources resources[] = {
219 { "aboutTitle", IDS_ABOUT_TITLE }, 221 {"aboutTitle", IDS_ABOUT_TITLE},
220 #if defined(OS_CHROMEOS) 222 #if defined(OS_CHROMEOS)
221 { "aboutProductTitle", IDS_PRODUCT_OS_NAME }, 223 {"aboutProductTitle", IDS_PRODUCT_OS_NAME},
222 #else 224 #else
223 { "aboutProductTitle", IDS_PRODUCT_NAME }, 225 {"aboutProductTitle", IDS_PRODUCT_NAME},
224 #endif 226 #endif
225 { "aboutProductDescription", IDS_ABOUT_PRODUCT_DESCRIPTION }, 227 {"aboutProductDescription", IDS_ABOUT_PRODUCT_DESCRIPTION},
226 { "relaunch", IDS_RELAUNCH_BUTTON }, 228 {"relaunch", IDS_RELAUNCH_BUTTON},
227 #if defined(OS_CHROMEOS) 229 #if defined(OS_CHROMEOS)
228 { "relaunchAndPowerwash", IDS_RELAUNCH_AND_POWERWASH_BUTTON }, 230 {"relaunchAndPowerwash", IDS_RELAUNCH_AND_POWERWASH_BUTTON},
229 #endif 231 #endif
230 { "productName", IDS_PRODUCT_NAME }, 232 {"productName", IDS_PRODUCT_NAME},
231 { "updateCheckStarted", IDS_UPGRADE_CHECK_STARTED }, 233 {"updateCheckStarted", IDS_UPGRADE_CHECK_STARTED},
232 { "upToDate", IDS_UPGRADE_UP_TO_DATE }, 234 {"upToDate", IDS_UPGRADE_UP_TO_DATE},
233 { "updating", IDS_UPGRADE_UPDATING }, 235 {"updating", IDS_UPGRADE_UPDATING},
234 #if defined(OS_CHROMEOS) 236 #if defined(OS_CHROMEOS)
235 { "updateButton", IDS_UPGRADE_BUTTON }, 237 {"updateButton", IDS_UPGRADE_BUTTON},
236 { "updatingChannelSwitch", IDS_UPGRADE_UPDATING_CHANNEL_SWITCH }, 238 {"updatingChannelSwitch", IDS_UPGRADE_UPDATING_CHANNEL_SWITCH},
237 #endif 239 #endif
238 { "updateAlmostDone", IDS_UPGRADE_SUCCESSFUL_RELAUNCH }, 240 {"updateAlmostDone", IDS_UPGRADE_SUCCESSFUL_RELAUNCH},
239 #if defined(OS_CHROMEOS) 241 #if defined(OS_CHROMEOS)
240 { "successfulChannelSwitch", IDS_UPGRADE_SUCCESSFUL_CHANNEL_SWITCH }, 242 {"successfulChannelSwitch", IDS_UPGRADE_SUCCESSFUL_CHANNEL_SWITCH},
241 #endif 243 #endif
242 { "getHelpWithChrome", IDS_GET_HELP_USING_CHROME }, 244 {"getHelpWithChrome", IDS_GET_HELP_USING_CHROME},
243 { "reportAnIssue", IDS_REPORT_AN_ISSUE }, 245 {"reportAnIssue", IDS_REPORT_AN_ISSUE},
244 #if defined(OS_CHROMEOS) 246 #if defined(OS_CHROMEOS)
245 { "platform", IDS_PLATFORM_LABEL }, 247 {"platform", IDS_PLATFORM_LABEL},
246 { "firmware", IDS_ABOUT_PAGE_FIRMWARE }, 248 {"firmware", IDS_ABOUT_PAGE_FIRMWARE},
247 { "showMoreInfo", IDS_SHOW_MORE_INFO }, 249 {"showMoreInfo", IDS_SHOW_MORE_INFO},
248 { "hideMoreInfo", IDS_HIDE_MORE_INFO }, 250 {"hideMoreInfo", IDS_HIDE_MORE_INFO},
249 { "channel", IDS_ABOUT_PAGE_CHANNEL }, 251 {"channel", IDS_ABOUT_PAGE_CHANNEL},
250 { "stable", IDS_ABOUT_PAGE_CHANNEL_STABLE }, 252 {"stable", IDS_ABOUT_PAGE_CHANNEL_STABLE},
251 { "beta", IDS_ABOUT_PAGE_CHANNEL_BETA }, 253 {"beta", IDS_ABOUT_PAGE_CHANNEL_BETA},
252 { "dev", IDS_ABOUT_PAGE_CHANNEL_DEVELOPMENT }, 254 {"dev", IDS_ABOUT_PAGE_CHANNEL_DEVELOPMENT},
253 { "channel-changed", IDS_ABOUT_PAGE_CHANNEL_CHANGED }, 255 {"channel-changed", IDS_ABOUT_PAGE_CHANNEL_CHANGED},
254 { "currentChannelStable", IDS_ABOUT_PAGE_CURRENT_CHANNEL_STABLE }, 256 {"currentChannelStable", IDS_ABOUT_PAGE_CURRENT_CHANNEL_STABLE},
255 { "currentChannelBeta", IDS_ABOUT_PAGE_CURRENT_CHANNEL_BETA }, 257 {"currentChannelBeta", IDS_ABOUT_PAGE_CURRENT_CHANNEL_BETA},
256 { "currentChannelDev", IDS_ABOUT_PAGE_CURRENT_CHANNEL_DEV }, 258 {"currentChannelDev", IDS_ABOUT_PAGE_CURRENT_CHANNEL_DEV},
257 { "currentChannel", IDS_ABOUT_PAGE_CURRENT_CHANNEL }, 259 {"currentChannel", IDS_ABOUT_PAGE_CURRENT_CHANNEL},
258 { "channelChangeButton", IDS_ABOUT_PAGE_CHANNEL_CHANGE_BUTTON }, 260 {"channelChangeButton", IDS_ABOUT_PAGE_CHANNEL_CHANGE_BUTTON},
259 { "channelChangeDisallowedMessage", 261 {"channelChangeDisallowedMessage",
260 IDS_ABOUT_PAGE_CHANNEL_CHANGE_DISALLOWED_MESSAGE }, 262 IDS_ABOUT_PAGE_CHANNEL_CHANGE_DISALLOWED_MESSAGE},
261 { "channelChangePageTitle", IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_TITLE }, 263 {"channelChangePageTitle", IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_TITLE},
262 { "channelChangePagePowerwashTitle", 264 {"channelChangePagePowerwashTitle",
263 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_POWERWASH_TITLE }, 265 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_POWERWASH_TITLE},
264 { "channelChangePagePowerwashMessage", 266 {"channelChangePagePowerwashMessage",
265 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_POWERWASH_MESSAGE }, 267 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_POWERWASH_MESSAGE},
266 { "channelChangePageDelayedChangeTitle", 268 {"channelChangePageDelayedChangeTitle",
267 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_DELAYED_CHANGE_TITLE }, 269 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_DELAYED_CHANGE_TITLE},
268 { "channelChangePageUnstableTitle", 270 {"channelChangePageUnstableTitle",
269 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_UNSTABLE_TITLE }, 271 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_UNSTABLE_TITLE},
270 { "channelChangePagePowerwashButton", 272 {"channelChangePagePowerwashButton",
271 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_POWERWASH_BUTTON }, 273 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_POWERWASH_BUTTON},
272 { "channelChangePageChangeButton", 274 {"channelChangePageChangeButton",
273 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_CHANGE_BUTTON }, 275 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_CHANGE_BUTTON},
274 { "channelChangePageCancelButton", 276 {"channelChangePageCancelButton",
275 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_CANCEL_BUTTON }, 277 IDS_ABOUT_PAGE_CHANNEL_CHANGE_PAGE_CANCEL_BUTTON},
276 { "webkit", IDS_WEBKIT }, 278 {"webkit", IDS_WEBKIT},
277 { "userAgent", IDS_ABOUT_VERSION_USER_AGENT }, 279 {"userAgent", IDS_VERSION_UI_USER_AGENT},
278 { "commandLine", IDS_ABOUT_VERSION_COMMAND_LINE }, 280 {"commandLine", IDS_VERSION_UI_COMMAND_LINE},
279 { "buildDate", IDS_ABOUT_VERSION_BUILD_DATE }, 281 {"buildDate", IDS_VERSION_UI_BUILD_DATE},
280 #endif 282 #endif
281 #if defined(OS_MACOSX) 283 #if defined(OS_MACOSX)
282 { "promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER }, 284 {"promote", IDS_ABOUT_CHROME_PROMOTE_UPDATER},
283 { "learnMore", IDS_LEARN_MORE }, 285 {"learnMore", IDS_LEARN_MORE},
284 #endif 286 #endif
285 }; 287 };
286 288
287 for (size_t i = 0; i < arraysize(resources); ++i) { 289 for (size_t i = 0; i < arraysize(resources); ++i) {
288 localized_strings->SetString(resources[i].name, 290 localized_strings->SetString(resources[i].name,
289 l10n_util::GetStringUTF16(resources[i].ids)); 291 l10n_util::GetStringUTF16(resources[i].ids));
290 } 292 }
291 293
292 #if defined(OS_MACOSX) 294 #if defined(OS_MACOSX)
293 localized_strings->SetString( 295 localized_strings->SetString(
(...skipping 10 matching lines...) Expand all
304 BuildBrowserVersionString())); 306 BuildBrowserVersionString()));
305 307
306 base::Time::Exploded exploded_time; 308 base::Time::Exploded exploded_time;
307 base::Time::Now().LocalExplode(&exploded_time); 309 base::Time::Now().LocalExplode(&exploded_time);
308 localized_strings->SetString( 310 localized_strings->SetString(
309 "productCopyright", 311 "productCopyright",
310 l10n_util::GetStringFUTF16(IDS_ABOUT_VERSION_COPYRIGHT, 312 l10n_util::GetStringFUTF16(IDS_ABOUT_VERSION_COPYRIGHT,
311 base::IntToString16(exploded_time.year))); 313 base::IntToString16(exploded_time.year)));
312 314
313 base::string16 license = l10n_util::GetStringFUTF16( 315 base::string16 license = l10n_util::GetStringFUTF16(
314 IDS_ABOUT_VERSION_LICENSE, 316 IDS_VERSION_UI_LICENSE, base::ASCIIToUTF16(chrome::kChromiumProjectURL),
315 base::ASCIIToUTF16(chrome::kChromiumProjectURL),
316 base::ASCIIToUTF16(chrome::kChromeUICreditsURL)); 317 base::ASCIIToUTF16(chrome::kChromeUICreditsURL));
317 localized_strings->SetString("productLicense", license); 318 localized_strings->SetString("productLicense", license);
318 319
319 #if defined(OS_CHROMEOS) 320 #if defined(OS_CHROMEOS)
320 base::string16 os_license = l10n_util::GetStringFUTF16( 321 base::string16 os_license = l10n_util::GetStringFUTF16(
321 IDS_ABOUT_CROS_VERSION_LICENSE, 322 IDS_ABOUT_CROS_VERSION_LICENSE,
322 base::ASCIIToUTF16(chrome::kChromeUIOSCreditsURL)); 323 base::ASCIIToUTF16(chrome::kChromeUIOSCreditsURL));
323 localized_strings->SetString("productOsLicense", os_license); 324 localized_strings->SetString("productOsLicense", os_license);
324 325
325 base::string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME); 326 base::string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 } 685 }
685 686
686 void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) { 687 void HelpHandler::OnRegulatoryLabelTextRead(const std::string& text) {
687 // Remove unnecessary whitespace. 688 // Remove unnecessary whitespace.
688 web_ui()->CallJavascriptFunction( 689 web_ui()->CallJavascriptFunction(
689 "help.HelpPage.setRegulatoryLabelText", 690 "help.HelpPage.setRegulatoryLabelText",
690 base::StringValue(base::CollapseWhitespaceASCII(text, true))); 691 base::StringValue(base::CollapseWhitespaceASCII(text, true)));
691 } 692 }
692 693
693 #endif // defined(OS_CHROMEOS) 694 #endif // defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/flash_ui.cc ('k') | chrome/browser/ui/webui/nacl_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698