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_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_
8 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h"
12 class DevToolsAgentHost
;
14 class DevToolsProtocolHandler
{
16 using Response
= DevToolsProtocolClient::Response
;
17 using Notifier
= base::Callback
<void(const std::string
& message
)>;
19 DevToolsProtocolHandler(DevToolsAgentHost
* agent_host
,
20 const Notifier
& notifier
);
21 virtual ~DevToolsProtocolHandler();
23 void HandleMessage(const std::string
& message
);
24 bool HandleOptionalMessage(const std::string
& message
, int* call_id
);
26 DevToolsProtocolDispatcher
* dispatcher() { return &dispatcher_
; }
29 scoped_ptr
<base::DictionaryValue
> ParseCommand(const std::string
& message
);
30 bool PassCommandToDelegate(base::DictionaryValue
* command
);
31 void HandleCommand(scoped_ptr
<base::DictionaryValue
> command
);
32 bool HandleOptionalCommand(scoped_ptr
<base::DictionaryValue
> command
,
35 DevToolsAgentHost
* agent_host_
;
36 DevToolsProtocolClient client_
;
37 DevToolsProtocolDispatcher dispatcher_
;
40 } // namespace content
42 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_