Index: chrome/browser/net/view_net_internals_job_factory.cc |
=================================================================== |
--- chrome/browser/net/view_net_internals_job_factory.cc (revision 44225) |
+++ chrome/browser/net/view_net_internals_job_factory.cc (working copy) |
@@ -30,6 +30,10 @@ |
const char kViewHttpCacheSubPath[] = "view-cache"; |
+// TODO(eroman): Delete this file. It should be replaced by |
+// chrome/browser/dom_ui/net_internals_ui.cc once the porting is |
+// complete. |
+ |
PassiveLogCollector* GetPassiveLogCollector(URLRequestContext* context) { |
// Really this is the same as: |
// g_browser_process->io_thread()->globals()-> |
@@ -67,6 +71,25 @@ |
return GURL(std::string(chrome::kNetworkViewInternalsURL) + details); |
} |
+// Converts a PassiveLogCollector::EntryList to a CapturingNetLog::EntryList. |
+// |
+// They are basically the same thing, except PassiveLogCollector has an extra |
+// "order" field which we will drop. |
+net::CapturingNetLog::EntryList ConvertEntryList( |
+ const PassiveLogCollector::EntryList& input) { |
+ net::CapturingNetLog::EntryList result; |
+ for (size_t i = 0; i < input.size(); ++i) { |
+ result.push_back( |
+ net::CapturingNetLog::Entry( |
+ input[i].type, |
+ input[i].time, |
+ input[i].source, |
+ input[i].phase, |
+ input[i].extra_parameters)); |
+ } |
+ return result; |
+} |
+ |
// A job subclass that implements a protocol to inspect the internal |
// state of the network stack. |
class ViewNetInternalsJob : public URLRequestSimpleJob { |
@@ -259,8 +282,11 @@ |
} |
virtual void OutputBody(URLRequestContext* context, std::string* out) { |
- OutputTextInPre(net::NetLogUtil::PrettyPrintAsEventTree( |
- GetInitProxyResolverTracker(context)->entries(), 0), out); |
+ OutputTextInPre( |
+ net::NetLogUtil::PrettyPrintAsEventTree( |
+ ConvertEntryList(GetInitProxyResolverTracker(context)->entries()), |
+ 0), |
+ out); |
} |
}; |
@@ -480,7 +506,7 @@ |
out->append("</nobr>"); |
OutputTextInPre( |
net::NetLogUtil::PrettyPrintAsEventTree( |
- request.entries, |
+ ConvertEntryList(request.entries), |
request.num_entries_truncated), |
out); |
out->append("</li>"); |