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

Side by Side Diff: chrome/browser/net/view_net_internals_job_factory.cc

Issue 1696005: Add net log entries that summarize transmit and receive byte counts. (Closed)
Patch Set: More tests and address comments Created 10 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/net/view_net_internals_job_factory.h" 5 #include "chrome/browser/net/view_net_internals_job_factory.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 explicit URLRequestLiveSubSection(SubSection* parent) 517 explicit URLRequestLiveSubSection(SubSection* parent)
518 : SubSection(parent, "outstanding", "Outstanding requests") { 518 : SubSection(parent, "outstanding", "Outstanding requests") {
519 } 519 }
520 520
521 virtual void OutputBody(URLRequestContext* context, std::string* out) { 521 virtual void OutputBody(URLRequestContext* context, std::string* out) {
522 PassiveLogCollector::RequestInfoList requests = 522 PassiveLogCollector::RequestInfoList requests =
523 GetURLRequestTracker(context)->GetLiveRequests(); 523 GetURLRequestTracker(context)->GetLiveRequests();
524 524
525 out->append("<ol>"); 525 out->append("<ol>");
526 for (size_t i = 0; i < requests.size(); ++i) { 526 for (size_t i = 0; i < requests.size(); ++i) {
527 // Reverse the list order, so we dispay from most recent to oldest. 527 // Reverse the list order, so we display from most recent to oldest.
528 size_t index = requests.size() - i - 1; 528 size_t index = requests.size() - i - 1;
529 OutputURLAndLoadLog(requests[index], out); 529 OutputURLAndLoadLog(requests[index], out);
530 } 530 }
531 out->append("</ol>"); 531 out->append("</ol>");
532 } 532 }
533 }; 533 };
534 534
535 class URLRequestRecentSubSection : public SubSection { 535 class URLRequestRecentSubSection : public SubSection {
536 public: 536 public:
537 explicit URLRequestRecentSubSection(SubSection* parent) 537 explicit URLRequestRecentSubSection(SubSection* parent)
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 SplitString(commands_str, ',', &commands); 719 SplitString(commands_str, ',', &commands);
720 720
721 for (size_t i = 0; i < commands.size(); ++i) 721 for (size_t i = 0; i < commands.size(); ++i)
722 HandleCommand(commands[i], context); 722 HandleCommand(commands[i], context);
723 } 723 }
724 724
725 // Appends some HTML controls to |data| that allow the user to enable full 725 // Appends some HTML controls to |data| that allow the user to enable full
726 // logging, and clear some of the already logged data. 726 // logging, and clear some of the already logged data.
727 void DrawControlsHeader(URLRequestContext* context, std::string* data) { 727 void DrawControlsHeader(URLRequestContext* context, std::string* data) {
728 bool is_full_logging_enabled = 728 bool is_full_logging_enabled =
729 GetURLRequestTracker(context)->IsUnbounded() && 729 GetURLRequestTracker(context)->is_unbounded() &&
730 GetSocketStreamTracker(context)->IsUnbounded(); 730 GetSocketStreamTracker(context)->is_unbounded();
731 731
732 data->append("<div style='margin-bottom: 10px'>"); 732 data->append("<div style='margin-bottom: 10px'>");
733 733
734 if (is_full_logging_enabled) { 734 if (is_full_logging_enabled) {
735 DrawCommandButton("Disable full logging", "full-logging-disable", data); 735 DrawCommandButton("Disable full logging", "full-logging-disable", data);
736 } else { 736 } else {
737 DrawCommandButton("Enable full logging", "full-logging-enable", data); 737 DrawCommandButton("Enable full logging", "full-logging-enable", data);
738 } 738 }
739 739
740 DrawCommandButton("Clear all data", 740 DrawCommandButton("Clear all data",
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 return StartsWithASCII(url.spec(), 866 return StartsWithASCII(url.spec(),
867 chrome::kNetworkViewInternalsURL, 867 chrome::kNetworkViewInternalsURL,
868 true /*case_sensitive*/); 868 true /*case_sensitive*/);
869 } 869 }
870 870
871 // static 871 // static
872 URLRequestJob* ViewNetInternalsJobFactory::CreateJobForRequest( 872 URLRequestJob* ViewNetInternalsJobFactory::CreateJobForRequest(
873 URLRequest* request) { 873 URLRequest* request) {
874 return new ViewNetInternalsJob(request); 874 return new ViewNetInternalsJob(request);
875 } 875 }
OLDNEW
« no previous file with comments | « chrome/browser/net/passive_log_collector_unittest.cc ('k') | chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698