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 DevToolsTargetImpl;
24 class DictionaryValue;
28 class DevToolsAgentHost;
32 namespace extensions {
33 class ExtensionDevToolsClientHost;
35 class DebuggerFunction : public ChromeAsyncExtensionFunction {
38 virtual ~DebuggerFunction();
40 void FormatErrorMessage(const std::string& format);
43 bool InitClientHost();
46 scoped_refptr<content::DevToolsAgentHost> agent_host_;
47 ExtensionDevToolsClientHost* client_host_;
50 // Implements the debugger.attach() extension function.
51 class DebuggerAttachFunction : public DebuggerFunction {
53 DECLARE_EXTENSION_FUNCTION("debugger.attach", DEBUGGER_ATTACH)
55 DebuggerAttachFunction();
58 virtual ~DebuggerAttachFunction();
61 virtual bool RunAsync() OVERRIDE;
64 // Implements the debugger.detach() extension function.
65 class DebuggerDetachFunction : public DebuggerFunction {
67 DECLARE_EXTENSION_FUNCTION("debugger.detach", DEBUGGER_DETACH)
69 DebuggerDetachFunction();
72 virtual ~DebuggerDetachFunction();
75 virtual bool RunAsync() OVERRIDE;
78 // Implements the debugger.sendCommand() extension function.
79 class DebuggerSendCommandFunction : public DebuggerFunction {
81 DECLARE_EXTENSION_FUNCTION("debugger.sendCommand", DEBUGGER_SENDCOMMAND)
83 DebuggerSendCommandFunction();
84 void SendResponseBody(base::DictionaryValue* result);
87 virtual ~DebuggerSendCommandFunction();
90 virtual bool RunAsync() OVERRIDE;
93 // Implements the debugger.getTargets() extension function.
94 class DebuggerGetTargetsFunction : public DebuggerFunction {
96 DECLARE_EXTENSION_FUNCTION("debugger.getTargets", DEBUGGER_ATTACH)
98 DebuggerGetTargetsFunction();
101 virtual ~DebuggerGetTargetsFunction();
103 // ExtensionFunction:
104 virtual bool RunAsync() OVERRIDE;
107 void SendTargetList(const std::vector<DevToolsTargetImpl*>& target_list);
110 } // namespace extensions
112 #endif // CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_