Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: chrome/browser/extensions/api/debugger/debugger_api.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 int request_id = ++last_request_id_; 378 int request_id = ++last_request_id_;
379 pending_requests_[request_id] = function; 379 pending_requests_[request_id] = function;
380 protocol_request.SetInteger("id", request_id); 380 protocol_request.SetInteger("id", request_id);
381 protocol_request.SetString("method", method); 381 protocol_request.SetString("method", method);
382 if (command_params) { 382 if (command_params) {
383 protocol_request.Set("params", 383 protocol_request.Set("params",
384 command_params->additional_properties.DeepCopy()); 384 command_params->additional_properties.DeepCopy());
385 } 385 }
386 386
387 std::string json_args; 387 std::string json_args;
388 base::JSONWriter::Write(&protocol_request, &json_args); 388 base::JSONWriter::Write(protocol_request, &json_args);
389 agent_host_->DispatchProtocolMessage(json_args); 389 agent_host_->DispatchProtocolMessage(json_args);
390 } 390 }
391 391
392 void ExtensionDevToolsClientHost::MarkAsDismissed() { 392 void ExtensionDevToolsClientHost::MarkAsDismissed() {
393 detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER; 393 detach_reason_ = api::debugger::DETACH_REASON_CANCELED_BY_USER;
394 } 394 }
395 395
396 void ExtensionDevToolsClientHost::SendDetachedEvent() { 396 void ExtensionDevToolsClientHost::SendDetachedEvent() {
397 if (!EventRouter::Get(profile_)) 397 if (!EventRouter::Get(profile_))
398 return; 398 return;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 659
660 client_host_->SendMessageToBackend(this, params->method, 660 client_host_->SendMessageToBackend(this, params->method,
661 params->command_params.get()); 661 params->command_params.get());
662 return true; 662 return true;
663 } 663 }
664 664
665 void DebuggerSendCommandFunction::SendResponseBody( 665 void DebuggerSendCommandFunction::SendResponseBody(
666 base::DictionaryValue* response) { 666 base::DictionaryValue* response) {
667 base::Value* error_body; 667 base::Value* error_body;
668 if (response->Get("error", &error_body)) { 668 if (response->Get("error", &error_body)) {
669 base::JSONWriter::Write(error_body, &error_); 669 base::JSONWriter::Write(*error_body, &error_);
670 SendResponse(false); 670 SendResponse(false);
671 return; 671 return;
672 } 672 }
673 673
674 base::DictionaryValue* result_body; 674 base::DictionaryValue* result_body;
675 SendCommand::Results::Result result; 675 SendCommand::Results::Result result;
676 if (response->GetDictionary("result", &result_body)) 676 if (response->GetDictionary("result", &result_body))
677 result.additional_properties.Swap(result_body); 677 result.additional_properties.Swap(result_body);
678 678
679 results_ = SendCommand::Results::Create(result); 679 results_ = SendCommand::Results::Create(result);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 const std::vector<DevToolsTargetImpl*>& target_list) { 745 const std::vector<DevToolsTargetImpl*>& target_list) {
746 scoped_ptr<base::ListValue> result(new base::ListValue()); 746 scoped_ptr<base::ListValue> result(new base::ListValue());
747 for (size_t i = 0; i < target_list.size(); ++i) 747 for (size_t i = 0; i < target_list.size(); ++i)
748 result->Append(SerializeTarget(*target_list[i])); 748 result->Append(SerializeTarget(*target_list[i]));
749 STLDeleteContainerPointers(target_list.begin(), target_list.end()); 749 STLDeleteContainerPointers(target_list.begin(), target_list.end());
750 SetResult(result.release()); 750 SetResult(result.release());
751 SendResponse(true); 751 SendResponse(true);
752 } 752 }
753 753
754 } // namespace extensions 754 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698