1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h"
7 #include "base/values.h"
8 #include "chrome/browser/devtools/devtools_window.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "content/public/browser/devtools_agent_host.h"
12 ChromeDevToolsManagerDelegate::ChromeDevToolsManagerDelegate()
13 : network_protocol_handler_(new DevToolsNetworkProtocolHandler()) {
16 ChromeDevToolsManagerDelegate::~ChromeDevToolsManagerDelegate() {
19 void ChromeDevToolsManagerDelegate::Inspect(
20 content::BrowserContext
* browser_context
,
21 content::DevToolsAgentHost
* agent_host
) {
22 if (!agent_host
->IsWorker()) {
23 // TODO(horo): Support other types of DevToolsAgentHost when necessary.
24 NOTREACHED() << "Inspect() only supports workers.";
26 #if !defined(OS_ANDROID)
27 if (Profile
* profile
= Profile::FromBrowserContext(browser_context
))
28 DevToolsWindow::OpenDevToolsWindowForWorker(profile
, agent_host
);
32 base::DictionaryValue
* ChromeDevToolsManagerDelegate::HandleCommand(
33 content::DevToolsAgentHost
* agent_host
,
34 base::DictionaryValue
* command_dict
) {
35 return network_protocol_handler_
->HandleCommand(agent_host
, command_dict
);
38 void ChromeDevToolsManagerDelegate::DevToolsAgentStateChanged(
39 content::DevToolsAgentHost
* agent_host
,
41 network_protocol_handler_
->DevToolsAgentStateChanged(agent_host
, attached
);