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/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "chrome/browser/devtools/devtools_window.h" | 17 #include "chrome/browser/devtools/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/tab_contents/tab_contents_iterator.h" | 20 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 21 #include "chrome/browser/ui/webui/theme_source.h" |
21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
22 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/child_process_data.h" | 25 #include "content/public/browser/child_process_data.h" |
25 #include "content/public/browser/devtools_agent_host.h" | 26 #include "content/public/browser/devtools_agent_host.h" |
26 #include "content/public/browser/devtools_client_host.h" | 27 #include "content/public/browser/devtools_client_host.h" |
27 #include "content/public/browser/devtools_manager.h" | 28 #include "content/public/browser/devtools_manager.h" |
28 #include "content/public/browser/favicon_status.h" | 29 #include "content/public/browser/favicon_status.h" |
29 #include "content/public/browser/navigation_entry.h" | 30 #include "content/public/browser/navigation_entry.h" |
30 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 } | 386 } |
386 | 387 |
387 InspectUI* discovery_ui_; | 388 InspectUI* discovery_ui_; |
388 }; | 389 }; |
389 | 390 |
390 InspectUI::InspectUI(content::WebUI* web_ui) | 391 InspectUI::InspectUI(content::WebUI* web_ui) |
391 : WebUIController(web_ui) { | 392 : WebUIController(web_ui) { |
392 web_ui->AddMessageHandler(new InspectMessageHandler(this)); | 393 web_ui->AddMessageHandler(new InspectMessageHandler(this)); |
393 Profile* profile = Profile::FromWebUI(web_ui); | 394 Profile* profile = Profile::FromWebUI(web_ui); |
394 content::WebUIDataSource::Add(profile, CreateInspectUIHTMLSource()); | 395 content::WebUIDataSource::Add(profile, CreateInspectUIHTMLSource()); |
| 396 |
| 397 // Set up the chrome://theme/ source. |
| 398 ThemeSource* theme = new ThemeSource(profile); |
| 399 content::URLDataSource::Add(profile, theme); |
395 } | 400 } |
396 | 401 |
397 InspectUI::~InspectUI() { | 402 InspectUI::~InspectUI() { |
398 StopListeningNotifications(); | 403 StopListeningNotifications(); |
399 } | 404 } |
400 | 405 |
401 void InspectUI::InitUI() { | 406 void InspectUI::InitUI() { |
402 StartListeningNotifications(); | 407 StartListeningNotifications(); |
403 PopulateLists(); | 408 PopulateLists(); |
404 UpdatePortForwardingEnabled(); | 409 UpdatePortForwardingEnabled(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", *value); | 549 web_ui()->CallJavascriptFunction("updatePortForwardingEnabled", *value); |
545 | 550 |
546 } | 551 } |
547 | 552 |
548 void InspectUI::UpdatePortForwardingConfig() { | 553 void InspectUI::UpdatePortForwardingConfig() { |
549 Profile* profile = Profile::FromWebUI(web_ui()); | 554 Profile* profile = Profile::FromWebUI(web_ui()); |
550 const base::Value* value = profile->GetPrefs()->FindPreference( | 555 const base::Value* value = profile->GetPrefs()->FindPreference( |
551 prefs::kDevToolsPortForwardingConfig)->GetValue(); | 556 prefs::kDevToolsPortForwardingConfig)->GetValue(); |
552 web_ui()->CallJavascriptFunction("updatePortForwardingConfig", *value); | 557 web_ui()->CallJavascriptFunction("updatePortForwardingConfig", *value); |
553 } | 558 } |
OLD | NEW |