Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(491)

Unified Diff: chrome/browser/browser_about_handler.cc

Issue 6894037: Add more information to about:version and "About Chromium" dialog (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Delete "webkit_name" and "js_name" and misc Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browser_about_handler.cc
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 12f008c218b2508db538ee3f4a92c9c12e3df0ee..d9035fc58a8194dc69b96a4fced2ea2ab8e815f1 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* GetProfile() { return profile_; }
+
private:
virtual ~AboutSource();
+ Profile* profile_;
+
DISALLOW_COPY_AND_ASSIGN(AboutSource);
};
@@ -906,7 +911,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;
@@ -928,6 +933,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);
@@ -976,6 +985,50 @@ std::string AboutVersion(DictionaryValue* localized_strings) {
localized_strings->SetString("command_line", command_line);
#endif
+ localized_strings->SetString("executable_path_name",
+ l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_EXECUTABLE_PATH));
+ FilePath executable_path = CommandLine::ForCurrentProcess()->GetProgram();
+#if defined(OS_WIN)
+ wchar_t path_buf[MAX_PATH];
+ if (!_wfullpath(path_buf, executable_path.value().c_str(), MAX_PATH)) {
Evan Martin 2011/04/27 18:00:23 See base/file_util.h , AbsolutePath()
+ localized_strings->SetString("executable_path", path_buf);
+ } else {
+ localized_strings->SetString("executable_path", "No such file");
+ }
+#elif defined(OS_POSIX)
+ char path_buf[PATH_MAX];
+ if (realpath(executable_path.value().c_str(), path_buf) == NULL) {
+ localized_strings->SetString("executable_path", path_buf);
+ } else {
+ localized_strings->SetString("executable_path", "No such file");
+ }
+#else
+ localized_strings->SetString("executable_path", "No such file");
+#endif
+
+ localized_strings->SetString("profile_path_name",
+ l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PROFILE_PATH));
+ if (profile) {
+ FilePath profile_path = profile->GetPath();
+#if defined(OS_WIN)
+ if (!_wfullpath(path_buf, profile_path.value().c_str(), MAX_PATH)) {
+ localized_strings->SetString("profile_path", path_buf);
+ } else {
+ localized_strings->SetString("profile_path", "No such file");
+ }
+#elif defined(OS_POSIX)
+ if (realpath(profile_path.value().c_str(), path_buf) == NULL) {
+ localized_strings->SetString("profile_path", path_buf);
+ } else {
+ localized_strings->SetString("profile_path", "No such file");
+ }
+#else
+ localized_strings->SetString("profile_path", "No such file");
+#endif
+ } else {
+ localized_strings->SetString("profile_path", "No such file");
+ }
+
base::StringPiece version_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_ABOUT_VERSION_HTML));
@@ -996,6 +1049,11 @@ AboutSource::AboutSource()
: DataSource(chrome::kAboutScheme, MessageLoop::current()) {
}
+AboutSource::AboutSource(Profile* profile)
+ : DataSource(chrome::kAboutScheme, MessageLoop::current()),
+ profile_(profile) {
+}
+
AboutSource::~AboutSource() {
}
@@ -1036,8 +1094,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(
@@ -1227,11 +1286,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_->GetProfile()), request_id_);
// CancelableRequestProvider isn't happy when it's deleted and servicing a
// task, so we delay the deletion.
@@ -1377,7 +1434,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

Powered by Google App Engine
This is Rietveld 408576698