| 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 "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 namespace { | 39 namespace { |
| 40 | 40 |
| 41 content::WebUIDataSource* CreateVersionUIDataSource(Profile* profile) { | 41 content::WebUIDataSource* CreateVersionUIDataSource(Profile* profile) { |
| 42 content::WebUIDataSource* html_source = | 42 content::WebUIDataSource* html_source = |
| 43 content::WebUIDataSource::Create(chrome::kChromeUIVersionHost); | 43 content::WebUIDataSource::Create(chrome::kChromeUIVersionHost); |
| 44 | 44 |
| 45 // Localized and data strings. | 45 // Localized and data strings. |
| 46 html_source->AddLocalizedString("title", IDS_ABOUT_VERSION_TITLE); | 46 html_source->AddLocalizedString("title", IDS_ABOUT_VERSION_TITLE); |
| 47 html_source->AddLocalizedString("application_label", IDS_PRODUCT_NAME); |
| 47 chrome::VersionInfo version_info; | 48 chrome::VersionInfo version_info; |
| 48 html_source->AddString("version", version_info.Version()); | 49 html_source->AddString("version", version_info.Version()); |
| 49 html_source->AddString("version_modifier", | 50 html_source->AddString("version_modifier", |
| 50 chrome::VersionInfo::GetVersionStringModifier()); | 51 chrome::VersionInfo::GetVersionStringModifier()); |
| 51 html_source->AddLocalizedString("os_name", IDS_ABOUT_VERSION_OS); | 52 html_source->AddLocalizedString("os_name", IDS_ABOUT_VERSION_OS); |
| 52 html_source->AddLocalizedString("platform", IDS_PLATFORM_LABEL); | 53 html_source->AddLocalizedString("platform", IDS_PLATFORM_LABEL); |
| 53 html_source->AddString("os_type", version_info.OSType()); | 54 html_source->AddString("os_type", version_info.OSType()); |
| 54 html_source->AddString("blink_version", content::GetWebKitVersion()); | 55 html_source->AddString("blink_version", content::GetWebKitVersion()); |
| 55 html_source->AddString("js_engine", "V8"); | 56 html_source->AddString("js_engine", "V8"); |
| 56 html_source->AddString("js_version", v8::V8::GetVersion()); | 57 html_source->AddString("js_version", v8::V8::GetVersion()); |
| 57 | 58 |
| 58 #if defined(OS_ANDROID) | 59 #if defined(OS_ANDROID) |
| 59 html_source->AddLocalizedString("application_label", | |
| 60 IDS_ABOUT_VERSION_APPLICATION); | |
| 61 html_source->AddString("os_version", AndroidAboutAppInfo::GetOsInfo()); | 60 html_source->AddString("os_version", AndroidAboutAppInfo::GetOsInfo()); |
| 62 base::android::BuildInfo* android_build_info = | |
| 63 base::android::BuildInfo::GetInstance(); | |
| 64 html_source->AddString("application_name", | |
| 65 android_build_info->package_label()); | |
| 66 html_source->AddString("application_version_name", | |
| 67 android_build_info->package_version_name()); | |
| 68 html_source->AddString("application_version_code", | |
| 69 android_build_info->package_version_code()); | |
| 70 html_source->AddLocalizedString("build_id_name", | 61 html_source->AddLocalizedString("build_id_name", |
| 71 IDS_ABOUT_VERSION_BUILD_ID); | 62 IDS_ABOUT_VERSION_BUILD_ID); |
| 72 html_source->AddString("build_id", CHROME_BUILD_ID); | 63 html_source->AddString("build_id", CHROME_BUILD_ID); |
| 73 #else | 64 #else |
| 74 html_source->AddLocalizedString("application_label", IDS_PRODUCT_NAME); | |
| 75 html_source->AddString("os_version", std::string()); | 65 html_source->AddString("os_version", std::string()); |
| 76 html_source->AddString("flash_plugin", "Flash"); | 66 html_source->AddString("flash_plugin", "Flash"); |
| 77 // Note that the Flash version is retrieve asynchronously and returned in | 67 // Note that the Flash version is retrieve asynchronously and returned in |
| 78 // VersionHandler::OnGotPlugins. The area is initially blank. | 68 // VersionHandler::OnGotPlugins. The area is initially blank. |
| 79 html_source->AddString("flash_version", std::string()); | 69 html_source->AddString("flash_version", std::string()); |
| 80 #endif // defined(OS_ANDROID) | 70 #endif // defined(OS_ANDROID) |
| 81 | 71 |
| 82 html_source->AddLocalizedString("company", IDS_ABOUT_VERSION_COMPANY_NAME); | 72 html_source->AddLocalizedString("company", IDS_ABOUT_VERSION_COMPANY_NAME); |
| 83 base::Time::Exploded exploded_time; | 73 base::Time::Exploded exploded_time; |
| 84 base::Time::Now().LocalExplode(&exploded_time); | 74 base::Time::Now().LocalExplode(&exploded_time); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Set up the chrome://theme/ source. | 139 // Set up the chrome://theme/ source. |
| 150 ThemeSource* theme = new ThemeSource(profile); | 140 ThemeSource* theme = new ThemeSource(profile); |
| 151 content::URLDataSource::Add(profile, theme); | 141 content::URLDataSource::Add(profile, theme); |
| 152 #endif | 142 #endif |
| 153 | 143 |
| 154 content::WebUIDataSource::Add(profile, CreateVersionUIDataSource(profile)); | 144 content::WebUIDataSource::Add(profile, CreateVersionUIDataSource(profile)); |
| 155 } | 145 } |
| 156 | 146 |
| 157 VersionUI::~VersionUI() { | 147 VersionUI::~VersionUI() { |
| 158 } | 148 } |
| OLD | NEW |