| 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..14ef09280862bf78e791a2354953adc741be7060 100644
|
| --- a/content/browser/devtools/devtools_protocol.cc
|
| +++ b/content/browser/devtools/devtools_protocol.cc
|
| @@ -118,6 +118,39 @@ std::string DevToolsProtocol::Notification::Serialize() {
|
| return json_notification;
|
| }
|
|
|
| +DevToolsProtocol::Handler::~Handler() {
|
| +}
|
| +
|
| +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::SetNotifier(const Notifier& notifier) {
|
| + notifier_ = notifier;
|
| +}
|
| +
|
| +DevToolsProtocol::Handler::Handler() {
|
| +}
|
| +
|
| +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);
|
| + if (!notifier_.is_null())
|
| + notifier_.Run(notification.Serialize());
|
| +}
|
| +
|
| // static
|
| DevToolsProtocol::Command* DevToolsProtocol::ParseCommand(
|
| const std::string& json,
|
|
|