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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 723 |
724 DebuggerGetTargetsFunction::DebuggerGetTargetsFunction() { | 724 DebuggerGetTargetsFunction::DebuggerGetTargetsFunction() { |
725 } | 725 } |
726 | 726 |
727 DebuggerGetTargetsFunction::~DebuggerGetTargetsFunction() { | 727 DebuggerGetTargetsFunction::~DebuggerGetTargetsFunction() { |
728 } | 728 } |
729 | 729 |
730 bool DebuggerGetTargetsFunction::RunAsync() { | 730 bool DebuggerGetTargetsFunction::RunAsync() { |
731 content::DevToolsAgentHost::List list = DevToolsAgentHost::GetOrCreateAll(); | 731 content::DevToolsAgentHost::List list = DevToolsAgentHost::GetOrCreateAll(); |
732 content::BrowserThread::PostTask( | 732 content::BrowserThread::PostTask( |
733 content::BrowserThread::UI, | 733 content::BrowserThread::UI, FROM_HERE, |
734 FROM_HERE, | 734 base::BindOnce(&DebuggerGetTargetsFunction::SendTargetList, this, list)); |
735 base::Bind(&DebuggerGetTargetsFunction::SendTargetList, this, list)); | |
736 return true; | 735 return true; |
737 } | 736 } |
738 | 737 |
739 void DebuggerGetTargetsFunction::SendTargetList( | 738 void DebuggerGetTargetsFunction::SendTargetList( |
740 const content::DevToolsAgentHost::List& target_list) { | 739 const content::DevToolsAgentHost::List& target_list) { |
741 std::unique_ptr<base::ListValue> result(new base::ListValue()); | 740 std::unique_ptr<base::ListValue> result(new base::ListValue()); |
742 for (size_t i = 0; i < target_list.size(); ++i) | 741 for (size_t i = 0; i < target_list.size(); ++i) |
743 result->Append(SerializeTarget(target_list[i])); | 742 result->Append(SerializeTarget(target_list[i])); |
744 SetResult(std::move(result)); | 743 SetResult(std::move(result)); |
745 SendResponse(true); | 744 SendResponse(true); |
746 } | 745 } |
747 | 746 |
748 } // namespace extensions | 747 } // namespace extensions |
OLD | NEW |