Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "components/url_formatter/url_fixer.h" 58 #include "components/url_formatter/url_fixer.h"
59 #include "components/version_info/version_info.h" 59 #include "components/version_info/version_info.h"
60 #include "content/public/browser/browser_thread.h" 60 #include "content/public/browser/browser_thread.h"
61 #include "content/public/browser/notification_details.h" 61 #include "content/public/browser/notification_details.h"
62 #include "content/public/browser/resource_dispatcher_host.h" 62 #include "content/public/browser/resource_dispatcher_host.h"
63 #include "content/public/browser/storage_partition.h" 63 #include "content/public/browser/storage_partition.h"
64 #include "content/public/browser/web_contents.h" 64 #include "content/public/browser/web_contents.h"
65 #include "content/public/browser/web_ui.h" 65 #include "content/public/browser/web_ui.h"
66 #include "content/public/browser/web_ui_data_source.h" 66 #include "content/public/browser/web_ui_data_source.h"
67 #include "content/public/browser/web_ui_message_handler.h" 67 #include "content/public/browser/web_ui_message_handler.h"
68 #include "extensions/features/features.h"
68 #include "net/base/net_errors.h" 69 #include "net/base/net_errors.h"
69 #include "net/disk_cache/disk_cache.h" 70 #include "net/disk_cache/disk_cache.h"
70 #include "net/dns/host_cache.h" 71 #include "net/dns/host_cache.h"
71 #include "net/dns/host_resolver.h" 72 #include "net/dns/host_resolver.h"
72 #include "net/http/http_cache.h" 73 #include "net/http/http_cache.h"
73 #include "net/http/http_network_layer.h" 74 #include "net/http/http_network_layer.h"
74 #include "net/http/http_network_session.h" 75 #include "net/http/http_network_session.h"
75 #include "net/http/http_server_properties.h" 76 #include "net/http/http_server_properties.h"
76 #include "net/http/http_stream_factory.h" 77 #include "net/http/http_stream_factory.h"
77 #include "net/http/transport_security_state.h" 78 #include "net/http/transport_security_state.h"
(...skipping 15 matching lines...) Expand all
93 #include "chromeos/dbus/debug_daemon_client.h" 94 #include "chromeos/dbus/debug_daemon_client.h"
94 #include "chromeos/network/onc/onc_certificate_importer_impl.h" 95 #include "chromeos/network/onc/onc_certificate_importer_impl.h"
95 #include "chromeos/network/onc/onc_utils.h" 96 #include "chromeos/network/onc/onc_utils.h"
96 #include "components/user_manager/user.h" 97 #include "components/user_manager/user.h"
97 #endif 98 #endif
98 99
99 #if defined(OS_WIN) 100 #if defined(OS_WIN)
100 #include "chrome/browser/net/service_providers_win.h" 101 #include "chrome/browser/net/service_providers_win.h"
101 #endif 102 #endif
102 103
103 #if defined(ENABLE_EXTENSIONS) 104 #if BUILDFLAG(ENABLE_EXTENSIONS)
104 #include "chrome/browser/extensions/extension_service.h" 105 #include "chrome/browser/extensions/extension_service.h"
105 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" 106 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h"
106 #include "extensions/browser/extension_registry.h" 107 #include "extensions/browser/extension_registry.h"
107 #include "extensions/browser/extension_system.h" 108 #include "extensions/browser/extension_system.h"
108 #include "extensions/common/extension_set.h" 109 #include "extensions/common/extension_set.h"
109 #endif 110 #endif
110 111
111 using base::StringValue; 112 using base::StringValue;
112 using content::BrowserThread; 113 using content::BrowserThread;
113 using content::WebContents; 114 using content::WebContents;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 void NetInternalsMessageHandler::RegisterMessages() { 400 void NetInternalsMessageHandler::RegisterMessages() {
400 DCHECK_CURRENTLY_ON(BrowserThread::UI); 401 DCHECK_CURRENTLY_ON(BrowserThread::UI);
401 402
402 Profile* profile = Profile::FromWebUI(web_ui()); 403 Profile* profile = Profile::FromWebUI(web_ui());
403 404
404 proxy_ = new IOThreadImpl(this->AsWeakPtr(), g_browser_process->io_thread(), 405 proxy_ = new IOThreadImpl(this->AsWeakPtr(), g_browser_process->io_thread(),
405 profile->GetRequestContext()); 406 profile->GetRequestContext());
406 proxy_->AddRequestContextGetter( 407 proxy_->AddRequestContextGetter(
407 content::BrowserContext::GetDefaultStoragePartition(profile)-> 408 content::BrowserContext::GetDefaultStoragePartition(profile)->
408 GetMediaURLRequestContext()); 409 GetMediaURLRequestContext());
409 #if defined(ENABLE_EXTENSIONS) 410 #if BUILDFLAG(ENABLE_EXTENSIONS)
410 proxy_->AddRequestContextGetter(profile->GetRequestContextForExtensions()); 411 proxy_->AddRequestContextGetter(profile->GetRequestContextForExtensions());
411 #endif 412 #endif
412 413
413 web_ui()->RegisterMessageCallback( 414 web_ui()->RegisterMessageCallback(
414 "notifyReady", 415 "notifyReady",
415 base::Bind(&NetInternalsMessageHandler::OnRendererReady, 416 base::Bind(&NetInternalsMessageHandler::OnRendererReady,
416 base::Unretained(this))); 417 base::Unretained(this)));
417 web_ui()->RegisterMessageCallback( 418 web_ui()->RegisterMessageCallback(
418 "getNetInfo", 419 "getNetInfo",
419 base::Bind(&IOThreadImpl::CallbackHelper, 420 base::Bind(&IOThreadImpl::CallbackHelper,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 compression_stats->HistoricNetworkStatsInfoToValue(); 565 compression_stats->HistoricNetworkStatsInfoToValue();
565 } 566 }
566 SendJavascriptCommand("receivedHistoricNetworkStats", 567 SendJavascriptCommand("receivedHistoricNetworkStats",
567 std::move(historic_network_info)); 568 std::move(historic_network_info));
568 } 569 }
569 570
570 void NetInternalsMessageHandler::OnGetExtensionInfo( 571 void NetInternalsMessageHandler::OnGetExtensionInfo(
571 const base::ListValue* list) { 572 const base::ListValue* list) {
572 DCHECK_CURRENTLY_ON(BrowserThread::UI); 573 DCHECK_CURRENTLY_ON(BrowserThread::UI);
573 auto extension_list = base::MakeUnique<base::ListValue>(); 574 auto extension_list = base::MakeUnique<base::ListValue>();
574 #if defined(ENABLE_EXTENSIONS) 575 #if BUILDFLAG(ENABLE_EXTENSIONS)
575 Profile* profile = Profile::FromWebUI(web_ui()); 576 Profile* profile = Profile::FromWebUI(web_ui());
576 extensions::ExtensionSystem* extension_system = 577 extensions::ExtensionSystem* extension_system =
577 extensions::ExtensionSystem::Get(profile); 578 extensions::ExtensionSystem::Get(profile);
578 if (extension_system) { 579 if (extension_system) {
579 ExtensionService* extension_service = extension_system->extension_service(); 580 ExtensionService* extension_service = extension_system->extension_service();
580 if (extension_service) { 581 if (extension_service) {
581 std::unique_ptr<const extensions::ExtensionSet> extensions( 582 std::unique_ptr<const extensions::ExtensionSet> extensions(
582 extensions::ExtensionRegistry::Get(profile) 583 extensions::ExtensionRegistry::Get(profile)
583 ->GenerateInstalledExtensionsSet()); 584 ->GenerateInstalledExtensionsSet());
584 for (const auto& extension : *extensions) { 585 for (const auto& extension : *extensions) {
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 //////////////////////////////////////////////////////////////////////////////// 1172 ////////////////////////////////////////////////////////////////////////////////
1172 1173
1173 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) 1174 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui)
1174 : WebUIController(web_ui) { 1175 : WebUIController(web_ui) {
1175 web_ui->AddMessageHandler(new NetInternalsMessageHandler()); 1176 web_ui->AddMessageHandler(new NetInternalsMessageHandler());
1176 1177
1177 // Set up the chrome://net-internals/ source. 1178 // Set up the chrome://net-internals/ source.
1178 Profile* profile = Profile::FromWebUI(web_ui); 1179 Profile* profile = Profile::FromWebUI(web_ui);
1179 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); 1180 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource());
1180 } 1181 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/log_web_ui_url_unittest.cc ('k') | chrome/browser/ui/webui/policy_ui_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698