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/dom_ui/net_internals_ui.h" | 5 #include "chrome/browser/dom_ui/net_internals_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "app/l10n_util.h" | 13 #include "app/l10n_util.h" |
14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
17 #include "base/file_version_info.h" | 17 #include "base/file_version_info.h" |
18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
20 #include "base/singleton.h" | 20 #include "base/singleton.h" |
| 21 #include "base/string_number_conversions.h" |
21 #include "base/string_piece.h" | 22 #include "base/string_piece.h" |
22 #include "base/string_util.h" | |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "base/values.h" | 24 #include "base/values.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/chrome_thread.h" | 26 #include "chrome/browser/chrome_thread.h" |
27 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 27 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
28 #include "chrome/browser/io_thread.h" | 28 #include "chrome/browser/io_thread.h" |
29 #include "chrome/browser/net/chrome_net_log.h" | 29 #include "chrome/browser/net/chrome_net_log.h" |
30 #include "chrome/browser/net/connection_tester.h" | 30 #include "chrome/browser/net/connection_tester.h" |
31 #include "chrome/browser/net/passive_log_collector.h" | 31 #include "chrome/browser/net/passive_log_collector.h" |
32 #include "chrome/browser/net/url_fixer_upper.h" | 32 #include "chrome/browser/net/url_fixer_upper.h" |
(...skipping 12 matching lines...) Expand all Loading... |
45 #include "net/base/sys_addrinfo.h" | 45 #include "net/base/sys_addrinfo.h" |
46 #include "net/disk_cache/disk_cache.h" | 46 #include "net/disk_cache/disk_cache.h" |
47 #include "net/http/http_cache.h" | 47 #include "net/http/http_cache.h" |
48 #include "net/proxy/proxy_service.h" | 48 #include "net/proxy/proxy_service.h" |
49 #include "net/url_request/url_request_context.h" | 49 #include "net/url_request/url_request_context.h" |
50 | 50 |
51 namespace { | 51 namespace { |
52 | 52 |
53 // Formats |t| as a decimal number, in milliseconds. | 53 // Formats |t| as a decimal number, in milliseconds. |
54 std::string TickCountToString(const base::TimeTicks& t) { | 54 std::string TickCountToString(const base::TimeTicks& t) { |
55 return Int64ToString((t - base::TimeTicks()).InMilliseconds()); | 55 return base::Int64ToString((t - base::TimeTicks()).InMilliseconds()); |
56 } | 56 } |
57 | 57 |
58 // Returns the HostCache for |context|'s primary HostResolver, or NULL if | 58 // Returns the HostCache for |context|'s primary HostResolver, or NULL if |
59 // there is none. | 59 // there is none. |
60 net::HostCache* GetHostResolverCache(URLRequestContext* context) { | 60 net::HostCache* GetHostResolverCache(URLRequestContext* context) { |
61 net::HostResolverImpl* host_resolver_impl = | 61 net::HostResolverImpl* host_resolver_impl = |
62 context->host_resolver()->GetAsHostResolverImpl(); | 62 context->host_resolver()->GetAsHostResolverImpl(); |
63 | 63 |
64 if (!host_resolver_impl) | 64 if (!host_resolver_impl) |
65 return NULL; | 65 return NULL; |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // Chrome on all platforms stores times using the Windows epoch | 582 // Chrome on all platforms stores times using the Windows epoch |
583 // (Jan 1 1601), but the javascript wants a unix epoch. | 583 // (Jan 1 1601), but the javascript wants a unix epoch. |
584 // TODO(eroman): Getting the timestamp relative the to unix epoch should | 584 // TODO(eroman): Getting the timestamp relative the to unix epoch should |
585 // be part of the time library. | 585 // be part of the time library. |
586 const int64 kUnixEpochMs = 11644473600000LL; | 586 const int64 kUnixEpochMs = 11644473600000LL; |
587 int64 tick_to_unix_time_ms = tick_to_time_ms - kUnixEpochMs; | 587 int64 tick_to_unix_time_ms = tick_to_time_ms - kUnixEpochMs; |
588 | 588 |
589 // Pass it as a string, since it may be too large to fit in an integer. | 589 // Pass it as a string, since it may be too large to fit in an integer. |
590 CallJavascriptFunction(L"g_browser.receivedTimeTickOffset", | 590 CallJavascriptFunction(L"g_browser.receivedTimeTickOffset", |
591 Value::CreateStringValue( | 591 Value::CreateStringValue( |
592 Int64ToString(tick_to_unix_time_ms))); | 592 base::Int64ToString(tick_to_unix_time_ms))); |
593 } | 593 } |
594 | 594 |
595 OnGetPassiveLogEntries(NULL); | 595 OnGetPassiveLogEntries(NULL); |
596 OnGetProxySettings(NULL); | 596 OnGetProxySettings(NULL); |
597 OnGetBadProxies(NULL); | 597 OnGetBadProxies(NULL); |
598 OnGetHostResolverCache(NULL); | 598 OnGetHostResolverCache(NULL); |
599 OnGetHttpCacheInfo(NULL); | 599 OnGetHttpCacheInfo(NULL); |
600 } | 600 } |
601 | 601 |
602 void NetInternalsMessageHandler::IOThreadImpl::OnGetProxySettings( | 602 void NetInternalsMessageHandler::IOThreadImpl::OnGetProxySettings( |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); | 887 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); |
888 | 888 |
889 // Set up the chrome://net-internals/ source. | 889 // Set up the chrome://net-internals/ source. |
890 ChromeThread::PostTask( | 890 ChromeThread::PostTask( |
891 ChromeThread::IO, FROM_HERE, | 891 ChromeThread::IO, FROM_HERE, |
892 NewRunnableMethod( | 892 NewRunnableMethod( |
893 Singleton<ChromeURLDataManager>::get(), | 893 Singleton<ChromeURLDataManager>::get(), |
894 &ChromeURLDataManager::AddDataSource, | 894 &ChromeURLDataManager::AddDataSource, |
895 make_scoped_refptr(html_source))); | 895 make_scoped_refptr(html_source))); |
896 } | 896 } |
OLD | NEW |