| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_ui.h" | 5 #include "chrome/browser/ui/webui/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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 proxy_.get()->OnWebUIDeleted(); | 458 proxy_.get()->OnWebUIDeleted(); |
| 459 // Notify the handler on the IO thread that the renderer is gone. | 459 // Notify the handler on the IO thread that the renderer is gone. |
| 460 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 460 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 461 NewRunnableMethod(proxy_.get(), &IOThreadImpl::Detach)); | 461 NewRunnableMethod(proxy_.get(), &IOThreadImpl::Detach)); |
| 462 } | 462 } |
| 463 } | 463 } |
| 464 | 464 |
| 465 WebUIMessageHandler* NetInternalsMessageHandler::Attach(WebUI* web_ui) { | 465 WebUIMessageHandler* NetInternalsMessageHandler::Attach(WebUI* web_ui) { |
| 466 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 466 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 467 | 467 |
| 468 PrefService* pref_service = web_ui->GetProfile()->GetPrefs(); | 468 Profile* profile = Profile::FromWebUI(web_ui); |
| 469 PrefService* pref_service = profile->GetPrefs(); |
| 469 http_throttling_enabled_.Init( | 470 http_throttling_enabled_.Init( |
| 470 prefs::kHttpThrottlingEnabled, pref_service, this); | 471 prefs::kHttpThrottlingEnabled, pref_service, this); |
| 471 http_throttling_may_experiment_.Init( | 472 http_throttling_may_experiment_.Init( |
| 472 prefs::kHttpThrottlingMayExperiment, pref_service, NULL); | 473 prefs::kHttpThrottlingMayExperiment, pref_service, NULL); |
| 473 | 474 |
| 474 proxy_ = new IOThreadImpl(this->AsWeakPtr(), g_browser_process->io_thread(), | 475 proxy_ = new IOThreadImpl(this->AsWeakPtr(), g_browser_process->io_thread(), |
| 475 web_ui->GetProfile()->GetRequestContext()); | 476 profile->GetRequestContext()); |
| 476 #ifdef OS_CHROMEOS | 477 #ifdef OS_CHROMEOS |
| 477 syslogs_getter_.reset(new SystemLogsGetter(this, | 478 syslogs_getter_.reset(new SystemLogsGetter(this, |
| 478 chromeos::system::SyslogsProvider::GetInstance())); | 479 chromeos::system::SyslogsProvider::GetInstance())); |
| 479 #endif | 480 #endif |
| 480 renderer_ready_io_callback_.reset( | 481 renderer_ready_io_callback_.reset( |
| 481 proxy_->CreateCallback(&IOThreadImpl::OnRendererReady)); | 482 proxy_->CreateCallback(&IOThreadImpl::OnRendererReady)); |
| 482 | 483 |
| 483 prerender::PrerenderManager* prerender_manager = | 484 prerender::PrerenderManager* prerender_manager = |
| 484 web_ui->GetProfile()->GetPrerenderManager(); | 485 profile->GetPrerenderManager(); |
| 485 if (prerender_manager) { | 486 if (prerender_manager) { |
| 486 prerender_manager_ = prerender_manager->AsWeakPtr(); | 487 prerender_manager_ = prerender_manager->AsWeakPtr(); |
| 487 } else { | 488 } else { |
| 488 prerender_manager_ = base::WeakPtr<prerender::PrerenderManager>(); | 489 prerender_manager_ = base::WeakPtr<prerender::PrerenderManager>(); |
| 489 } | 490 } |
| 490 | 491 |
| 491 WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui); | 492 WebUIMessageHandler* result = WebUIMessageHandler::Attach(web_ui); |
| 492 return result; | 493 return result; |
| 493 } | 494 } |
| 494 | 495 |
| (...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 return constants_dict; | 1558 return constants_dict; |
| 1558 } | 1559 } |
| 1559 | 1560 |
| 1560 NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) { | 1561 NetInternalsUI::NetInternalsUI(TabContents* contents) : ChromeWebUI(contents) { |
| 1561 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); | 1562 AddMessageHandler((new NetInternalsMessageHandler())->Attach(this)); |
| 1562 | 1563 |
| 1563 // Set up the chrome://net-internals/ source. | 1564 // Set up the chrome://net-internals/ source. |
| 1564 GetProfile()->GetChromeURLDataManager()->AddDataSource( | 1565 GetProfile()->GetChromeURLDataManager()->AddDataSource( |
| 1565 CreateNetInternalsHTMLSource()); | 1566 CreateNetInternalsHTMLSource()); |
| 1566 } | 1567 } |
| OLD | NEW |