diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 17:14:57 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-21 17:14:57 +0000 |
commit | d3b04abc5ce706d8950c2f6beb2aa438f1edcd5a (patch) | |
tree | 9dd143da4fcabc7f407a247c69cba11960ed930b | |
parent | e7c674264be7bbbffae48e29333f40c0b46cb874 (diff) | |
download | chromium_src-d3b04abc5ce706d8950c2f6beb2aa438f1edcd5a.zip chromium_src-d3b04abc5ce706d8950c2f6beb2aa438f1edcd5a.tar.gz chromium_src-d3b04abc5ce706d8950c2f6beb2aa438f1edcd5a.tar.bz2 |
Fixed a TODO in data export of net-internals, added Chrome version and command line.
BUG=none
TEST=Go to about:net-internals click on dump to text, check if version and command line are good.
Patch contributed by malavv
Review URL: http://codereview.chromium.org/2104012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47926 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/command_line.cc | 5 | ||||
-rw-r--r-- | base/command_line.h | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/net_internals_ui.cc | 40 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/dataview.js | 9 | ||||
-rw-r--r-- | chrome/browser/resources/net_internals/main.js | 6 |
5 files changed, 60 insertions, 3 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index bc4e1a0..2c6ef0b 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -303,6 +303,11 @@ std::wstring CommandLine::program() const { } #endif +#if defined(OS_POSIX) +std::string CommandLine::command_line_string() const { + return JoinString(argv_, ' '); +} +#endif // static std::wstring CommandLine::PrefixedSwitchString( diff --git a/base/command_line.h b/base/command_line.h index 864cb56..b6b1028 100644 --- a/base/command_line.h +++ b/base/command_line.h @@ -148,6 +148,9 @@ class CommandLine { const std::vector<std::string>& argv() const { return argv_; } + // Try to match the same result as command_line_string() would get you + // on windows. + std::string command_line_string() const; #endif // Returns the program part of the command line string (the first item). diff --git a/chrome/browser/dom_ui/net_internals_ui.cc b/chrome/browser/dom_ui/net_internals_ui.cc index ef1d620..c9af90a 100644 --- a/chrome/browser/dom_ui/net_internals_ui.cc +++ b/chrome/browser/dom_ui/net_internals_ui.cc @@ -9,8 +9,11 @@ #include <string> #include <vector> +#include "app/l10n_util.h" #include "app/resource_bundle.h" +#include "base/command_line.h" #include "base/file_util.h" +#include "base/file_version_info.h" #include "base/message_loop.h" #include "base/path_service.h" #include "base/singleton.h" @@ -18,6 +21,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "chrome/app/chrome_version_info.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/dom_ui/chrome_url_data_manager.h" @@ -26,10 +30,12 @@ #include "chrome/browser/net/connection_tester.h" #include "chrome/browser/net/passive_log_collector.h" #include "chrome/browser/net/url_fixer_upper.h" +#include "chrome/browser/platform_util.h" #include "chrome/browser/profile.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/net/url_request_context_getter.h" #include "chrome/common/url_constants.h" +#include "grit/generated_resources.h" #include "net/base/escape.h" #include "net/base/host_resolver_impl.h" #include "net/base/net_errors.h" @@ -498,6 +504,40 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( CallJavascriptFunction(L"g_browser.receivedLogEventTypeConstants", dict); } + // Tell the javascript about the version of the client and its + // command line arguments. + { + DictionaryValue* dict = new DictionaryValue(); + + scoped_ptr<FileVersionInfo> version_info( + chrome_app::GetChromeVersionInfo()); + + if (version_info == NULL) { + DLOG(ERROR) << "Unable to create FileVersionInfo object"; + + } else { + // We have everything we need to send the right values. + dict->SetString(L"version", version_info->file_version()); + dict->SetString(L"cl", version_info->last_change()); + dict->SetStringFromUTF16(L"version_mod", + platform_util::GetVersionStringModifier()); + + if (version_info->is_official_build()) { + dict->SetString(L"official", + l10n_util::GetString(IDS_ABOUT_VERSION_OFFICIAL)); + } else { + dict->SetString(L"official", + l10n_util::GetString(IDS_ABOUT_VERSION_UNOFFICIAL)); + } + + dict->SetString(L"command_line", + CommandLine::ForCurrentProcess()->command_line_string()); + } + + CallJavascriptFunction(L"g_browser.receivedClientInfo", + dict); + } + // Tell the javascript about the relationship between load flag enums and // their symbolic name. { diff --git a/chrome/browser/resources/net_internals/dataview.js b/chrome/browser/resources/net_internals/dataview.js index 8032a11..fbbad7d 100644 --- a/chrome/browser/resources/net_internals/dataview.js +++ b/chrome/browser/resources/net_internals/dataview.js @@ -39,9 +39,12 @@ DataView.prototype.onExportToText_ = function() { text.push('Number of actively captured events: ' + g_browser.getAllActivelyCapturedEvents().length); text.push(''); - // TODO(eroman): fill this with proper values. - text.push('Chrome version: ' + 'TODO'); - text.push('Command line switches: ' + 'TODO'); + + text.push('Chrome version: ' + ClientInfo.version + + ' (' + ClientInfo.official + + ' ' + ClientInfo.cl + + ') ' + ClientInfo.version_mod); + text.push('Command line switches: ' + ClientInfo.command_line); text.push(''); text.push('----------------------------------------------'); diff --git a/chrome/browser/resources/net_internals/main.js b/chrome/browser/resources/net_internals/main.js index c5189d2..545608e 100644 --- a/chrome/browser/resources/net_internals/main.js +++ b/chrome/browser/resources/net_internals/main.js @@ -7,6 +7,7 @@ */ var LogEventType = null; var LogEventPhase = null; +var ClientInfo = null; var LogSourceType = null; var NetError = null; var LoadFlag = null; @@ -210,6 +211,11 @@ BrowserBridge.prototype.receivedLogEventTypeConstants = function(constantsMap) { LogEventType = constantsMap; }; +BrowserBridge.prototype.receivedClientInfo = +function(info) { + ClientInfo = info; +}; + BrowserBridge.prototype.receivedLogEventPhaseConstants = function(constantsMap) { LogEventPhase = constantsMap; |