| 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 <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "app/l10n_util.h" |
| 12 #include "app/resource_bundle.h" | 13 #include "app/resource_bundle.h" |
| 14 #include "base/command_line.h" |
| 13 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 16 #include "base/file_version_info.h" |
| 14 #include "base/message_loop.h" | 17 #include "base/message_loop.h" |
| 15 #include "base/path_service.h" | 18 #include "base/path_service.h" |
| 16 #include "base/singleton.h" | 19 #include "base/singleton.h" |
| 17 #include "base/string_piece.h" | 20 #include "base/string_piece.h" |
| 18 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 19 #include "base/utf_string_conversions.h" | 22 #include "base/utf_string_conversions.h" |
| 20 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "chrome/app/chrome_version_info.h" |
| 21 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/chrome_thread.h" | 26 #include "chrome/browser/chrome_thread.h" |
| 23 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 27 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 24 #include "chrome/browser/io_thread.h" | 28 #include "chrome/browser/io_thread.h" |
| 25 #include "chrome/browser/net/chrome_net_log.h" | 29 #include "chrome/browser/net/chrome_net_log.h" |
| 26 #include "chrome/browser/net/connection_tester.h" | 30 #include "chrome/browser/net/connection_tester.h" |
| 27 #include "chrome/browser/net/passive_log_collector.h" | 31 #include "chrome/browser/net/passive_log_collector.h" |
| 28 #include "chrome/browser/net/url_fixer_upper.h" | 32 #include "chrome/browser/net/url_fixer_upper.h" |
| 33 #include "chrome/browser/platform_util.h" |
| 29 #include "chrome/browser/profile.h" | 34 #include "chrome/browser/profile.h" |
| 30 #include "chrome/common/chrome_paths.h" | 35 #include "chrome/common/chrome_paths.h" |
| 31 #include "chrome/common/net/url_request_context_getter.h" | 36 #include "chrome/common/net/url_request_context_getter.h" |
| 32 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
| 38 #include "grit/generated_resources.h" |
| 33 #include "net/base/escape.h" | 39 #include "net/base/escape.h" |
| 34 #include "net/base/host_resolver_impl.h" | 40 #include "net/base/host_resolver_impl.h" |
| 35 #include "net/base/net_errors.h" | 41 #include "net/base/net_errors.h" |
| 36 #include "net/base/net_util.h" | 42 #include "net/base/net_util.h" |
| 37 #include "net/base/sys_addrinfo.h" | 43 #include "net/base/sys_addrinfo.h" |
| 38 #include "net/disk_cache/disk_cache.h" | 44 #include "net/disk_cache/disk_cache.h" |
| 39 #include "net/http/http_cache.h" | 45 #include "net/http/http_cache.h" |
| 40 #include "net/proxy/proxy_service.h" | 46 #include "net/proxy/proxy_service.h" |
| 41 #include "net/url_request/url_request_context.h" | 47 #include "net/url_request/url_request_context.h" |
| 42 | 48 |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 | 497 |
| 492 for (size_t i = 0; i < event_types.size(); ++i) { | 498 for (size_t i = 0; i < event_types.size(); ++i) { |
| 493 const char* name = net::NetLog::EventTypeToString(event_types[i]); | 499 const char* name = net::NetLog::EventTypeToString(event_types[i]); |
| 494 dict->SetInteger(ASCIIToWide(name), | 500 dict->SetInteger(ASCIIToWide(name), |
| 495 static_cast<int>(event_types[i])); | 501 static_cast<int>(event_types[i])); |
| 496 } | 502 } |
| 497 | 503 |
| 498 CallJavascriptFunction(L"g_browser.receivedLogEventTypeConstants", dict); | 504 CallJavascriptFunction(L"g_browser.receivedLogEventTypeConstants", dict); |
| 499 } | 505 } |
| 500 | 506 |
| 507 // Tell the javascript about the version of the client and its |
| 508 // command line arguments. |
| 509 { |
| 510 DictionaryValue* dict = new DictionaryValue(); |
| 511 |
| 512 scoped_ptr<FileVersionInfo> version_info( |
| 513 chrome_app::GetChromeVersionInfo()); |
| 514 |
| 515 if (version_info == NULL) { |
| 516 DLOG(ERROR) << "Unable to create FileVersionInfo object"; |
| 517 |
| 518 } else { |
| 519 // We have everything we need to send the right values. |
| 520 dict->SetString(L"version", version_info->file_version()); |
| 521 dict->SetString(L"cl", version_info->last_change()); |
| 522 dict->SetStringFromUTF16(L"version_mod", |
| 523 platform_util::GetVersionStringModifier()); |
| 524 |
| 525 if (version_info->is_official_build()) { |
| 526 dict->SetString(L"official", |
| 527 l10n_util::GetString(IDS_ABOUT_VERSION_OFFICIAL)); |
| 528 } else { |
| 529 dict->SetString(L"official", |
| 530 l10n_util::GetString(IDS_ABOUT_VERSION_UNOFFICIAL)); |
| 531 } |
| 532 |
| 533 dict->SetString(L"command_line", |
| 534 CommandLine::ForCurrentProcess()->command_line_string()); |
| 535 } |
| 536 |
| 537 CallJavascriptFunction(L"g_browser.receivedClientInfo", |
| 538 dict); |
| 539 } |
| 540 |
| 501 // Tell the javascript about the relationship between load flag enums and | 541 // Tell the javascript about the relationship between load flag enums and |
| 502 // their symbolic name. | 542 // their symbolic name. |
| 503 { | 543 { |
| 504 DictionaryValue* dict = new DictionaryValue(); | 544 DictionaryValue* dict = new DictionaryValue(); |
| 505 | 545 |
| 506 #define LOAD_FLAG(label, value) \ | 546 #define LOAD_FLAG(label, value) \ |
| 507 dict->SetInteger(ASCIIToWide(# label), static_cast<int>(value)); | 547 dict->SetInteger(ASCIIToWide(# label), static_cast<int>(value)); |
| 508 #include "net/base/load_flags_list.h" | 548 #include "net/base/load_flags_list.h" |
| 509 #undef LOAD_FLAG | 549 #undef LOAD_FLAG |
| 510 | 550 |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); | 914 NetInternalsHTMLSource* html_source = new NetInternalsHTMLSource(); |
| 875 | 915 |
| 876 // Set up the chrome://net-internals/ source. | 916 // Set up the chrome://net-internals/ source. |
| 877 ChromeThread::PostTask( | 917 ChromeThread::PostTask( |
| 878 ChromeThread::IO, FROM_HERE, | 918 ChromeThread::IO, FROM_HERE, |
| 879 NewRunnableMethod( | 919 NewRunnableMethod( |
| 880 Singleton<ChromeURLDataManager>::get(), | 920 Singleton<ChromeURLDataManager>::get(), |
| 881 &ChromeURLDataManager::AddDataSource, | 921 &ChromeURLDataManager::AddDataSource, |
| 882 make_scoped_refptr(html_source))); | 922 make_scoped_refptr(html_source))); |
| 883 } | 923 } |
| OLD | NEW |