diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-07 19:17:35 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-07 19:17:35 +0000 |
commit | 82efd8e5f5e2f489119f920f3e974caa745dc553 (patch) | |
tree | 6a1534891b39dbf8999fa63d8b66b532040cae02 | |
parent | b0332ca417b9890ec9fb1c415613dee4029ec205 (diff) | |
download | chromium_src-82efd8e5f5e2f489119f920f3e974caa745dc553.zip chromium_src-82efd8e5f5e2f489119f920f3e974caa745dc553.tar.gz chromium_src-82efd8e5f5e2f489119f920f3e974caa745dc553.tar.bz2 |
Checking in http://codereview.chromium.org/2605005 on behalf of tbarzic@chromium.org:
Implemented functionality for viewing chromeOS system status
BUG=chromium-os:3807
TEST=type in about:system in the browser and system status page should appear
Review URL: http://codereview.chromium.org/2698003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49082 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 41 | ||||
-rw-r--r-- | chrome/browser/browser_resources.grd | 3 | ||||
-rw-r--r-- | chrome/browser/resources/about_sys.html | 147 |
3 files changed, 189 insertions, 2 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 69af0d9..6432c2f 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -53,6 +53,11 @@ #include "v8/include/v8.h" #endif +#if defined(OS_CHROMEOS) +#include "chrome/browser/chromeos/cros/syslogs_library.h" +#include "chrome/browser/chromeos/cros/cros_library.h" +#endif + #if defined(OS_WIN) #include "chrome/browser/views/about_ipc_dialog.h" #include "chrome/browser/views/about_network_dialog.h" @@ -102,6 +107,7 @@ const char kLinuxProxyConfigPath[] = "linux-proxy-config"; #if defined(OS_CHROMEOS) const char kNetworkPath[] = "network"; const char kOSCreditsPath[] = "os-credits"; +const char kSysPath[] = "system"; #endif // Points to the singleton AboutSource object, if any. @@ -194,7 +200,7 @@ class ChromeOSAboutVersionHandler { chromeos::VersionLoader loader_; // Used to request the version. - CancelableRequestConsumer consumer_; + CancelableRequestConsumer consumer_; DISALLOW_COPY_AND_ASSIGN(ChromeOSAboutVersionHandler); }; @@ -646,6 +652,35 @@ std::string AboutSync() { sync_html, &strings , "t" /* template root node id */); } +#if defined(OS_CHROMEOS) +std::string AboutSys() { + DictionaryValue strings; + chromeos::SyslogsLibrary* syslogs_lib = + chromeos::CrosLibrary::Get()->GetSyslogsLibrary(); + scoped_ptr<chromeos::LogDictionaryType> sys_info_; + if (syslogs_lib) + sys_info_.reset(syslogs_lib->GetSyslogs(new FilePath())); + if (sys_info_.get()) { + ListValue* details = new ListValue(); + strings.Set(L"details", details); + chromeos::LogDictionaryType::iterator it; + + for (it = sys_info_.get()->begin(); it != sys_info_.get()->end(); ++it) { + DictionaryValue* val = new DictionaryValue; + val->SetString(L"stat_name", (*it).first); + val->SetString(L"stat_value", (*it).second); + details->Append(val); + } + } + static const base::StringPiece sys_html( + ResourceBundle::GetSharedInstance().GetRawDataResource( + IDR_ABOUT_SYS_HTML)); + + return jstemplate_builder::GetTemplateHtml( + sys_html, &strings , "t" /* template root node id */); +} +#endif + // AboutSource ----------------------------------------------------------------- AboutSource::AboutSource() @@ -723,6 +758,10 @@ void AboutSource::StartDataRequest(const std::string& path_raw, #endif } else if (path == kSyncPath) { response = AboutSync(); +#if defined(OS_CHROMEOS) + } else if (path == kSysPath) { + response = AboutSys(); +#endif } FinishDataRequest(response, request_id); diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd index 73cbe61..6af5e69 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd @@ -41,7 +41,8 @@ without changes to the corresponding grd file. taarraa --> <include name="IDR_FILEBROWSE_HTML" file="resources\filebrowse.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_OS_CREDITS_HTML" file="resources\about_os_credits.html" flattenhtml="true" type="BINDATA" /> <include name="IDR_MEDIAPLAYER_HTML" file="resources\mediaplayer.html" flattenhtml="true" type="BINDATA" /> - <include name="IDR_MEDIAPLAYERPLAYLIST_HTML" file="resources\playlist.html" flattenhtml="true" type="BINDATA" /> + <include name="IDR_MEDIAPLAYERPLAYLIST_HTML" file="resources\playlist.html" flattenhtml="true" type="BINDATA" /> + <include name="IDR_ABOUT_SYS_HTML" file="resources\about_sys.html" flattenhtml="true" type="BINDATA" /> </if> <include name="IDR_APP_GALLERY_ICON" file="resources\app_gallery_icon.png" type="BINDATA" /> <include name="IDR_BOOKMARKS_MANIFEST" file="resources\bookmark_manager\manifest.json" type="BINDATA" /> diff --git a/chrome/browser/resources/about_sys.html b/chrome/browser/resources/about_sys.html new file mode 100644 index 0000000..4c88c54 --- /dev/null +++ b/chrome/browser/resources/about_sys.html @@ -0,0 +1,147 @@ +<!DOCTYPE HTML> +<html id="t"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> +<title>About System</title> + +<style> +body { + font-size: 84%; + font-family: Arial, Helvetica, sans-serif; + padding: 0.75em; + margin: 0; + min-width: 45em; +} + +h1,h2 { + font-size: 110%; + letter-spacing: -1px; + margin: 0; +} +h1 { + font-weight: bold; + color: #4a8ee6; + padding: 0; +} + +h2 { + font-weight: normal; + padding: 0.5em 1em; + color: #3a75bd; + margin-left: -38px; + padding-left: 38px; + border-top: 1px solid #3a75bd; + padding-top: 0.5em; + +} +h2:first-child { + border-top: 0; + padding-top: 0; +} + +#header { + padding: 0.6em 1em 0.75em 0; + margin-bottom: 0.75em; + position: relative; + overflow: hidden; + background: #5296de; + background-size: 100%; + border: 1px solid #3a75bd; + border-radius: 6px; + color: white; + text-shadow: 0 0 2px black; +} +div#header h1 { + padding-left: 3em; + margin: 0; + display: inline; + background: url('gear.png') 12px 60% no-repeat; + color: white; +} +div#header p { + font-size: 84%; + font-style: italic; + padding: 0; + margin: 0; + color: white; + padding-left: 0.4em; + display: inline; +} + +table.list { + line-height: 200%; + border-collapse: collapse; + font-size: 84%; + table-layout: fixed; + width: 100%; +} +table.list:not([class*='filtered']) tr:nth-child(odd) td { + background: #eff3ff; +} + +table.list td { + padding: 0 0.5em; + vertical-align: top; + line-height: 1.4em; + padding-top: 0.35em; + font-family: 'Courier New', monospace; + white-space: pre; +} +table.list tr td:nth-last-child(1), +table.list tr th:nth-last-child(1) { + padding-right: 1em; +} +table.list:not([class*='filtered']) .tab .name { + padding-left: 1.5em; +} + +table.list .name { + width: 20%; +} + +table.list .name div { + height: 1.6em; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +table.list .number { + text-align: left; + width: 80%; +} + +table.list#details tr:not([class*='firstRow']) > *:nth-child(1), +table.list#details tr:not([class*='firstRow']) > *:nth-child(4), +table.list#details tr.firstRow th:nth-child(1), +table.list#details tr.firstRow th:nth-child(2) { + border-right: 1px solid #b5c6de; +} +table.list#details .name { + padding-left: 25px; + background-position: 5em center; + background-repeat: no-repeat; +} +</style> + +</head> +<body> + <div id="header"> + <h1>About System</h1> + <p>System diagnostic data</p> + </div> + <div id="content"> + <h2>Details</h2> + <table class="list" id="details"> + <tr jsselect="details"> + <td class="name"> + <div jscontent="stat_name"></div> + </td> + <td class="number"> + <div jscontent="stat_value"></div> + </td> + </tr> + </table> + </div> +</body> +</html> |