| 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 base { |
| 11 class Value; |
| 12 } |
| 13 |
| 10 namespace content { | 14 namespace content { |
| 11 | 15 |
| 12 class DevToolsAgentHost; | 16 class DevToolsAgentHost; |
| 13 class DevToolsAgentHostImpl; | 17 class DevToolsAgentHostImpl; |
| 14 | 18 |
| 15 class DevToolsProtocolHandler { | 19 class DevToolsProtocolHandler { |
| 16 public: | 20 public: |
| 17 using Response = DevToolsProtocolClient::Response; | 21 using Response = DevToolsProtocolClient::Response; |
| 18 | 22 |
| 19 explicit DevToolsProtocolHandler(DevToolsAgentHostImpl* agent_host); | 23 explicit DevToolsProtocolHandler(DevToolsAgentHostImpl* agent_host); |
| 20 virtual ~DevToolsProtocolHandler(); | 24 virtual ~DevToolsProtocolHandler(); |
| 21 | 25 |
| 22 void HandleMessage(int session_id, const std::string& message); | 26 void HandleMessage(int session_id, std::unique_ptr<base::Value> message); |
| 23 bool HandleOptionalMessage(int session_id, | 27 bool HandleOptionalMessage(int session_id, |
| 24 const std::string& message, | 28 std::unique_ptr<base::Value> message, |
| 25 int* call_id, | 29 int* call_id, |
| 26 std::string* method); | 30 std::string* method); |
| 27 | 31 |
| 28 DevToolsProtocolDispatcher* dispatcher() { return &dispatcher_; } | 32 DevToolsProtocolDispatcher* dispatcher() { return &dispatcher_; } |
| 29 | 33 |
| 30 private: | 34 private: |
| 31 std::unique_ptr<base::DictionaryValue> ParseCommand( | 35 std::unique_ptr<base::DictionaryValue> ParseCommand( |
| 32 int session_id, | 36 int session_id, |
| 33 const std::string& message); | 37 std::unique_ptr<base::Value> message); |
| 34 bool PassCommandToDelegate(int session_id, base::DictionaryValue* command); | 38 bool PassCommandToDelegate(int session_id, base::DictionaryValue* command); |
| 35 void HandleCommand(int session_id, | 39 void HandleCommand(int session_id, |
| 36 std::unique_ptr<base::DictionaryValue> command); | 40 std::unique_ptr<base::DictionaryValue> command); |
| 37 bool HandleOptionalCommand(int session_id, | 41 bool HandleOptionalCommand(int session_id, |
| 38 std::unique_ptr<base::DictionaryValue> command, | 42 std::unique_ptr<base::DictionaryValue> command, |
| 39 int* call_id, | 43 int* call_id, |
| 40 std::string* method); | 44 std::string* method); |
| 41 | 45 |
| 42 DevToolsAgentHost* agent_host_; | 46 DevToolsAgentHost* agent_host_; |
| 43 DevToolsProtocolClient client_; | 47 DevToolsProtocolClient client_; |
| 44 DevToolsProtocolDispatcher dispatcher_; | 48 DevToolsProtocolDispatcher dispatcher_; |
| 45 }; | 49 }; |
| 46 | 50 |
| 47 } // namespace content | 51 } // namespace content |
| 48 | 52 |
| 49 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ | 53 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ |
| OLD | NEW |