Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: content/browser/devtools/protocol/devtools_protocol_client.h

Issue 508973003: DevTools: Protocol handler generator for content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Allow command->params()==NULL Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_CLIENT_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_CLIENT_H_
7
8 #include "content/browser/devtools/devtools_protocol.h"
9
10 namespace content {
11
12 class DevToolsProtocolClient {
13 public:
14 typedef base::Callback<void(const std::string& event,
15 base::DictionaryValue* params)> EventCallback;
16
17 typedef base::Callback<void(scoped_refptr<DevToolsProtocol::Response>)>
18 ResponseCallback;
19
20 enum ResponseStatus {
21 RESPONSE_STATUS_FALLTHROUGH,
22 RESPONSE_STATUS_OK,
23 RESPONSE_STATUS_INVALID_PARAMS,
24 RESPONSE_STATUS_INTERNAL_ERROR,
25 RESPONSE_STATUS_SERVER_ERROR,
26 };
27
28 struct Response {
29 public:
30 static Response FallThrough();
31 static Response OK();
32 static Response InvalidParams(const std::string& message);
33 static Response InternalError(const std::string& message);
34 static Response ServerError(const std::string& message);
35
36 ResponseStatus status() const;
37 const std::string& message() const;
38
39 private:
40 Response();
41
42 ResponseStatus status_;
43 std::string message_;
44 };
45
46 void SendInvalidParamsResponse(
47 scoped_refptr<DevToolsProtocol::Command> command,
48 const std::string& message);
49 void SendInternalErrorResponse(
50 scoped_refptr<DevToolsProtocol::Command> command,
51 const std::string& message);
52 void SendServerErrorResponse(
53 scoped_refptr<DevToolsProtocol::Command> command,
54 const std::string& message);
55
56 protected:
57 DevToolsProtocolClient(const EventCallback& event_callback,
58 const ResponseCallback& response_callback);
59
60 virtual ~DevToolsProtocolClient();
61
62 void SendNotification(const std::string& method,
63 base::DictionaryValue* params);
64
65 void SendAsyncResponse(scoped_refptr<DevToolsProtocol::Response> response);
66
67 private:
68 EventCallback event_callback_;
69 ResponseCallback response_callback_;
70
71 DISALLOW_COPY_AND_ASSIGN(DevToolsProtocolClient);
72 };
73
74 } // namespace content
75
76 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_CLIENT_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/devtools.gyp ('k') | content/browser/devtools/protocol/devtools_protocol_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698