| OLD | NEW |
| 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/version_ui.h" | 5 #include "chrome/browser/ui/webui/version_ui.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/webui/version_handler.h" | 10 #include "chrome/browser/ui/webui/version_handler.h" |
| 11 #include "chrome/common/channel_info.h" |
| 11 #include "chrome/common/chrome_content_client.h" | 12 #include "chrome/common/chrome_content_client.h" |
| 12 #include "chrome/common/chrome_version_info.h" | |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/grit/chromium_strings.h" | 14 #include "chrome/grit/chromium_strings.h" |
| 15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 16 #include "components/version_info/version_info.h" |
| 16 #include "content/public/browser/url_data_source.h" | 17 #include "content/public/browser/url_data_source.h" |
| 17 #include "content/public/browser/web_ui.h" | 18 #include "content/public/browser/web_ui.h" |
| 18 #include "content/public/browser/web_ui_data_source.h" | 19 #include "content/public/browser/web_ui_data_source.h" |
| 19 #include "content/public/common/user_agent.h" | 20 #include "content/public/common/user_agent.h" |
| 20 #include "grit/browser_resources.h" | 21 #include "grit/browser_resources.h" |
| 21 #include "grit/components_strings.h" | 22 #include "grit/components_strings.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "v8/include/v8.h" | 24 #include "v8/include/v8.h" |
| 24 | 25 |
| 25 #if defined(ENABLE_THEMES) | 26 #if defined(ENABLE_THEMES) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| 42 WebUIDataSource* CreateVersionUIDataSource() { | 43 WebUIDataSource* CreateVersionUIDataSource() { |
| 43 WebUIDataSource* html_source = | 44 WebUIDataSource* html_source = |
| 44 WebUIDataSource::Create(chrome::kChromeUIVersionHost); | 45 WebUIDataSource::Create(chrome::kChromeUIVersionHost); |
| 45 | 46 |
| 46 // Localized and data strings. | 47 // Localized and data strings. |
| 47 html_source->AddLocalizedString("title", IDS_ABOUT_VERSION_TITLE); | 48 html_source->AddLocalizedString("title", IDS_ABOUT_VERSION_TITLE); |
| 48 html_source->AddLocalizedString("application_label", IDS_PRODUCT_NAME); | 49 html_source->AddLocalizedString("application_label", IDS_PRODUCT_NAME); |
| 49 chrome::VersionInfo version_info; | 50 html_source->AddString("version", version_info::GetVersionNumber()); |
| 50 html_source->AddString("version", version_info.Version()); | 51 html_source->AddString("version_modifier", chrome::GetChannelString()); |
| 51 html_source->AddString("version_modifier", | |
| 52 chrome::VersionInfo::GetVersionStringModifier()); | |
| 53 html_source->AddLocalizedString("os_name", IDS_ABOUT_VERSION_OS); | 52 html_source->AddLocalizedString("os_name", IDS_ABOUT_VERSION_OS); |
| 54 html_source->AddLocalizedString("platform", IDS_PLATFORM_LABEL); | 53 html_source->AddLocalizedString("platform", IDS_PLATFORM_LABEL); |
| 55 html_source->AddString("os_type", version_info.OSType()); | 54 html_source->AddString("os_type", version_info::GetOSType()); |
| 56 html_source->AddString("blink_version", content::GetWebKitVersion()); | 55 html_source->AddString("blink_version", content::GetWebKitVersion()); |
| 57 html_source->AddString("js_engine", "V8"); | 56 html_source->AddString("js_engine", "V8"); |
| 58 html_source->AddString("js_version", v8::V8::GetVersion()); | 57 html_source->AddString("js_version", v8::V8::GetVersion()); |
| 59 | 58 |
| 60 #if defined(OS_ANDROID) | 59 #if defined(OS_ANDROID) |
| 61 html_source->AddString("os_version", AndroidAboutAppInfo::GetOsInfo()); | 60 html_source->AddString("os_version", AndroidAboutAppInfo::GetOsInfo()); |
| 62 html_source->AddLocalizedString("build_id_name", | 61 html_source->AddLocalizedString("build_id_name", |
| 63 IDS_ABOUT_VERSION_BUILD_ID); | 62 IDS_ABOUT_VERSION_BUILD_ID); |
| 64 html_source->AddString("build_id", CHROME_BUILD_ID); | 63 html_source->AddString("build_id", CHROME_BUILD_ID); |
| 65 #else | 64 #else |
| 66 html_source->AddString("os_version", std::string()); | 65 html_source->AddString("os_version", std::string()); |
| 67 html_source->AddString("flash_plugin", "Flash"); | 66 html_source->AddString("flash_plugin", "Flash"); |
| 68 // Note that the Flash version is retrieve asynchronously and returned in | 67 // Note that the Flash version is retrieve asynchronously and returned in |
| 69 // VersionHandler::OnGotPlugins. The area is initially blank. | 68 // VersionHandler::OnGotPlugins. The area is initially blank. |
| 70 html_source->AddString("flash_version", std::string()); | 69 html_source->AddString("flash_version", std::string()); |
| 71 #endif // defined(OS_ANDROID) | 70 #endif // defined(OS_ANDROID) |
| 72 | 71 |
| 73 html_source->AddLocalizedString("company", IDS_ABOUT_VERSION_COMPANY_NAME); | 72 html_source->AddLocalizedString("company", IDS_ABOUT_VERSION_COMPANY_NAME); |
| 74 base::Time::Exploded exploded_time; | 73 base::Time::Exploded exploded_time; |
| 75 base::Time::Now().LocalExplode(&exploded_time); | 74 base::Time::Now().LocalExplode(&exploded_time); |
| 76 html_source->AddString( | 75 html_source->AddString( |
| 77 "copyright", | 76 "copyright", |
| 78 l10n_util::GetStringFUTF16(IDS_ABOUT_VERSION_COPYRIGHT, | 77 l10n_util::GetStringFUTF16(IDS_ABOUT_VERSION_COPYRIGHT, |
| 79 base::IntToString16(exploded_time.year))); | 78 base::IntToString16(exploded_time.year))); |
| 80 html_source->AddLocalizedString("revision", IDS_ABOUT_VERSION_REVISION); | 79 html_source->AddLocalizedString("revision", IDS_ABOUT_VERSION_REVISION); |
| 81 html_source->AddString("cl", version_info.LastChange()); | 80 html_source->AddString("cl", version_info::GetLastChange()); |
| 82 html_source->AddLocalizedString("official", | 81 html_source->AddLocalizedString("official", |
| 83 version_info.IsOfficialBuild() ? IDS_ABOUT_VERSION_OFFICIAL : | 82 version_info::IsOfficialBuild() |
| 84 IDS_ABOUT_VERSION_UNOFFICIAL); | 83 ? IDS_ABOUT_VERSION_OFFICIAL |
| 84 : IDS_ABOUT_VERSION_UNOFFICIAL); |
| 85 #if defined(ARCH_CPU_64_BITS) | 85 #if defined(ARCH_CPU_64_BITS) |
| 86 html_source->AddLocalizedString("version_bitsize", IDS_ABOUT_VERSION_64BIT); | 86 html_source->AddLocalizedString("version_bitsize", IDS_ABOUT_VERSION_64BIT); |
| 87 #else | 87 #else |
| 88 html_source->AddLocalizedString("version_bitsize", IDS_ABOUT_VERSION_32BIT); | 88 html_source->AddLocalizedString("version_bitsize", IDS_ABOUT_VERSION_32BIT); |
| 89 #endif | 89 #endif |
| 90 html_source->AddLocalizedString("user_agent_name", | 90 html_source->AddLocalizedString("user_agent_name", |
| 91 IDS_ABOUT_VERSION_USER_AGENT); | 91 IDS_ABOUT_VERSION_USER_AGENT); |
| 92 html_source->AddString("useragent", GetUserAgent()); | 92 html_source->AddString("useragent", GetUserAgent()); |
| 93 html_source->AddLocalizedString("command_line_name", | 93 html_source->AddLocalizedString("command_line_name", |
| 94 IDS_ABOUT_VERSION_COMMAND_LINE); | 94 IDS_ABOUT_VERSION_COMMAND_LINE); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // Set up the chrome://theme/ source. | 145 // Set up the chrome://theme/ source. |
| 146 ThemeSource* theme = new ThemeSource(profile); | 146 ThemeSource* theme = new ThemeSource(profile); |
| 147 content::URLDataSource::Add(profile, theme); | 147 content::URLDataSource::Add(profile, theme); |
| 148 #endif | 148 #endif |
| 149 | 149 |
| 150 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); | 150 WebUIDataSource::Add(profile, CreateVersionUIDataSource()); |
| 151 } | 151 } |
| 152 | 152 |
| 153 VersionUI::~VersionUI() { | 153 VersionUI::~VersionUI() { |
| 154 } | 154 } |
| OLD | NEW |