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 // Defines the Chrome Extensions Debugger API functions for attaching debugger | 5 // Defines the Chrome Extensions Debugger API functions for attaching debugger |
6 // to the page. | 6 // to the page. |
7 | 7 |
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_ | 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_ |
9 #define CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_ | 9 #define CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_ |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "chrome/browser/extensions/extension_function.h" | 13 #include "chrome/browser/extensions/extension_function.h" |
14 #include "chrome/common/extensions/api/debugger.h" | 14 #include "chrome/common/extensions/api/debugger.h" |
15 | 15 |
16 using extensions::api::debugger::Debuggee; | 16 using extensions::api::debugger::Debuggee; |
17 | 17 |
18 // Base debugger function. | 18 // Base debugger function. |
19 | 19 |
20 class ExtensionDevToolsClientHost; | 20 class ExtensionDevToolsClientHost; |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class DictionaryValue; | 23 class DictionaryValue; |
24 } | 24 } |
25 | 25 |
26 namespace content { | 26 namespace content { |
27 class DevToolsClientHost; | 27 class DevToolsAgentHost; |
28 class WebContents; | 28 class WebContents; |
29 } | 29 } |
30 | 30 |
31 class DebuggerFunction : public AsyncExtensionFunction { | 31 class DebuggerFunction : public AsyncExtensionFunction { |
32 protected: | 32 protected: |
33 DebuggerFunction(); | 33 DebuggerFunction(); |
34 virtual ~DebuggerFunction() {} | 34 virtual ~DebuggerFunction(); |
35 | 35 |
36 void FormatErrorMessage(const std::string& format); | 36 void FormatErrorMessage(const std::string& format); |
37 | 37 |
38 bool InitWebContents(); | 38 bool InitAgentHost(); |
39 bool InitClientHost(); | 39 bool InitClientHost(); |
40 | 40 |
41 content::WebContents* contents_; | |
42 Debuggee debuggee_; | 41 Debuggee debuggee_; |
| 42 scoped_refptr<content::DevToolsAgentHost> agent_host_; |
43 ExtensionDevToolsClientHost* client_host_; | 43 ExtensionDevToolsClientHost* client_host_; |
44 }; | 44 }; |
45 | 45 |
46 // Implements the debugger.attach() extension function. | 46 // Implements the debugger.attach() extension function. |
47 class DebuggerAttachFunction : public DebuggerFunction { | 47 class DebuggerAttachFunction : public DebuggerFunction { |
48 public: | 48 public: |
49 DECLARE_EXTENSION_FUNCTION("debugger.attach", DEBUGGER_ATTACH) | 49 DECLARE_EXTENSION_FUNCTION("debugger.attach", DEBUGGER_ATTACH) |
50 | 50 |
51 DebuggerAttachFunction(); | 51 DebuggerAttachFunction(); |
52 | 52 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 public: | 91 public: |
92 DECLARE_EXTENSION_FUNCTION("debugger.getTargets", DEBUGGER_ATTACH) | 92 DECLARE_EXTENSION_FUNCTION("debugger.getTargets", DEBUGGER_ATTACH) |
93 | 93 |
94 DebuggerGetTargetsFunction(); | 94 DebuggerGetTargetsFunction(); |
95 | 95 |
96 protected: | 96 protected: |
97 virtual ~DebuggerGetTargetsFunction(); | 97 virtual ~DebuggerGetTargetsFunction(); |
98 | 98 |
99 // ExtensionFunction: | 99 // ExtensionFunction: |
100 virtual bool RunImpl() OVERRIDE; | 100 virtual bool RunImpl() OVERRIDE; |
| 101 |
| 102 private: |
| 103 void CollectWorkerInfo(base::ListValue* list); |
| 104 |
| 105 void SendTargetList(base::ListValue* list); |
101 }; | 106 }; |
102 | 107 |
103 #endif // CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_ | 108 #endif // CHROME_BROWSER_EXTENSIONS_API_DEBUGGER_DEBUGGER_API_H_ |
OLD | NEW |