OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/net_internals/net_internals_ui.h" | 5 #include "chrome/browser/ui/webui/net_internals/net_internals_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/strings/string_split.h" | 26 #include "base/strings/string_split.h" |
27 #include "base/strings/string_util.h" | 27 #include "base/strings/string_util.h" |
28 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
29 #include "base/task/cancelable_task_tracker.h" | 29 #include "base/task/cancelable_task_tracker.h" |
30 #include "base/values.h" | 30 #include "base/values.h" |
31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
32 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 32 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
33 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 33 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
34 #include "chrome/browser/chrome_notification_types.h" | 34 #include "chrome/browser/chrome_notification_types.h" |
35 #include "chrome/browser/download/download_prefs.h" | 35 #include "chrome/browser/download/download_prefs.h" |
36 #include "chrome/browser/extensions/extension_service.h" | |
37 #include "chrome/browser/io_thread.h" | 36 #include "chrome/browser/io_thread.h" |
38 #include "chrome/browser/net/chrome_net_log.h" | 37 #include "chrome/browser/net/chrome_net_log.h" |
39 #include "chrome/browser/net/chrome_network_delegate.h" | 38 #include "chrome/browser/net/chrome_network_delegate.h" |
40 #include "chrome/browser/net/connection_tester.h" | 39 #include "chrome/browser/net/connection_tester.h" |
41 #include "chrome/browser/prerender/prerender_manager.h" | 40 #include "chrome/browser/prerender/prerender_manager.h" |
42 #include "chrome/browser/prerender/prerender_manager_factory.h" | 41 #include "chrome/browser/prerender/prerender_manager_factory.h" |
43 #include "chrome/browser/profiles/profile.h" | 42 #include "chrome/browser/profiles/profile.h" |
44 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" | |
45 #include "chrome/common/chrome_paths.h" | 43 #include "chrome/common/chrome_paths.h" |
46 #include "chrome/common/chrome_version_info.h" | 44 #include "chrome/common/chrome_version_info.h" |
47 #include "chrome/common/logging_chrome.h" | 45 #include "chrome/common/logging_chrome.h" |
48 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
49 #include "chrome/common/url_constants.h" | 47 #include "chrome/common/url_constants.h" |
50 #include "components/onc/onc_constants.h" | 48 #include "components/onc/onc_constants.h" |
51 #include "components/url_fixer/url_fixer.h" | 49 #include "components/url_fixer/url_fixer.h" |
52 #include "content/public/browser/browser_thread.h" | 50 #include "content/public/browser/browser_thread.h" |
53 #include "content/public/browser/notification_details.h" | 51 #include "content/public/browser/notification_details.h" |
54 #include "content/public/browser/resource_dispatcher_host.h" | 52 #include "content/public/browser/resource_dispatcher_host.h" |
55 #include "content/public/browser/web_contents.h" | 53 #include "content/public/browser/web_contents.h" |
56 #include "content/public/browser/web_ui.h" | 54 #include "content/public/browser/web_ui.h" |
57 #include "content/public/browser/web_ui_data_source.h" | 55 #include "content/public/browser/web_ui_data_source.h" |
58 #include "content/public/browser/web_ui_message_handler.h" | 56 #include "content/public/browser/web_ui_message_handler.h" |
59 #include "extensions/browser/extension_registry.h" | |
60 #include "extensions/browser/extension_system.h" | |
61 #include "extensions/common/extension_set.h" | |
62 #include "grit/generated_resources.h" | 57 #include "grit/generated_resources.h" |
63 #include "grit/net_internals_resources.h" | 58 #include "grit/net_internals_resources.h" |
64 #include "net/base/net_errors.h" | 59 #include "net/base/net_errors.h" |
65 #include "net/base/net_log_logger.h" | 60 #include "net/base/net_log_logger.h" |
66 #include "net/base/net_util.h" | 61 #include "net/base/net_util.h" |
67 #include "net/disk_cache/disk_cache.h" | 62 #include "net/disk_cache/disk_cache.h" |
68 #include "net/dns/host_cache.h" | 63 #include "net/dns/host_cache.h" |
69 #include "net/dns/host_resolver.h" | 64 #include "net/dns/host_resolver.h" |
70 #include "net/http/http_cache.h" | 65 #include "net/http/http_cache.h" |
71 #include "net/http/http_network_layer.h" | 66 #include "net/http/http_network_layer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
83 #include "chrome/browser/chromeos/login/users/user.h" | 78 #include "chrome/browser/chromeos/login/users/user.h" |
84 #include "chrome/browser/chromeos/net/onc_utils.h" | 79 #include "chrome/browser/chromeos/net/onc_utils.h" |
85 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 80 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
86 #include "chrome/browser/chromeos/system/syslogs_provider.h" | 81 #include "chrome/browser/chromeos/system/syslogs_provider.h" |
87 #include "chrome/browser/net/nss_context.h" | 82 #include "chrome/browser/net/nss_context.h" |
88 #include "chromeos/dbus/dbus_thread_manager.h" | 83 #include "chromeos/dbus/dbus_thread_manager.h" |
89 #include "chromeos/dbus/debug_daemon_client.h" | 84 #include "chromeos/dbus/debug_daemon_client.h" |
90 #include "chromeos/network/onc/onc_certificate_importer_impl.h" | 85 #include "chromeos/network/onc/onc_certificate_importer_impl.h" |
91 #include "chromeos/network/onc/onc_utils.h" | 86 #include "chromeos/network/onc/onc_utils.h" |
92 #endif | 87 #endif |
| 88 |
93 #if defined(OS_WIN) | 89 #if defined(OS_WIN) |
94 #include "chrome/browser/net/service_providers_win.h" | 90 #include "chrome/browser/net/service_providers_win.h" |
95 #endif | 91 #endif |
96 | 92 |
| 93 #if defined(ENABLE_EXTENSIONS) |
| 94 #include "chrome/browser/extensions/extension_service.h" |
| 95 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" |
| 96 #include "extensions/browser/extension_registry.h" |
| 97 #include "extensions/browser/extension_system.h" |
| 98 #include "extensions/common/extension_set.h" |
| 99 #endif |
| 100 |
97 using base::StringValue; | 101 using base::StringValue; |
98 using content::BrowserThread; | 102 using content::BrowserThread; |
99 using content::WebContents; | 103 using content::WebContents; |
100 using content::WebUIMessageHandler; | 104 using content::WebUIMessageHandler; |
101 | 105 |
102 namespace { | 106 namespace { |
103 | 107 |
104 // Delay between when an event occurs and when it is passed to the Javascript | 108 // Delay between when an event occurs and when it is passed to the Javascript |
105 // page. All events that occur during this period are grouped together and | 109 // page. All events that occur during this period are grouped together and |
106 // sent to the page at once, which reduces context switching and CPU usage. | 110 // sent to the page at once, which reduces context switching and CPU usage. |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 780 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
777 base::Value* historic_network_info = | 781 base::Value* historic_network_info = |
778 ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue(); | 782 ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue(); |
779 SendJavascriptCommand("receivedHistoricNetworkStats", historic_network_info); | 783 SendJavascriptCommand("receivedHistoricNetworkStats", historic_network_info); |
780 } | 784 } |
781 | 785 |
782 void NetInternalsMessageHandler::OnGetExtensionInfo( | 786 void NetInternalsMessageHandler::OnGetExtensionInfo( |
783 const base::ListValue* list) { | 787 const base::ListValue* list) { |
784 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 788 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
785 base::ListValue* extension_list = new base::ListValue(); | 789 base::ListValue* extension_list = new base::ListValue(); |
| 790 #if defined(ENABLE_EXTENSIONS) |
786 Profile* profile = Profile::FromWebUI(web_ui()); | 791 Profile* profile = Profile::FromWebUI(web_ui()); |
787 extensions::ExtensionSystem* extension_system = | 792 extensions::ExtensionSystem* extension_system = |
788 extensions::ExtensionSystem::Get(profile); | 793 extensions::ExtensionSystem::Get(profile); |
789 if (extension_system) { | 794 if (extension_system) { |
790 ExtensionService* extension_service = extension_system->extension_service(); | 795 ExtensionService* extension_service = extension_system->extension_service(); |
791 if (extension_service) { | 796 if (extension_service) { |
792 scoped_ptr<const extensions::ExtensionSet> extensions( | 797 scoped_ptr<const extensions::ExtensionSet> extensions( |
793 extensions::ExtensionRegistry::Get(profile) | 798 extensions::ExtensionRegistry::Get(profile) |
794 ->GenerateInstalledExtensionsSet()); | 799 ->GenerateInstalledExtensionsSet()); |
795 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); | 800 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
796 it != extensions->end(); ++it) { | 801 it != extensions->end(); ++it) { |
797 base::DictionaryValue* extension_info = new base::DictionaryValue(); | 802 base::DictionaryValue* extension_info = new base::DictionaryValue(); |
798 bool enabled = extension_service->IsExtensionEnabled((*it)->id()); | 803 bool enabled = extension_service->IsExtensionEnabled((*it)->id()); |
799 extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); | 804 extensions::GetExtensionBasicInfo(it->get(), enabled, extension_info); |
800 extension_list->Append(extension_info); | 805 extension_list->Append(extension_info); |
801 } | 806 } |
802 } | 807 } |
803 } | 808 } |
| 809 #endif |
804 SendJavascriptCommand("receivedExtensionInfo", extension_list); | 810 SendJavascriptCommand("receivedExtensionInfo", extension_list); |
805 } | 811 } |
806 | 812 |
807 #if defined(OS_CHROMEOS) | 813 #if defined(OS_CHROMEOS) |
808 //////////////////////////////////////////////////////////////////////////////// | 814 //////////////////////////////////////////////////////////////////////////////// |
809 // | 815 // |
810 // NetInternalsMessageHandler::SystemLogsGetter | 816 // NetInternalsMessageHandler::SystemLogsGetter |
811 // | 817 // |
812 //////////////////////////////////////////////////////////////////////////////// | 818 //////////////////////////////////////////////////////////////////////////////// |
813 | 819 |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 } | 1784 } |
1779 | 1785 |
1780 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1786 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1781 : WebUIController(web_ui) { | 1787 : WebUIController(web_ui) { |
1782 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); | 1788 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); |
1783 | 1789 |
1784 // Set up the chrome://net-internals/ source. | 1790 // Set up the chrome://net-internals/ source. |
1785 Profile* profile = Profile::FromWebUI(web_ui); | 1791 Profile* profile = Profile::FromWebUI(web_ui); |
1786 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1792 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1787 } | 1793 } |
OLD | NEW |