Chromium Code Reviews| 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)>; | 17 using Notifier = |
| 18 base::Callback<void(int session_id, const std::string& message)>; | |
|
dgozman
2015/11/06 22:57:27
I think it's better to replace this Notifier by De
kozy
2015/11/07 01:54:43
Done.
| |
| 18 | 19 |
| 19 DevToolsProtocolHandler(DevToolsAgentHost* agent_host, | 20 DevToolsProtocolHandler(DevToolsAgentHost* agent_host, |
| 20 const Notifier& notifier); | 21 const Notifier& notifier); |
| 21 virtual ~DevToolsProtocolHandler(); | 22 virtual ~DevToolsProtocolHandler(); |
| 22 | 23 |
| 23 void HandleMessage(const std::string& message); | 24 void HandleMessage(int session_id, const std::string& message); |
| 24 bool HandleOptionalMessage(const std::string& message, int* call_id); | 25 bool HandleOptionalMessage(int session_id, |
| 26 const std::string& message, | |
| 27 int* call_id); | |
| 25 | 28 |
| 26 DevToolsProtocolDispatcher* dispatcher() { return &dispatcher_; } | 29 DevToolsProtocolDispatcher* dispatcher() { return &dispatcher_; } |
| 27 | 30 |
| 28 private: | 31 private: |
| 29 scoped_ptr<base::DictionaryValue> ParseCommand(const std::string& message); | 32 scoped_ptr<base::DictionaryValue> ParseCommand(int session_id, |
| 30 bool PassCommandToDelegate(base::DictionaryValue* command); | 33 const std::string& message); |
| 31 void HandleCommand(scoped_ptr<base::DictionaryValue> command); | 34 bool PassCommandToDelegate(int session_id, base::DictionaryValue* command); |
| 32 bool HandleOptionalCommand(scoped_ptr<base::DictionaryValue> command, | 35 void HandleCommand(int session_id, scoped_ptr<base::DictionaryValue> command); |
| 36 bool HandleOptionalCommand(int session_id, | |
| 37 scoped_ptr<base::DictionaryValue> command, | |
| 33 int* call_id); | 38 int* call_id); |
| 34 | 39 |
| 35 DevToolsAgentHost* agent_host_; | 40 DevToolsAgentHost* agent_host_; |
| 36 DevToolsProtocolClient client_; | 41 DevToolsProtocolClient client_; |
| 37 DevToolsProtocolDispatcher dispatcher_; | 42 DevToolsProtocolDispatcher dispatcher_; |
| 38 }; | 43 }; |
| 39 | 44 |
| 40 } // namespace content | 45 } // namespace content |
| 41 | 46 |
| 42 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ | 47 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ |
| OLD | NEW |