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
3 // found in the LICENSE file.
5 // Defines the Chrome Extensions Debugger API functions for attaching debugger
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_
9 #define CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_
14 #include "chrome/browser/extensions/chrome_extension_function.h"
15 #include "chrome/common/extensions/api/debugger.h"
17 using extensions::api::debugger::Debuggee;
19 // Base debugger function.
21 class ExtensionDevToolsClientHost;
22 class DevToolsTargetImpl;
25 class DictionaryValue;
29 class DevToolsAgentHost;
33 class DebuggerFunction : public ChromeAsyncExtensionFunction {
36 virtual ~DebuggerFunction();
38 void FormatErrorMessage(const std::string& format);
41 bool InitClientHost();
44 scoped_refptr<content::DevToolsAgentHost> agent_host_;
45 ExtensionDevToolsClientHost* client_host_;
48 // Implements the debugger.attach() extension function.
49 class DebuggerAttachFunction : public DebuggerFunction {
51 DECLARE_EXTENSION_FUNCTION("debugger.attach", DEBUGGER_ATTACH)
53 DebuggerAttachFunction();
56 virtual ~DebuggerAttachFunction();
59 virtual bool RunImpl() OVERRIDE;
62 // Implements the debugger.detach() extension function.
63 class DebuggerDetachFunction : public DebuggerFunction {
65 DECLARE_EXTENSION_FUNCTION("debugger.detach", DEBUGGER_DETACH)
67 DebuggerDetachFunction();
70 virtual ~DebuggerDetachFunction();
73 virtual bool RunImpl() OVERRIDE;
76 // Implements the debugger.sendCommand() extension function.
77 class DebuggerSendCommandFunction : public DebuggerFunction {
79 DECLARE_EXTENSION_FUNCTION("debugger.sendCommand", DEBUGGER_SENDCOMMAND)
81 DebuggerSendCommandFunction();
82 void SendResponseBody(base::DictionaryValue* result);
85 virtual ~DebuggerSendCommandFunction();
88 virtual bool RunImpl() OVERRIDE;
91 // Implements the debugger.getTargets() extension function.
92 class DebuggerGetTargetsFunction : public DebuggerFunction {
94 DECLARE_EXTENSION_FUNCTION("debugger.getTargets", DEBUGGER_ATTACH)
96 DebuggerGetTargetsFunction();
99 virtual ~DebuggerGetTargetsFunction();
101 // ExtensionFunction:
102 virtual bool RunImpl() OVERRIDE;
105 void SendTargetList(const std::vector<DevToolsTargetImpl*>& target_list);
108 #endif // CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_