diff options
-rw-r--r-- | chrome/app/generated_resources.grd | 12 | ||||
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 55 | ||||
-rw-r--r-- | chrome/browser/resources/about_version.html | 22 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/about_chrome_dialog.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/about_chrome_view.cc | 23 | ||||
-rw-r--r-- | chrome/browser/ui/views/about_chrome_view.h | 2 | ||||
-rw-r--r-- | chrome/common/chrome_version_info.cc | 24 | ||||
-rw-r--r-- | chrome/common/chrome_version_info.h | 3 |
8 files changed, 117 insertions, 30 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 3ef2a05..508e39ef 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4469,12 +4469,24 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_ABOUT_VERSION_UNOFFICIAL" desc="unofficial build on the about:version page"> Developer Build </message> + <message name="IDS_ABOUT_VERSION_OS" desc="label for the OS on the about:version page"> + OS + </message> <message name="IDS_ABOUT_VERSION_USER_AGENT" desc="label for the user agent on the about:version page"> User Agent </message> <message name="IDS_ABOUT_VERSION_COMMAND_LINE" desc="label for the command line on the about:version page"> Command Line </message> + <message name="IDS_ABOUT_VERSION_EXECUTABLE_PATH" desc="label for the executable path on the about:version page"> + Executable Path + </message> + <message name="IDS_ABOUT_VERSION_PROFILE_PATH" desc="label for the profile path on the about:version page"> + Profile Path + </message> + <message name="IDS_ABOUT_VERSION_PATH_NOTFOUND" desc="label for the non-existent path on the about:version page"> + No such file or directory + </message> <!-- Javascript Dialog Box strings --> <message name="IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE" desc="Title for Javascript alert originating from a web page if there is no hostname to display"> diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 7e0ee8d..511575e 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -193,6 +193,7 @@ class AboutSource : public ChromeURLDataManager::DataSource { public: // Creates our datasource. AboutSource(); + explicit AboutSource(Profile* profile); // Called when the network layer has requested a resource underneath // the path we registered. @@ -207,9 +208,13 @@ class AboutSource : public ChromeURLDataManager::DataSource { // Send the response data. void FinishDataRequest(const std::string& html, int request_id); + Profile* profile() { return profile_; } + private: virtual ~AboutSource(); + Profile* profile_; + DISALLOW_COPY_AND_ASSIGN(AboutSource); }; @@ -904,7 +909,7 @@ std::string AboutSandbox() { } #endif -std::string AboutVersion(DictionaryValue* localized_strings) { +std::string AboutVersion(DictionaryValue* localized_strings, Profile* profile) { localized_strings->SetString("title", l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_TITLE)); chrome::VersionInfo version_info; @@ -926,6 +931,10 @@ std::string AboutVersion(DictionaryValue* localized_strings) { base::ThreadRestrictions::ScopedAllowIO allow_io; localized_strings->SetString("version_modifier", platform_util::GetVersionStringModifier()); + localized_strings->SetString("os_name", + l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_OS)); + localized_strings->SetString("os_type", version_info.OSType()); + localized_strings->SetString("webkit_version", webkit_version); localized_strings->SetString("js_engine", js_engine); localized_strings->SetString("js_version", js_version); @@ -974,6 +983,32 @@ std::string AboutVersion(DictionaryValue* localized_strings) { localized_strings->SetString("command_line", command_line); #endif + // Allow IO temporarily based on allow_io (defined above) + // since the following operation will complete quickly + localized_strings->SetString("executable_path_name", + l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_EXECUTABLE_PATH)); + FilePath executable_path = CommandLine::ForCurrentProcess()->GetProgram(); + if (file_util::AbsolutePath(&executable_path)) { + localized_strings->SetString("executable_path", executable_path.value()); + } else { + localized_strings->SetString("executable_path", + l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND)); + } + localized_strings->SetString("profile_path_name", + l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PROFILE_PATH)); + if (profile) { + FilePath profile_path = profile->GetPath(); + if (file_util::AbsolutePath(&profile_path)) { + localized_strings->SetString("profile_path", profile_path.value()); + } else { + localized_strings->SetString("profile_path", + l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND)); + } + } else { + localized_strings->SetString("profile_path", + l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND)); + } + base::StringPiece version_html( ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_ABOUT_VERSION_HTML)); @@ -988,6 +1023,11 @@ AboutSource::AboutSource() : DataSource(chrome::kAboutScheme, MessageLoop::current()) { } +AboutSource::AboutSource(Profile* profile) + : DataSource(chrome::kAboutScheme, MessageLoop::current()), + profile_(profile) { +} + AboutSource::~AboutSource() { } @@ -1028,8 +1068,9 @@ void AboutSource::StartDataRequest(const std::string& path_raw, new ChromeOSAboutVersionHandler(this, request_id); return; #else - DictionaryValue value; - response = AboutVersion(&value); + DictionaryValue localized_strings; + localized_strings.SetString("os_version", ""); + response = AboutVersion(&localized_strings, profile_); #endif } else if (path == kCreditsPath) { response = ResourceBundle::GetSharedInstance().GetRawDataResource( @@ -1219,11 +1260,9 @@ void ChromeOSAboutVersionHandler::OnVersion( chromeos::VersionLoader::Handle handle, std::string version) { DictionaryValue localized_strings; - localized_strings.SetString("os_name", - l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); localized_strings.SetString("os_version", version); - localized_strings.SetBoolean("is_chrome_os", true); - source_->FinishDataRequest(AboutVersion(&localized_strings), request_id_); + source_->FinishDataRequest(AboutVersion(&localized_strings, + source_->profile()), request_id_); // CancelableRequestProvider isn't happy when it's deleted and servicing a // task, so we delay the deletion. @@ -1363,7 +1402,7 @@ bool WillHandleBrowserAboutURL(GURL* url, Profile* profile) { } void InitializeAboutDataSource(Profile* profile) { - profile->GetChromeURLDataManager()->AddDataSource(new AboutSource()); + profile->GetChromeURLDataManager()->AddDataSource(new AboutSource(profile)); } // This function gets called with the fixed-up chrome: URLs, so we have to diff --git a/chrome/browser/resources/about_version.html b/chrome/browser/resources/about_version.html index 9d3e368..0d091a2 100644 --- a/chrome/browser/resources/about_version.html +++ b/chrome/browser/resources/about_version.html @@ -71,17 +71,17 @@ about:version template page <div id="copyright" i18n-content="copyright"></div> </div> <table id="inner" cellpadding="0" cellspacing="0" border="0"> - <tr jsdisplay="is_chrome_os"><td class="label" valign="top" id="os_name" i18n-content="os_name"></td> - <td class="version" id="os_version"><span i18n-content="os_version"></span></td> - </tr> <tr><td class="label" valign="top" id="name" i18n-content="name"></td> <td class="version" id="version"><span i18n-content="version"></span> (<span i18n-content="official"></span> <span i18n-content="cl"></span>) <span i18n-content="version_modifier"></span></td> </tr> + <tr><td class="label" valign="top" i18n-content="os_name"></td> + <td class="version" id="os_type"><span i18n-content="os_type"></span> <span i18n-content="os_version"></span></td> + </tr> <tr><td class="label" valign="top">WebKit</td> - <td class="version" id="webkit_version" i18n-content="webkit_version"></td> + <td class="version" id="webkit_version" i18n-content="webkit_version"></td> </tr> - <tr><td class="label" valign="top" i18n-content="js_engine"></td> - <td class="version" id="js_version" i18n-content="js_version"></td> + <tr><td class="label" valign="top">JavaScript</td> + <td class="version" id="js_engine"><span i18n-content="js_engine"></span> <span i18n-content="js_version"></span></td> </tr> <tr><td class="label" valign="top" i18n-content="flash_plugin"></td> <td class="version" id="flash_version" i18n-content="flash_version"></td> @@ -90,8 +90,14 @@ about:version template page <td class="version" id="useragent" i18n-content="useragent"></td> </tr> <tr><td class="label" valign="top" i18n-content="command_line_name"></td> - <td class="version" id="Td1" i18n-content="command_line"></td> - </tr> + <td class="version" id="command_line" i18n-content="command_line"></td> + </tr> + <tr><td class="label" valign="top" i18n-content="executable_path_name"></td> + <td class="version" id="executable_path" i18n-content="executable_path"></td> + </tr> + <tr><td class="label" valign="top" i18n-content="profile_path_name"></td> + <td class="version" id="profile_path" i18n-content="profile_path"></td> + </tr> </table> </div> </body> diff --git a/chrome/browser/ui/gtk/about_chrome_dialog.cc b/chrome/browser/ui/gtk/about_chrome_dialog.cc index fad892f..55c3fae 100644 --- a/chrome/browser/ui/gtk/about_chrome_dialog.cc +++ b/chrome/browser/ui/gtk/about_chrome_dialog.cc @@ -107,7 +107,13 @@ void ShowAboutDialogForProfile(GtkWindow* parent, Profile* profile) { std::string current_version = version_info.Version(); #if !defined(GOOGLE_CHROME_BUILD) current_version += " ("; + current_version += l10n_util::GetStringUTF8( + version_info.IsOfficialBuild() ? + IDS_ABOUT_VERSION_OFFICIAL : IDS_ABOUT_VERSION_UNOFFICIAL); + current_version += " "; current_version += version_info.LastChange(); + current_version += " "; + current_version += version_info.OSType(); current_version += ")"; #endif std::string channel = platform_util::GetVersionStringModifier(); diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc index ae6dc40..3a4fe82 100644 --- a/chrome/browser/ui/views/about_chrome_view.cc +++ b/chrome/browser/ui/views/about_chrome_view.cc @@ -107,9 +107,7 @@ AboutChromeView::AboutChromeView(Profile* profile) about_dlg_background_logo_(NULL), about_title_label_(NULL), version_label_(NULL), -#if defined(OS_CHROMEOS) os_version_label_(NULL), -#endif copyright_label_(NULL), main_text_label_(NULL), main_text_label_height_(0), @@ -120,11 +118,7 @@ AboutChromeView::AboutChromeView(Profile* profile) chromium_url_appears_first_(true), text_direction_is_rtl_(false) { DCHECK(profile); -#if defined(OS_CHROMEOS) - loader_.GetVersion(&consumer_, - NewCallback(this, &AboutChromeView::OnOSVersion), - chromeos::VersionLoader::VERSION_FULL); -#endif + Init(); #if defined(OS_WIN) || defined(OS_CHROMEOS) @@ -168,6 +162,10 @@ void AboutChromeView::Init() { #if !defined(GOOGLE_CHROME_BUILD) version_details_ += " ("; + version_details_ += l10n_util::GetStringUTF8( + version_info.IsOfficialBuild() ? + IDS_ABOUT_VERSION_OFFICIAL : IDS_ABOUT_VERSION_UNOFFICIAL); + version_details_ += " "; version_details_ += version_info.LastChange(); version_details_ += ")"; #endif @@ -223,8 +221,14 @@ void AboutChromeView::Init() { ResourceBundle::BaseFont)); AddChildView(version_label_); -#if defined(OS_CHROMEOS) os_version_label_ = new views::Textfield(views::Textfield::STYLE_MULTILINE); +#if defined(OS_CHROMEOS) + loader_.GetVersion(&consumer_, + NewCallback(this, &AboutChromeView::OnOSVersion), + chromeos::VersionLoader::VERSION_FULL); +#else + os_version_label_->SetText(UTF8ToUTF16(version_info.OSType())); +#endif os_version_label_->SetReadOnly(true); os_version_label_->RemoveBorder(); os_version_label_->SetTextColor(SK_ColorBLACK); @@ -232,7 +236,6 @@ void AboutChromeView::Init() { os_version_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont( ResourceBundle::BaseFont)); AddChildView(os_version_label_); -#endif // The copyright URL portion of the main label. copyright_label_ = new views::Label( @@ -361,7 +364,6 @@ void AboutChromeView::Layout() { kVersionFieldWidth, sz.height()); -#if defined(OS_CHROMEOS) // Then we have the version number right below it. sz = os_version_label_->GetPreferredSize(); os_version_label_->SetBounds( @@ -371,7 +373,6 @@ void AboutChromeView::Layout() { views::kRelatedControlVerticalSpacing, kVersionFieldWidth, sz.height()); -#endif // For the width of the main text label we want to use up the whole panel // width and remaining height, minus a little margin on each side. diff --git a/chrome/browser/ui/views/about_chrome_view.h b/chrome/browser/ui/views/about_chrome_view.h index 8dca0db..c12e22a 100644 --- a/chrome/browser/ui/views/about_chrome_view.h +++ b/chrome/browser/ui/views/about_chrome_view.h @@ -105,9 +105,7 @@ class AboutChromeView : public views::View, views::ImageView* about_dlg_background_logo_; views::Label* about_title_label_; views::Textfield* version_label_; -#if defined(OS_CHROMEOS) views::Textfield* os_version_label_; -#endif views::Label* copyright_label_; views::Label* main_text_label_; int main_text_label_height_; diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc index ec1012c..c5a7a43 100644 --- a/chrome/common/chrome_version_info.cc +++ b/chrome/common/chrome_version_info.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,8 +7,10 @@ #include "base/basictypes.h" #include "base/file_version_info.h" #include "base/string_util.h" +#include "ui/base/l10n/l10n_util.h" #include "base/threading/thread_restrictions.h" #include "build/build_config.h" +#include "grit/chromium_strings.h" namespace chrome { @@ -87,4 +89,24 @@ bool VersionInfo::IsOfficialBuild() const { #endif +std::string VersionInfo::OSType() const { +#if defined(OS_WIN) + return "Windows"; +#elif defined(OS_MACOSX) + return "Mac OS"; +#elif defined(OS_CHROMEOS) + return UTF16ToASCII(l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)); +#elif defined(OS_LINUX) + return "Linux"; +#elif defined(OS_FREEBSD) + return "FreeBSD"; +#elif defined(OS_OPENBSD) + return "OpenBSD"; +#elif defined(OS_SOLARIS) + return "Solaris"; +#else + return "Unknown"; +#endif +} + } // namespace chrome diff --git a/chrome/common/chrome_version_info.h b/chrome/common/chrome_version_info.h index 2c9cf52..6d509ca 100644 --- a/chrome/common/chrome_version_info.h +++ b/chrome/common/chrome_version_info.h @@ -37,6 +37,9 @@ class VersionInfo { // The SVN revision of this release. E.g. "55800". std::string LastChange() const; + // OS type. E.g. "Windows", "Linux", "FreeBSD", ... + std::string OSType() const; + // Whether this is an "official" release of the current Version(): // whether knowing Version() is enough to completely determine what // LastChange() is. |