summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 18:38:13 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-10 18:38:13 +0000
commit710fc6dda42e51bf1aa4f6c9b2c80359ef17ebcd (patch)
tree4e98d009d0295ce723d85db1de568bf030a4c8a8 /chrome/browser
parentc3482dc4641b4b918aa884dcbd8abae7842bce28 (diff)
downloadchromium_src-710fc6dda42e51bf1aa4f6c9b2c80359ef17ebcd.zip
chromium_src-710fc6dda42e51bf1aa4f6c9b2c80359ef17ebcd.tar.gz
chromium_src-710fc6dda42e51bf1aa4f6c9b2c80359ef17ebcd.tar.bz2
Add more information to about:version and "About Chromium" dialog
- Add the information of an executable full-path, a profile path and an OS to about:version - Add the information of a build type and an OS to "About Chromium" dialog (Retry of r84808 with ChromeOS fixed.) BUG=18679,37186 TEST=Observe that about:version and "About Chromium" dialog display enough information Patch by Kentaro Hara <haraken@google.com>. Review URL: http://codereview.chromium.org/6894037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/browser_about_handler.cc55
-rw-r--r--chrome/browser/resources/about_version.html22
-rw-r--r--chrome/browser/ui/gtk/about_chrome_dialog.cc6
-rw-r--r--chrome/browser/ui/views/about_chrome_view.cc23
-rw-r--r--chrome/browser/ui/views/about_chrome_view.h2
5 files changed, 79 insertions, 29 deletions
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_;