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 <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 | 538 |
539 | 539 |
540 // DebuggerAttachFunction ----------------------------------------------------- | 540 // DebuggerAttachFunction ----------------------------------------------------- |
541 | 541 |
542 DebuggerAttachFunction::DebuggerAttachFunction() { | 542 DebuggerAttachFunction::DebuggerAttachFunction() { |
543 } | 543 } |
544 | 544 |
545 DebuggerAttachFunction::~DebuggerAttachFunction() { | 545 DebuggerAttachFunction::~DebuggerAttachFunction() { |
546 } | 546 } |
547 | 547 |
548 bool DebuggerAttachFunction::RunImpl() { | 548 bool DebuggerAttachFunction::RunAsync() { |
549 scoped_ptr<Attach::Params> params(Attach::Params::Create(*args_)); | 549 scoped_ptr<Attach::Params> params(Attach::Params::Create(*args_)); |
550 EXTENSION_FUNCTION_VALIDATE(params.get()); | 550 EXTENSION_FUNCTION_VALIDATE(params.get()); |
551 | 551 |
552 CopyDebuggee(&debuggee_, params->target); | 552 CopyDebuggee(&debuggee_, params->target); |
553 if (!InitAgentHost()) | 553 if (!InitAgentHost()) |
554 return false; | 554 return false; |
555 | 555 |
556 if (!DevToolsHttpHandler::IsSupportedProtocolVersion( | 556 if (!DevToolsHttpHandler::IsSupportedProtocolVersion( |
557 params->required_version)) { | 557 params->required_version)) { |
558 error_ = ErrorUtils::FormatErrorMessage( | 558 error_ = ErrorUtils::FormatErrorMessage( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 | 593 |
594 | 594 |
595 // DebuggerDetachFunction ----------------------------------------------------- | 595 // DebuggerDetachFunction ----------------------------------------------------- |
596 | 596 |
597 DebuggerDetachFunction::DebuggerDetachFunction() { | 597 DebuggerDetachFunction::DebuggerDetachFunction() { |
598 } | 598 } |
599 | 599 |
600 DebuggerDetachFunction::~DebuggerDetachFunction() { | 600 DebuggerDetachFunction::~DebuggerDetachFunction() { |
601 } | 601 } |
602 | 602 |
603 bool DebuggerDetachFunction::RunImpl() { | 603 bool DebuggerDetachFunction::RunAsync() { |
604 scoped_ptr<Detach::Params> params(Detach::Params::Create(*args_)); | 604 scoped_ptr<Detach::Params> params(Detach::Params::Create(*args_)); |
605 EXTENSION_FUNCTION_VALIDATE(params.get()); | 605 EXTENSION_FUNCTION_VALIDATE(params.get()); |
606 | 606 |
607 CopyDebuggee(&debuggee_, params->target); | 607 CopyDebuggee(&debuggee_, params->target); |
608 if (!InitClientHost()) | 608 if (!InitClientHost()) |
609 return false; | 609 return false; |
610 | 610 |
611 client_host_->Close(); | 611 client_host_->Close(); |
612 SendResponse(true); | 612 SendResponse(true); |
613 return true; | 613 return true; |
614 } | 614 } |
615 | 615 |
616 | 616 |
617 // DebuggerSendCommandFunction ------------------------------------------------ | 617 // DebuggerSendCommandFunction ------------------------------------------------ |
618 | 618 |
619 DebuggerSendCommandFunction::DebuggerSendCommandFunction() { | 619 DebuggerSendCommandFunction::DebuggerSendCommandFunction() { |
620 } | 620 } |
621 | 621 |
622 DebuggerSendCommandFunction::~DebuggerSendCommandFunction() { | 622 DebuggerSendCommandFunction::~DebuggerSendCommandFunction() { |
623 } | 623 } |
624 | 624 |
625 bool DebuggerSendCommandFunction::RunImpl() { | 625 bool DebuggerSendCommandFunction::RunAsync() { |
626 scoped_ptr<SendCommand::Params> params(SendCommand::Params::Create(*args_)); | 626 scoped_ptr<SendCommand::Params> params(SendCommand::Params::Create(*args_)); |
627 EXTENSION_FUNCTION_VALIDATE(params.get()); | 627 EXTENSION_FUNCTION_VALIDATE(params.get()); |
628 | 628 |
629 CopyDebuggee(&debuggee_, params->target); | 629 CopyDebuggee(&debuggee_, params->target); |
630 if (!InitClientHost()) | 630 if (!InitClientHost()) |
631 return false; | 631 return false; |
632 | 632 |
633 client_host_->SendMessageToBackend(this, params->method, | 633 client_host_->SendMessageToBackend(this, params->method, |
634 params->command_params.get()); | 634 params->command_params.get()); |
635 return true; | 635 return true; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 } | 698 } |
699 | 699 |
700 } // namespace | 700 } // namespace |
701 | 701 |
702 DebuggerGetTargetsFunction::DebuggerGetTargetsFunction() { | 702 DebuggerGetTargetsFunction::DebuggerGetTargetsFunction() { |
703 } | 703 } |
704 | 704 |
705 DebuggerGetTargetsFunction::~DebuggerGetTargetsFunction() { | 705 DebuggerGetTargetsFunction::~DebuggerGetTargetsFunction() { |
706 } | 706 } |
707 | 707 |
708 bool DebuggerGetTargetsFunction::RunImpl() { | 708 bool DebuggerGetTargetsFunction::RunAsync() { |
709 DevToolsTargetImpl::EnumerateAllTargets( | 709 DevToolsTargetImpl::EnumerateAllTargets( |
710 base::Bind(&DebuggerGetTargetsFunction::SendTargetList, this)); | 710 base::Bind(&DebuggerGetTargetsFunction::SendTargetList, this)); |
711 return true; | 711 return true; |
712 } | 712 } |
713 | 713 |
714 void DebuggerGetTargetsFunction::SendTargetList( | 714 void DebuggerGetTargetsFunction::SendTargetList( |
715 const std::vector<DevToolsTargetImpl*>& target_list) { | 715 const std::vector<DevToolsTargetImpl*>& target_list) { |
716 scoped_ptr<base::ListValue> result(new base::ListValue()); | 716 scoped_ptr<base::ListValue> result(new base::ListValue()); |
717 for (size_t i = 0; i < target_list.size(); ++i) | 717 for (size_t i = 0; i < target_list.size(); ++i) |
718 result->Append(SerializeTarget(*target_list[i])); | 718 result->Append(SerializeTarget(*target_list[i])); |
719 STLDeleteContainerPointers(target_list.begin(), target_list.end()); | 719 STLDeleteContainerPointers(target_list.begin(), target_list.end()); |
720 SetResult(result.release()); | 720 SetResult(result.release()); |
721 SendResponse(true); | 721 SendResponse(true); |
722 } | 722 } |
OLD | NEW |