summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_debugger_api.h
blob: 74d8c8bf3a5d7c72f70485874783b1839753dbf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Defines the Chrome Extensions Debugger API functions for attaching debugger
// to the page.

#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DEBUGGER_API_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_DEBUGGER_API_H_

#include <string>

#include "chrome/browser/extensions/extension_function.h"

// Base debugger function.

class ExtensionDevToolsClientHost;

namespace base {
class DictionaryValue;
}

namespace content {
class WebContents;
}

class DebuggerFunction : public AsyncExtensionFunction {
 protected:
  DebuggerFunction();
  virtual ~DebuggerFunction() {}

  bool InitTabContents();
  bool InitClientHost();

  content::WebContents* contents_;
  int tab_id_;
  ExtensionDevToolsClientHost* client_host_;
};

// Implements the debugger.attach() extension function.
class AttachDebuggerFunction : public DebuggerFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("debugger.attach")

  AttachDebuggerFunction();

 protected:
  virtual ~AttachDebuggerFunction();

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

// Implements the debugger.detach() extension function.
class DetachDebuggerFunction : public DebuggerFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("debugger.detach")

  DetachDebuggerFunction();

 protected:
  virtual ~DetachDebuggerFunction();

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

// Implements the debugger.sendCommand() extension function.
class SendCommandDebuggerFunction : public DebuggerFunction {
 public:
  DECLARE_EXTENSION_FUNCTION_NAME("debugger.sendCommand")

  SendCommandDebuggerFunction();
  void SendResponseBody(base::DictionaryValue* dictionary);

 protected:
  virtual ~SendCommandDebuggerFunction();

  // ExtensionFunction:
  virtual bool RunImpl() OVERRIDE;
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEBUGGER_API_H_