OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Implements the Chrome Extensions Debugger API. | 5 // Implements the Chrome Extensions Debugger API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" | 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 void ExtensionDevToolsClientHost::SendMessageToBackend( | 384 void ExtensionDevToolsClientHost::SendMessageToBackend( |
385 DebuggerSendCommandFunction* function, | 385 DebuggerSendCommandFunction* function, |
386 const std::string& method, | 386 const std::string& method, |
387 SendCommand::Params::CommandParams* command_params) { | 387 SendCommand::Params::CommandParams* command_params) { |
388 base::DictionaryValue protocol_request; | 388 base::DictionaryValue protocol_request; |
389 int request_id = ++last_request_id_; | 389 int request_id = ++last_request_id_; |
390 pending_requests_[request_id] = function; | 390 pending_requests_[request_id] = function; |
391 protocol_request.SetInteger("id", request_id); | 391 protocol_request.SetInteger("id", request_id); |
392 protocol_request.SetString("method", method); | 392 protocol_request.SetString("method", method); |
393 if (command_params) { | 393 if (command_params) { |
394 protocol_request.Set("params", | 394 protocol_request.Set( |
395 command_params->additional_properties.DeepCopy()); | 395 "params", command_params->additional_properties.CreateDeepCopy()); |
396 } | 396 } |
397 | 397 |
398 std::string json_args; | 398 std::string json_args; |
399 base::JSONWriter::Write(protocol_request, &json_args); | 399 base::JSONWriter::Write(protocol_request, &json_args); |
400 agent_host_->DispatchProtocolMessage(this, json_args); | 400 agent_host_->DispatchProtocolMessage(this, json_args); |
401 } | 401 } |
402 | 402 |
403 void ExtensionDevToolsClientHost::InfoBarDismissed() { | 403 void ExtensionDevToolsClientHost::InfoBarDismissed() { |
404 detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER; | 404 detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER; |
405 SendDetachedEvent(); | 405 SendDetachedEvent(); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 void DebuggerGetTargetsFunction::SendTargetList( | 739 void DebuggerGetTargetsFunction::SendTargetList( |
740 const content::DevToolsAgentHost::List& target_list) { | 740 const content::DevToolsAgentHost::List& target_list) { |
741 std::unique_ptr<base::ListValue> result(new base::ListValue()); | 741 std::unique_ptr<base::ListValue> result(new base::ListValue()); |
742 for (size_t i = 0; i < target_list.size(); ++i) | 742 for (size_t i = 0; i < target_list.size(); ++i) |
743 result->Append(SerializeTarget(target_list[i])); | 743 result->Append(SerializeTarget(target_list[i])); |
744 SetResult(std::move(result)); | 744 SetResult(std::move(result)); |
745 SendResponse(true); | 745 SendResponse(true); |
746 } | 746 } |
747 | 747 |
748 } // namespace extensions | 748 } // namespace extensions |
OLD | NEW |