OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ |
7 | 7 |
8 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" | 8 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 class DevToolsAgentHost; | 12 class DevToolsAgentHost; |
13 | 13 |
14 class DevToolsProtocolHandler { | 14 class DevToolsProtocolHandler { |
15 public: | 15 public: |
16 using Response = DevToolsProtocolClient::Response; | 16 using Response = DevToolsProtocolClient::Response; |
17 using Notifier = base::Callback<void(const std::string& message)>; | |
18 | 17 |
19 DevToolsProtocolHandler(DevToolsAgentHost* agent_host, | 18 DevToolsProtocolHandler(DevToolsAgentHost* agent_host, |
dgozman
2015/11/07 02:28:40
Accept a single DevToolsAgentHostImpl* parameter.
kozy
2015/11/07 03:02:35
Done.
| |
20 const Notifier& notifier); | 19 DevToolsProtocolDelegate* notifier); |
21 virtual ~DevToolsProtocolHandler(); | 20 virtual ~DevToolsProtocolHandler(); |
22 | 21 |
23 void HandleMessage(const std::string& message); | 22 void HandleMessage(int session_id, const std::string& message); |
24 bool HandleOptionalMessage(const std::string& message, int* call_id); | 23 bool HandleOptionalMessage(int session_id, |
24 const std::string& message, | |
25 int* call_id); | |
25 | 26 |
26 DevToolsProtocolDispatcher* dispatcher() { return &dispatcher_; } | 27 DevToolsProtocolDispatcher* dispatcher() { return &dispatcher_; } |
27 | 28 |
28 private: | 29 private: |
29 scoped_ptr<base::DictionaryValue> ParseCommand(const std::string& message); | 30 scoped_ptr<base::DictionaryValue> ParseCommand(int session_id, |
30 bool PassCommandToDelegate(base::DictionaryValue* command); | 31 const std::string& message); |
31 void HandleCommand(scoped_ptr<base::DictionaryValue> command); | 32 bool PassCommandToDelegate(int session_id, base::DictionaryValue* command); |
32 bool HandleOptionalCommand(scoped_ptr<base::DictionaryValue> command, | 33 void HandleCommand(int session_id, scoped_ptr<base::DictionaryValue> command); |
34 bool HandleOptionalCommand(int session_id, | |
35 scoped_ptr<base::DictionaryValue> command, | |
33 int* call_id); | 36 int* call_id); |
34 | 37 |
35 DevToolsAgentHost* agent_host_; | 38 DevToolsAgentHost* agent_host_; |
36 DevToolsProtocolClient client_; | 39 DevToolsProtocolClient client_; |
37 DevToolsProtocolDispatcher dispatcher_; | 40 DevToolsProtocolDispatcher dispatcher_; |
38 }; | 41 }; |
39 | 42 |
40 } // namespace content | 43 } // namespace content |
41 | 44 |
42 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ | 45 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ |
OLD | NEW |