Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / chrome / browser / devtools / chrome_devtools_manager_delegate.cc
blob4683243a6393cbaad51d153946f9c44f7d83d172
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 "chrome/browser/devtools/devtools_network_protocol_handler.h"
9 #if !defined(OS_ANDROID)
10 #include "chrome/browser/devtools/devtools_window.h"
11 #include "chrome/browser/profiles/profile.h"
12 #include "content/public/browser/devtools_agent_host.h"
13 #endif // !defined(OS_ANDROID)
15 ChromeDevToolsManagerDelegate::ChromeDevToolsManagerDelegate()
16 : network_protocol_handler_(new DevToolsNetworkProtocolHandler()) {
19 ChromeDevToolsManagerDelegate::~ChromeDevToolsManagerDelegate() {
22 void ChromeDevToolsManagerDelegate::Inspect(
23 content::BrowserContext* browser_context,
24 content::DevToolsAgentHost* agent_host) {
25 #if !defined(OS_ANDROID)
26 content::DevToolsAgentHost::Type type = agent_host->GetType();
27 if (type != content::DevToolsAgentHost::TYPE_SHARED_WORKER &&
28 type != content::DevToolsAgentHost::TYPE_SERVICE_WORKER) {
29 // TODO(horo): Support other types of DevToolsAgentHost when necessary.
30 NOTREACHED() << "Inspect() only supports workers.";
32 if (Profile* profile = Profile::FromBrowserContext(browser_context))
33 DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host);
34 #endif // !defined(OS_ANDROID)
37 base::DictionaryValue* ChromeDevToolsManagerDelegate::HandleCommand(
38 content::DevToolsAgentHost* agent_host,
39 base::DictionaryValue* command_dict) {
40 return network_protocol_handler_->HandleCommand(agent_host, command_dict);
43 void ChromeDevToolsManagerDelegate::DevToolsAgentStateChanged(
44 content::DevToolsAgentHost* agent_host,
45 bool attached) {
46 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, attached);