Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser_about_handler.h" | 5 #include "chrome/browser/browser_about_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 l10n_util::GetString(IDS_ABOUT_PLUGINS_DESCRIPTION_LABEL)); | 350 l10n_util::GetString(IDS_ABOUT_PLUGINS_DESCRIPTION_LABEL)); |
| 351 localized_strings.SetString(L"suffixes", | 351 localized_strings.SetString(L"suffixes", |
| 352 l10n_util::GetString(IDS_ABOUT_PLUGINS_SUFFIX_LABEL)); | 352 l10n_util::GetString(IDS_ABOUT_PLUGINS_SUFFIX_LABEL)); |
| 353 localized_strings.SetString(L"enabled", | 353 localized_strings.SetString(L"enabled", |
| 354 l10n_util::GetString(IDS_ABOUT_PLUGINS_ENABLED_LABEL)); | 354 l10n_util::GetString(IDS_ABOUT_PLUGINS_ENABLED_LABEL)); |
| 355 localized_strings.SetString(L"enabled_yes", | 355 localized_strings.SetString(L"enabled_yes", |
| 356 l10n_util::GetString(IDS_ABOUT_PLUGINS_ENABLED_YES)); | 356 l10n_util::GetString(IDS_ABOUT_PLUGINS_ENABLED_YES)); |
| 357 localized_strings.SetString(L"enabled_no", | 357 localized_strings.SetString(L"enabled_no", |
| 358 l10n_util::GetString(IDS_ABOUT_PLUGINS_ENABLED_NO)); | 358 l10n_util::GetString(IDS_ABOUT_PLUGINS_ENABLED_NO)); |
| 359 | 359 |
| 360 ChromeURLDataManager::DataSource::SetFontAndTextDirection(&localized_strings); | |
| 361 | |
| 360 static const base::StringPiece plugins_html( | 362 static const base::StringPiece plugins_html( |
| 361 ResourceBundle::GetSharedInstance().GetRawDataResource( | 363 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 362 IDR_ABOUT_PLUGINS_HTML)); | 364 IDR_ABOUT_PLUGINS_HTML)); |
| 363 | 365 |
| 364 return jstemplate_builder::GetTemplateHtml( | 366 return jstemplate_builder::GetTemplatesHtml( |
| 365 plugins_html, &localized_strings, "t" /* template root node id */); | 367 plugins_html, &localized_strings, "t" /* template root node id */); |
| 366 } | 368 } |
| 367 | 369 |
| 368 std::string AboutStats() { | 370 std::string AboutStats() { |
| 369 // We keep the DictionaryValue tree live so that we can do delta | 371 // We keep the DictionaryValue tree live so that we can do delta |
| 370 // stats computations across runs. | 372 // stats computations across runs. |
| 371 static DictionaryValue root; | 373 static DictionaryValue root; |
| 372 | 374 |
| 373 StatsTable* table = StatsTable::current(); | 375 StatsTable* table = StatsTable::current(); |
| 374 if (!table) | 376 if (!table) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 std::string AboutVersion(DictionaryValue* localized_strings) { | 491 std::string AboutVersion(DictionaryValue* localized_strings) { |
| 490 localized_strings->SetString(L"title", | 492 localized_strings->SetString(L"title", |
| 491 l10n_util::GetString(IDS_ABOUT_VERSION_TITLE)); | 493 l10n_util::GetString(IDS_ABOUT_VERSION_TITLE)); |
| 492 scoped_ptr<FileVersionInfo> version_info( | 494 scoped_ptr<FileVersionInfo> version_info( |
| 493 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); | 495 FileVersionInfo::CreateFileVersionInfoForCurrentModule()); |
| 494 if (version_info == NULL) { | 496 if (version_info == NULL) { |
| 495 DLOG(ERROR) << "Unable to create FileVersionInfo object"; | 497 DLOG(ERROR) << "Unable to create FileVersionInfo object"; |
| 496 return std::string(); | 498 return std::string(); |
| 497 } | 499 } |
| 498 | 500 |
| 499 std::wstring webkit_version = UTF8ToWide(webkit_glue::GetWebKitVersion()); | 501 std::string webkit_version = webkit_glue::GetWebKitVersion(); |
| 500 #ifdef CHROME_V8 | 502 #ifdef CHROME_V8 |
| 501 const char* v8_vers = v8::V8::GetVersion(); | 503 std::string js_version(v8::V8::GetVersion()); |
| 502 std::wstring js_version = UTF8ToWide(v8_vers); | 504 std::string js_engine = "V8"; |
| 503 std::wstring js_engine = L"V8"; | |
| 504 #else | 505 #else |
| 505 std::wstring js_version = webkit_version; | 506 std::string js_version = webkit_version; |
| 506 std::wstring js_engine = L"JavaScriptCore"; | 507 std::string js_engine = "JavaScriptCore"; |
| 507 #endif | 508 #endif |
| 508 | 509 |
| 509 localized_strings->SetString(L"name", | 510 localized_strings->SetString(L"name", |
| 510 l10n_util::GetString(IDS_PRODUCT_NAME)); | 511 l10n_util::GetString(IDS_PRODUCT_NAME)); |
| 511 localized_strings->SetString(L"version", version_info->file_version()); | 512 localized_strings->SetString(L"version", version_info->file_version()); |
| 512 std::wstring mod = UTF16ToWide(platform_util::GetVersionStringModifier()); | 513 std::wstring mod = UTF16ToWide(platform_util::GetVersionStringModifier()); |
| 513 localized_strings->SetString(L"version_modifier", mod); | 514 localized_strings->SetString(L"version_modifier", mod); |
| 514 localized_strings->SetString(L"js_engine", js_engine); | 515 localized_strings->SetString(L"js_engine", js_engine); |
| 515 localized_strings->SetString(L"js_version", js_version); | 516 localized_strings->SetString(L"js_version", js_version); |
| 516 localized_strings->SetString(L"webkit_version", webkit_version); | 517 localized_strings->SetString(L"webkit_version", webkit_version); |
| 517 localized_strings->SetString(L"company", | 518 localized_strings->SetString(L"company", |
| 518 l10n_util::GetString(IDS_ABOUT_VERSION_COMPANY_NAME)); | 519 l10n_util::GetString(IDS_ABOUT_VERSION_COMPANY_NAME)); |
| 519 localized_strings->SetString(L"copyright", | 520 localized_strings->SetString(L"copyright", |
| 520 l10n_util::GetString(IDS_ABOUT_VERSION_COPYRIGHT)); | 521 l10n_util::GetString(IDS_ABOUT_VERSION_COPYRIGHT)); |
| 521 localized_strings->SetString(L"cl", version_info->last_change()); | 522 localized_strings->SetString(L"cl", version_info->last_change()); |
| 522 if (version_info->is_official_build()) { | 523 if (version_info->is_official_build()) { |
| 523 localized_strings->SetString(L"official", | 524 localized_strings->SetString(L"official", |
| 524 l10n_util::GetString(IDS_ABOUT_VERSION_OFFICIAL)); | 525 l10n_util::GetString(IDS_ABOUT_VERSION_OFFICIAL)); |
| 525 } else { | 526 } else { |
| 526 localized_strings->SetString(L"official", | 527 localized_strings->SetString(L"official", |
| 527 l10n_util::GetString(IDS_ABOUT_VERSION_UNOFFICIAL)); | 528 l10n_util::GetString(IDS_ABOUT_VERSION_UNOFFICIAL)); |
| 528 } | 529 } |
| 529 localized_strings->SetString(L"useragent", | 530 localized_strings->SetString(L"useragent", webkit_glue::GetUserAgent(GURL())); |
| 530 UTF8ToWide(webkit_glue::GetUserAgent(GURL()))); | |
| 531 | 531 |
| 532 static const std::string version_html( | 532 static const std::string version_html( |
| 533 ResourceBundle::GetSharedInstance().GetDataResource( | 533 ResourceBundle::GetSharedInstance().GetDataResource( |
| 534 IDR_ABOUT_VERSION_HTML)); | 534 IDR_ABOUT_VERSION_HTML)); |
| 535 | 535 |
| 536 std::string output = version_html; | 536 return jstemplate_builder::GetTemplatesHtml( |
|
arv (Not doing code reviews)
2010/01/08 00:25:48
Actually, I would prefer if we kept it the old way
| |
| 537 jstemplate_builder::AppendJsonHtml(localized_strings, &output); | 537 version_html, localized_strings, "t" /* template root node id */); |
| 538 jstemplate_builder::AppendI18nTemplateSourceHtml(&output); | |
| 539 jstemplate_builder::AppendI18nTemplateProcessHtml(&output); | |
| 540 jstemplate_builder::AppendJsTemplateSourceHtml(&output); | |
| 541 jstemplate_builder::AppendJsTemplateProcessHtml("t", &output); | |
| 542 return output; | |
| 543 } | 538 } |
| 544 | 539 |
| 545 static void AddBoolSyncDetail(ListValue* details, const std::wstring& stat_name, | 540 static void AddBoolSyncDetail(ListValue* details, const std::wstring& stat_name, |
| 546 bool stat_value) { | 541 bool stat_value) { |
| 547 DictionaryValue* val = new DictionaryValue; | 542 DictionaryValue* val = new DictionaryValue; |
| 548 val->SetString(L"stat_name", stat_name); | 543 val->SetString(L"stat_name", stat_name); |
| 549 val->SetBoolean(L"stat_value", stat_value); | 544 val->SetBoolean(L"stat_value", stat_value); |
| 550 details->Append(val); | 545 details->Append(val); |
| 551 } | 546 } |
| 552 | 547 |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 974 // Run the dialog. This will re-use the existing one if it's already up. | 969 // Run the dialog. This will re-use the existing one if it's already up. |
| 975 AboutIPCDialog::RunDialog(); | 970 AboutIPCDialog::RunDialog(); |
| 976 return true; | 971 return true; |
| 977 } | 972 } |
| 978 #endif | 973 #endif |
| 979 | 974 |
| 980 #endif // OFFICIAL_BUILD | 975 #endif // OFFICIAL_BUILD |
| 981 | 976 |
| 982 return false; | 977 return false; |
| 983 } | 978 } |
| OLD | NEW |