Chromium Code Reviews| Index: content/browser/devtools/devtools_protocol.cc |
| diff --git a/content/browser/devtools/devtools_protocol.cc b/content/browser/devtools/devtools_protocol.cc |
| index 152a04ed26b1d638a1ef11aba994ab02af8ce82b..88e9571aa857b47a5a1b7ff97e43893aba28c657 100644 |
| --- a/content/browser/devtools/devtools_protocol.cc |
| +++ b/content/browser/devtools/devtools_protocol.cc |
| @@ -118,6 +118,35 @@ std::string DevToolsProtocol::Notification::Serialize() { |
| return json_notification; |
| } |
| +DevToolsProtocol::Handler::~Handler() { |
| +} |
| + |
| +DevToolsProtocol::Handler::Handler(const Notifier& notifier) |
|
pfeldman
2013/02/13 17:38:24
Method definition order should match the declarati
kkania
2013/02/13 19:17:19
Done.
|
| + : notifier_(notifier) { |
| +} |
| + |
| +scoped_ptr<DevToolsProtocol::Response> |
| +DevToolsProtocol::Handler::HandleCommand( |
| + DevToolsProtocol::Command* command) { |
| + CommandHandlers::iterator it = command_handlers_.find(command->method()); |
| + if (it == command_handlers_.end()) |
| + return scoped_ptr<DevToolsProtocol::Response>(); |
| + return (it->second).Run(command); |
| +} |
| + |
| +void DevToolsProtocol::Handler::RegisterCommandHandler( |
| + const std::string& command, |
| + const CommandHandler& handler) { |
| + command_handlers_[command] = handler; |
| +} |
| + |
| +void DevToolsProtocol::Handler::SendNotification( |
| + const std::string& method, |
| + base::DictionaryValue* params) { |
| + DevToolsProtocol::Notification notification(method, params); |
| + notifier_.Run(notification.Serialize()); |
| +} |
| + |
| // static |
| DevToolsProtocol::Command* DevToolsProtocol::ParseCommand( |
| const std::string& json, |