| 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 #include "content/browser/devtools/devtools_protocol_handler.h" | 5 #include "content/browser/devtools/devtools_protocol_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (!command) | 67 if (!command) |
| 68 return true; | 68 return true; |
| 69 if (PassCommandToDelegate(session_id, command.get())) | 69 if (PassCommandToDelegate(session_id, command.get())) |
| 70 return true; | 70 return true; |
| 71 return HandleOptionalCommand(session_id, std::move(command), call_id, method); | 71 return HandleOptionalCommand(session_id, std::move(command), call_id, method); |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool DevToolsProtocolHandler::PassCommandToDelegate( | 74 bool DevToolsProtocolHandler::PassCommandToDelegate( |
| 75 int session_id, | 75 int session_id, |
| 76 base::DictionaryValue* command) { | 76 base::DictionaryValue* command) { |
| 77 DevToolsManagerDelegate* delegate = | 77 DevToolsManagerDelegate* manager_delegate = |
| 78 DevToolsManager::GetInstance()->delegate(); | 78 DevToolsManager::GetInstance()->GetDelegate(); |
| 79 if (!delegate) | 79 if (!manager_delegate) |
| 80 return false; | 80 return false; |
| 81 | 81 |
| 82 std::unique_ptr<base::DictionaryValue> response( | 82 std::unique_ptr<base::DictionaryValue> response( |
| 83 delegate->HandleCommand(agent_host_, command)); | 83 manager_delegate->HandleCommand(agent_host_, command)); |
| 84 if (response) { | 84 if (response) { |
| 85 client_.SendMessage(session_id, *response); | 85 client_.SendMessage(session_id, *response); |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 std::unique_ptr<base::DictionaryValue> DevToolsProtocolHandler::ParseCommand( | 92 std::unique_ptr<base::DictionaryValue> DevToolsProtocolHandler::ParseCommand( |
| 93 int session_id, | 93 int session_id, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 DevToolsProtocolDispatcher::CommandHandler command_handler( | 155 DevToolsProtocolDispatcher::CommandHandler command_handler( |
| 156 dispatcher_.FindCommandHandler(*method)); | 156 dispatcher_.FindCommandHandler(*method)); |
| 157 if (!command_handler.is_null()) { | 157 if (!command_handler.is_null()) { |
| 158 return command_handler.Run(DevToolsCommandId(*call_id, session_id), | 158 return command_handler.Run(DevToolsCommandId(*call_id, session_id), |
| 159 TakeDictionary(command.get(), kParamsParam)); | 159 TakeDictionary(command.get(), kParamsParam)); |
| 160 } | 160 } |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace content | 164 } // namespace content |
| OLD | NEW |