| OLD | NEW |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 PassiveLogCollector::RequestTracker* GetURLRequestTracker( | 43 PassiveLogCollector::RequestTracker* GetURLRequestTracker( |
| 44 URLRequestContext* context) { | 44 URLRequestContext* context) { |
| 45 return GetPassiveLogCollector(context)->url_request_tracker(); | 45 return GetPassiveLogCollector(context)->url_request_tracker(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 PassiveLogCollector::RequestTracker* GetSocketStreamTracker( | 48 PassiveLogCollector::RequestTracker* GetSocketStreamTracker( |
| 49 URLRequestContext* context) { | 49 URLRequestContext* context) { |
| 50 return GetPassiveLogCollector(context)->socket_stream_tracker(); | 50 return GetPassiveLogCollector(context)->socket_stream_tracker(); |
| 51 } | 51 } |
| 52 | 52 |
| 53 PassiveLogCollector::InitProxyResolverTracker* GetInitProxyResolverTracker( |
| 54 URLRequestContext* context) { |
| 55 return GetPassiveLogCollector(context)->init_proxy_resolver_tracker(); |
| 56 } |
| 57 |
| 53 std::string GetDetails(const GURL& url) { | 58 std::string GetDetails(const GURL& url) { |
| 54 DCHECK(ViewNetInternalsJobFactory::IsSupportedURL(url)); | 59 DCHECK(ViewNetInternalsJobFactory::IsSupportedURL(url)); |
| 55 size_t start = strlen(chrome::kNetworkViewInternalsURL); | 60 size_t start = strlen(chrome::kNetworkViewInternalsURL); |
| 56 if (start >= url.spec().size()) | 61 if (start >= url.spec().size()) |
| 57 return std::string(); | 62 return std::string(); |
| 58 return url.spec().substr(start); | 63 return url.spec().substr(start); |
| 59 } | 64 } |
| 60 | 65 |
| 61 GURL MakeURL(const std::string& details) { | 66 GURL MakeURL(const std::string& details) { |
| 62 return GURL(std::string(chrome::kNetworkViewInternalsURL) + details); | 67 return GURL(std::string(chrome::kNetworkViewInternalsURL) + details); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 252 } |
| 248 }; | 253 }; |
| 249 | 254 |
| 250 class ProxyServiceLastInitLogSubSection : public SubSection { | 255 class ProxyServiceLastInitLogSubSection : public SubSection { |
| 251 public: | 256 public: |
| 252 explicit ProxyServiceLastInitLogSubSection(SubSection* parent) | 257 explicit ProxyServiceLastInitLogSubSection(SubSection* parent) |
| 253 : SubSection(parent, "init_log", "Last initialized load log") { | 258 : SubSection(parent, "init_log", "Last initialized load log") { |
| 254 } | 259 } |
| 255 | 260 |
| 256 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 261 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
| 257 net::ProxyService* proxy_service = context->proxy_service(); | |
| 258 OutputTextInPre(net::NetLogUtil::PrettyPrintAsEventTree( | 262 OutputTextInPre(net::NetLogUtil::PrettyPrintAsEventTree( |
| 259 proxy_service->init_proxy_resolver_log().entries(), 0), out); | 263 GetInitProxyResolverTracker(context)->entries(), 0), out); |
| 260 } | 264 } |
| 261 }; | 265 }; |
| 262 | 266 |
| 263 class ProxyServiceBadProxiesSubSection : public SubSection { | 267 class ProxyServiceBadProxiesSubSection : public SubSection { |
| 264 public: | 268 public: |
| 265 explicit ProxyServiceBadProxiesSubSection(SubSection* parent) | 269 explicit ProxyServiceBadProxiesSubSection(SubSection* parent) |
| 266 : SubSection(parent, "bad_proxies", "Bad Proxies") { | 270 : SubSection(parent, "bad_proxies", "Bad Proxies") { |
| 267 } | 271 } |
| 268 | 272 |
| 269 virtual void OutputBody(URLRequestContext* context, std::string* out) { | 273 virtual void OutputBody(URLRequestContext* context, std::string* out) { |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 return StartsWithASCII(url.spec(), | 834 return StartsWithASCII(url.spec(), |
| 831 chrome::kNetworkViewInternalsURL, | 835 chrome::kNetworkViewInternalsURL, |
| 832 true /*case_sensitive*/); | 836 true /*case_sensitive*/); |
| 833 } | 837 } |
| 834 | 838 |
| 835 // static | 839 // static |
| 836 URLRequestJob* ViewNetInternalsJobFactory::CreateJobForRequest( | 840 URLRequestJob* ViewNetInternalsJobFactory::CreateJobForRequest( |
| 837 URLRequest* request) { | 841 URLRequest* request) { |
| 838 return new ViewNetInternalsJob(request); | 842 return new ViewNetInternalsJob(request); |
| 839 } | 843 } |
| OLD | NEW |