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 "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/devtools/devtools_targets_ui.h" | 9 #include "chrome/browser/devtools/devtools_targets_ui.h" |
10 #include "chrome/browser/devtools/devtools_ui_bindings.h" | 10 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| 11 #include "chrome/browser/devtools/devtools_window.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser_navigator_params.h" | 13 #include "chrome/browser/ui/browser_navigator_params.h" |
13 #include "chrome/browser/ui/singleton_tabs.h" | 14 #include "chrome/browser/ui/singleton_tabs.h" |
14 #include "chrome/browser/ui/webui/theme_source.h" | 15 #include "chrome/browser/ui/webui/theme_source.h" |
15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
17 #include "chrome/grit/browser_resources.h" | 18 #include "chrome/grit/browser_resources.h" |
18 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
19 #include "content/public/browser/devtools_agent_host.h" | 20 #include "content/public/browser/devtools_agent_host.h" |
20 #include "content/public/browser/navigation_entry.h" | 21 #include "content/public/browser/navigation_entry.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 UpdatePortForwardingConfig(); | 297 UpdatePortForwardingConfig(); |
297 UpdateTCPDiscoveryEnabled(); | 298 UpdateTCPDiscoveryEnabled(); |
298 UpdateTCPDiscoveryConfig(); | 299 UpdateTCPDiscoveryConfig(); |
299 } | 300 } |
300 | 301 |
301 void InspectUI::Inspect(const std::string& source_id, | 302 void InspectUI::Inspect(const std::string& source_id, |
302 const std::string& target_id) { | 303 const std::string& target_id) { |
303 scoped_refptr<DevToolsAgentHost> target = FindTarget(source_id, target_id); | 304 scoped_refptr<DevToolsAgentHost> target = FindTarget(source_id, target_id); |
304 if (target) { | 305 if (target) { |
305 const std::string target_type = target->GetType(); | 306 const std::string target_type = target->GetType(); |
306 target->Inspect(); | 307 Profile* profile = Profile::FromBrowserContext( |
| 308 web_ui()->GetWebContents()->GetBrowserContext()); |
| 309 DevToolsWindow::OpenDevToolsWindow(target, profile); |
307 ForceUpdateIfNeeded(source_id, target_type); | 310 ForceUpdateIfNeeded(source_id, target_type); |
308 } | 311 } |
309 } | 312 } |
310 | 313 |
311 void InspectUI::Activate(const std::string& source_id, | 314 void InspectUI::Activate(const std::string& source_id, |
312 const std::string& target_id) { | 315 const std::string& target_id) { |
313 scoped_refptr<DevToolsAgentHost> target = FindTarget(source_id, target_id); | 316 scoped_refptr<DevToolsAgentHost> target = FindTarget(source_id, target_id); |
314 if (target) { | 317 if (target) { |
315 const std::string target_type = target->GetType(); | 318 const std::string target_type = target->GetType(); |
316 target->Activate(); | 319 target->Activate(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 handler->ForceUpdate(); | 568 handler->ForceUpdate(); |
566 } | 569 } |
567 | 570 |
568 void InspectUI::PopulatePortStatus(const base::Value& status) { | 571 void InspectUI::PopulatePortStatus(const base::Value& status) { |
569 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); | 572 web_ui()->CallJavascriptFunctionUnsafe("populatePortStatus", status); |
570 } | 573 } |
571 | 574 |
572 void InspectUI::ShowIncognitoWarning() { | 575 void InspectUI::ShowIncognitoWarning() { |
573 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); | 576 web_ui()->CallJavascriptFunctionUnsafe("showIncognitoWarning"); |
574 } | 577 } |
OLD | NEW |