diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-10 18:38:13 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-10 18:38:13 +0000 |
commit | 710fc6dda42e51bf1aa4f6c9b2c80359ef17ebcd (patch) | |
tree | 4e98d009d0295ce723d85db1de568bf030a4c8a8 /chrome/browser/browser_about_handler.cc | |
parent | c3482dc4641b4b918aa884dcbd8abae7842bce28 (diff) | |
download | chromium_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/browser_about_handler.cc')
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 55 |
1 files changed, 47 insertions, 8 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 |