1 // Copyright (c) 2011 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. 4 5 // Defines the Chrome Extensions Debugger API functions for attaching debugger 6 // to the page. 7 8 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_DEBUGGER_API_H_ 9 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_DEBUGGER_API_H_ 10 #pragma once 11 12 #include <string> 13 14 #include "chrome/browser/extensions/extension_function.h" 15 16 // Base debugger function. 17 18 class DictionaryValue; 19 class ExtensionDevToolsClientHost; 20 21 class DebuggerFunction : public AsyncExtensionFunction { 22 protected: 23 DebuggerFunction(); 24 virtual ~DebuggerFunction() {} 25 26 bool InitTabContents(int tab_id); 27 bool InitClientHost(int tab_id); 28 29 TabContents* contents_; 30 ExtensionDevToolsClientHost* client_host_; 31 }; 32 33 // Implements the debugger.attach() extension function. 34 class AttachDebuggerFunction : public DebuggerFunction { 35 public: 36 AttachDebuggerFunction(); 37 ~AttachDebuggerFunction(); 38 virtual bool RunImpl(); 39 DECLARE_EXTENSION_FUNCTION_NAME("experimental.debugger.attach") 40 }; 41 42 // Implements the debugger.detach() extension function. 43 class DetachDebuggerFunction : public DebuggerFunction { 44 public: 45 DetachDebuggerFunction(); 46 ~DetachDebuggerFunction(); 47 virtual bool RunImpl(); 48 DECLARE_EXTENSION_FUNCTION_NAME("experimental.debugger.detach") 49 }; 50 51 // Implements the debugger.sendRequest() extension function. 52 class SendRequestDebuggerFunction : public DebuggerFunction { 53 public: 54 SendRequestDebuggerFunction(); 55 ~SendRequestDebuggerFunction(); 56 virtual bool RunImpl(); 57 58 void SendResponseBody(DictionaryValue* dictionary); 59 DECLARE_EXTENSION_FUNCTION_NAME("experimental.debugger.sendRequest") 60 }; 61 62 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_DEBUGGER_API_H_ 63