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

Unified Diff: chrome/browser/ui/webui/chromeos/about_network.cc

Issue 14876021: Re-factor network_event_log (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address final nits Created 7 years, 7 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/ui/webui/chromeos/about_network.cc
diff --git a/chrome/browser/ui/webui/chromeos/about_network.cc b/chrome/browser/ui/webui/chromeos/about_network.cc
index 9e3e5c11425aca92f3f47a05170f2f5140f9afbc..18546ada6a011c7d87a909898821faafe0999b0f 100644
--- a/chrome/browser/ui/webui/chromeos/about_network.cc
+++ b/chrome/browser/ui/webui/chromeos/about_network.cc
@@ -7,6 +7,7 @@
#include "ash/ash_switches.h"
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_tokenizer.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/network_library.h"
@@ -58,7 +59,7 @@ std::string GetHeaderHtmlInfo(int refresh) {
return output;
}
-std::string GetHeaderEventLogInfo() {
+std::string GetEventLogSection(bool debug) {
std::string output;
output.append(WrapWithH3(
l10n_util::GetStringUTF8(IDS_ABOUT_NETWORK_EVENT_LOG)));
@@ -66,8 +67,14 @@ std::string GetHeaderEventLogInfo() {
"border-style:solid; border-width:1px; "
"overflow: auto; "
"height:200px;\">");
+ network_event_log::LogLevel log_level = debug
+ ? network_event_log::LOG_LEVEL_DEBUG
+ : network_event_log::LOG_LEVEL_EVENT;
+ std::string format = debug ? "file,time,desc,html" : "time,desc,html";
+ // network_event_log::GetAsString does HTML escaping.
output.append(
- network_event_log::GetAsString(network_event_log::NEWEST_FIRST, 0));
+ network_event_log::GetAsString(network_event_log::NEWEST_FIRST,
+ format, log_level, 0));
output.append("</pre>");
return output;
}
@@ -290,11 +297,19 @@ std::string GetNetworkStateHtmlInfo() {
namespace about_ui {
std::string AboutNetwork(const std::string& query) {
- int refresh;
- base::StringToInt(query, &refresh);
+ base::StringTokenizer tok(query, "/");
+ int refresh = 0;
+ bool debug = false;
+ while (tok.GetNext()) {
+ std::string token = tok.token();
+ if (token == "debug")
+ debug = true;
+ else
+ base::StringToInt(token, &refresh);
+ }
std::string output = GetHeaderHtmlInfo(refresh);
if (network_event_log::IsInitialized())
- output += GetHeaderEventLogInfo();
+ output += GetEventLogSection(debug);
if (!CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshDisableNewNetworkStatusArea)) {
output += GetNetworkStateHtmlInfo();
« no previous file with comments | « chrome/browser/ui/webui/chromeos/about_network.h ('k') | chromeos/network/managed_network_configuration_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698