| 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/inspect_ui.h" | 5 #include "chrome/browser/ui/webui/inspect_ui.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "base/memory/ref_counted_memory.h" | 12 #include "base/memory/ref_counted_memory.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/debugger/devtools_window.h" | 17 #include "chrome/browser/debugger/devtools_window.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/browser_list.h" | 20 #include "chrome/browser/ui/browser_list.h" |
| 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 22 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" | 22 #include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h" |
| 23 #include "chrome/browser/ui/webui/chrome_url_data_manager_factory.h" |
| 23 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" | 24 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" |
| 24 #include "chrome/common/url_constants.h" | 25 #include "chrome/common/url_constants.h" |
| 25 #include "content/public/browser/child_process_data.h" | 26 #include "content/public/browser/child_process_data.h" |
| 26 #include "content/public/browser/devtools_agent_host_registry.h" | 27 #include "content/public/browser/devtools_agent_host_registry.h" |
| 27 #include "content/public/browser/devtools_client_host.h" | 28 #include "content/public/browser/devtools_client_host.h" |
| 28 #include "content/public/browser/devtools_manager.h" | 29 #include "content/public/browser/devtools_manager.h" |
| 29 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 30 #include "content/public/browser/favicon_status.h" | 31 #include "content/public/browser/favicon_status.h" |
| 31 #include "content/public/browser/navigation_entry.h" | 32 #include "content/public/browser/navigation_entry.h" |
| 32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 }; | 376 }; |
| 376 | 377 |
| 377 InspectUI::InspectUI(content::WebUI* web_ui) | 378 InspectUI::InspectUI(content::WebUI* web_ui) |
| 378 : WebUIController(web_ui), | 379 : WebUIController(web_ui), |
| 379 observer_(new WorkerCreationDestructionListener(this)) { | 380 observer_(new WorkerCreationDestructionListener(this)) { |
| 380 web_ui->AddMessageHandler(new InspectMessageHandler()); | 381 web_ui->AddMessageHandler(new InspectMessageHandler()); |
| 381 | 382 |
| 382 InspectDataSource* html_source = new InspectDataSource(); | 383 InspectDataSource* html_source = new InspectDataSource(); |
| 383 | 384 |
| 384 Profile* profile = Profile::FromWebUI(web_ui); | 385 Profile* profile = Profile::FromWebUI(web_ui); |
| 385 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 386 ChromeURLDataManagerFactory::GetForProfile(profile)-> |
| 387 AddDataSource(html_source); |
| 386 | 388 |
| 387 registrar_.Add(this, | 389 registrar_.Add(this, |
| 388 content::NOTIFICATION_WEB_CONTENTS_CONNECTED, | 390 content::NOTIFICATION_WEB_CONTENTS_CONNECTED, |
| 389 content::NotificationService::AllSources()); | 391 content::NotificationService::AllSources()); |
| 390 registrar_.Add(this, | 392 registrar_.Add(this, |
| 391 content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, | 393 content::NOTIFICATION_WEB_CONTENTS_DISCONNECTED, |
| 392 content::NotificationService::AllSources()); | 394 content::NotificationService::AllSources()); |
| 393 registrar_.Add(this, | 395 registrar_.Add(this, |
| 394 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 396 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 395 content::NotificationService::AllSources()); | 397 content::NotificationService::AllSources()); |
| 396 } | 398 } |
| 397 | 399 |
| 398 InspectUI::~InspectUI() { | 400 InspectUI::~InspectUI() { |
| 399 observer_->InspectUIDestroyed(); | 401 observer_->InspectUIDestroyed(); |
| 400 observer_ = NULL; | 402 observer_ = NULL; |
| 401 } | 403 } |
| 402 | 404 |
| 403 void InspectUI::RefreshUI() { | 405 void InspectUI::RefreshUI() { |
| 404 web_ui()->CallJavascriptFunction("populateLists"); | 406 web_ui()->CallJavascriptFunction("populateLists"); |
| 405 } | 407 } |
| 406 | 408 |
| 407 void InspectUI::Observe(int type, | 409 void InspectUI::Observe(int type, |
| 408 const content::NotificationSource& source, | 410 const content::NotificationSource& source, |
| 409 const content::NotificationDetails& details) { | 411 const content::NotificationDetails& details) { |
| 410 RefreshUI(); | 412 RefreshUI(); |
| 411 } | 413 } |
| OLD | NEW |