1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_SERVICE_H_ 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_SERVICE_H_ 7 #pragma once 8 9 #include "base/basictypes.h" 10 #include "chrome/browser/debugger/devtools_remote.h" 11 12 class DevToolsRemoteMessage; 13 class DevToolsProtocolHandler; 14 class DictionaryValue; 15 class Value; 16 17 // Contains constants for DevToolsRemoteService tool protocol commands. 18 struct DevToolsRemoteServiceCommand { 19 static const char kPing[]; 20 static const char kVersion[]; 21 static const char kListTabs[]; 22 }; 23 24 // Handles Chrome remote debugger protocol service commands. 25 class DevToolsRemoteService : public DevToolsRemoteListener { 26 public: 27 explicit DevToolsRemoteService(DevToolsProtocolHandler* delegate); 28 29 // DevToolsRemoteListener interface 30 virtual void HandleMessage(const DevToolsRemoteMessage& message); 31 virtual void OnConnectionLost() {} 32 33 static const char kToolName[]; 34 35 private: 36 // Operation result returned in the "result" field. 37 struct Result { 38 static const int kOk = 0; 39 static const int kUnknownCommand = 1; 40 }; 41 virtual ~DevToolsRemoteService(); 42 void ProcessJson(DictionaryValue* json, const DevToolsRemoteMessage& message); 43 DevToolsProtocolHandler* delegate_; 44 DISALLOW_COPY_AND_ASSIGN(DevToolsRemoteService); 45 }; 46 47 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_SERVICE_H_ 48