1 // Copyright 2014 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 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_CLIENT_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_CLIENT_H_
8 #include "content/browser/devtools/devtools_protocol.h"
12 class DevToolsProtocolClient {
14 typedef base::Callback<void(const std::string& message)>
18 RESPONSE_STATUS_FALLTHROUGH,
20 RESPONSE_STATUS_INVALID_PARAMS,
21 RESPONSE_STATUS_INTERNAL_ERROR,
22 RESPONSE_STATUS_SERVER_ERROR,
27 static Response FallThrough();
29 static Response InvalidParams(const std::string& message);
30 static Response InternalError(const std::string& message);
31 static Response ServerError(const std::string& message);
33 ResponseStatus status() const;
34 const std::string& message() const;
39 ResponseStatus status_;
43 void SendInvalidParamsResponse(
44 scoped_refptr<DevToolsProtocol::Command> command,
45 const std::string& message);
46 void SendInternalErrorResponse(
47 scoped_refptr<DevToolsProtocol::Command> command,
48 const std::string& message);
49 void SendServerErrorResponse(
50 scoped_refptr<DevToolsProtocol::Command> command,
51 const std::string& message);
53 // Sends message to client, the caller is presumed to properly
54 // format the message. Do not use unless you must.
55 void SendRawMessage(const std::string& message);
58 DevToolsProtocolClient(const RawMessageCallback& raw_message_callback);
60 virtual ~DevToolsProtocolClient();
62 void SendNotification(const std::string& method,
63 base::DictionaryValue* params);
65 void SendAsyncResponse(scoped_refptr<DevToolsProtocol::Response> response);
68 RawMessageCallback raw_message_callback_;
70 DISALLOW_COPY_AND_ASSIGN(DevToolsProtocolClient);
73 } // namespace content
75 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_CLIENT_H_