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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 void NetInternalsMessageHandler::RegisterMessages() { | 380 void NetInternalsMessageHandler::RegisterMessages() { |
381 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 381 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
382 | 382 |
383 Profile* profile = Profile::FromWebUI(web_ui()); | 383 Profile* profile = Profile::FromWebUI(web_ui()); |
384 | 384 |
385 proxy_ = new IOThreadImpl(this->AsWeakPtr(), g_browser_process->io_thread(), | 385 proxy_ = new IOThreadImpl(this->AsWeakPtr(), g_browser_process->io_thread(), |
386 profile->GetRequestContext()); | 386 profile->GetRequestContext()); |
387 proxy_->AddRequestContextGetter( | 387 proxy_->AddRequestContextGetter( |
388 content::BrowserContext::GetDefaultStoragePartition(profile)-> | 388 content::BrowserContext::GetDefaultStoragePartition(profile)-> |
389 GetMediaURLRequestContext()); | 389 GetMediaURLRequestContext()); |
390 #if BUILDFLAG(ENABLE_EXTENSIONS) | |
391 proxy_->AddRequestContextGetter(profile->GetRequestContextForExtensions()); | |
392 #endif | |
393 | 390 |
394 web_ui()->RegisterMessageCallback( | 391 web_ui()->RegisterMessageCallback( |
395 "notifyReady", | 392 "notifyReady", |
396 base::Bind(&NetInternalsMessageHandler::OnRendererReady, | 393 base::Bind(&NetInternalsMessageHandler::OnRendererReady, |
397 base::Unretained(this))); | 394 base::Unretained(this))); |
398 web_ui()->RegisterMessageCallback( | 395 web_ui()->RegisterMessageCallback( |
399 "getNetInfo", | 396 "getNetInfo", |
400 base::Bind(&IOThreadImpl::CallbackHelper, | 397 base::Bind(&IOThreadImpl::CallbackHelper, |
401 &IOThreadImpl::OnGetNetInfo, proxy_)); | 398 &IOThreadImpl::OnGetNetInfo, proxy_)); |
402 web_ui()->RegisterMessageCallback( | 399 web_ui()->RegisterMessageCallback( |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 //////////////////////////////////////////////////////////////////////////////// | 1050 //////////////////////////////////////////////////////////////////////////////// |
1054 | 1051 |
1055 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) | 1052 NetInternalsUI::NetInternalsUI(content::WebUI* web_ui) |
1056 : WebUIController(web_ui) { | 1053 : WebUIController(web_ui) { |
1057 web_ui->AddMessageHandler(base::MakeUnique<NetInternalsMessageHandler>()); | 1054 web_ui->AddMessageHandler(base::MakeUnique<NetInternalsMessageHandler>()); |
1058 | 1055 |
1059 // Set up the chrome://net-internals/ source. | 1056 // Set up the chrome://net-internals/ source. |
1060 Profile* profile = Profile::FromWebUI(web_ui); | 1057 Profile* profile = Profile::FromWebUI(web_ui); |
1061 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); | 1058 content::WebUIDataSource::Add(profile, CreateNetInternalsHTMLSource()); |
1062 } | 1059 } |
OLD | NEW |