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

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: . 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..f488258995cf7f9c12d1c91bc898daadd8a19a32 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 GetHeaderEventLogInfo(bool debug) {
pneubeck (no reviews) 2013/05/13 13:16:25 This function's name is cryptic to me.
stevenjb 2013/05/13 19:36:39 A suggestion would help since it's obviously less
std::string output;
output.append(WrapWithH3(
l10n_util::GetStringUTF8(IDS_ABOUT_NETWORK_EVENT_LOG)));
@@ -66,8 +67,13 @@ 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";
output.append(
- network_event_log::GetAsString(network_event_log::NEWEST_FIRST, 0));
+ network_event_log::GetAsString(network_event_log::NEWEST_FIRST,
pneubeck (no reviews) 2013/05/13 13:16:25 creating html content from insecure sources (like
stevenjb 2013/05/13 19:36:39 Yeah, this is long overdue to be replaced with Web
+ format, log_level, 0));
output.append("</pre>");
return output;
}
@@ -290,11 +296,19 @@ std::string GetNetworkStateHtmlInfo() {
namespace about_ui {
std::string AboutNetwork(const std::string& query) {
- int refresh;
- base::StringToInt(query, &refresh);
+ base::StringTokenizer tok(query, "/");
gauravsh 2013/05/13 00:34:51 Update the comment for AboutNetwork in about_netwo
pneubeck (no reviews) 2013/05/13 13:16:25 shouldn't this be separated by '&' ?
stevenjb 2013/05/13 19:36:39 We should really have a proper UI here. This is a
+ 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 += GetHeaderEventLogInfo(debug);
if (!CommandLine::ForCurrentProcess()->HasSwitch(
ash::switches::kAshDisableNewNetworkStatusArea)) {
output += GetNetworkStateHtmlInfo();

Powered by Google App Engine
This is Rietveld 408576698