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 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/extensions/api/debugger/debugger_api_constants.h" | 24 #include "chrome/browser/extensions/api/debugger/debugger_api_constants.h" |
25 #include "chrome/browser/extensions/extension_service.h" | 25 #include "chrome/browser/extensions/extension_service.h" |
26 #include "chrome/browser/extensions/extension_tab_util.h" | 26 #include "chrome/browser/extensions/extension_tab_util.h" |
27 #include "chrome/browser/infobars/infobar_service.h" | 27 #include "chrome/browser/infobars/infobar_service.h" |
28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 29 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
31 #include "chrome/grit/generated_resources.h" | 31 #include "chrome/grit/generated_resources.h" |
32 #include "components/infobars/core/confirm_infobar_delegate.h" | 32 #include "components/infobars/core/confirm_infobar_delegate.h" |
33 #include "components/infobars/core/infobar.h" | 33 #include "components/infobars/core/infobar.h" |
| 34 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/devtools_agent_host.h" | 35 #include "content/public/browser/devtools_agent_host.h" |
35 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
36 #include "content/public/browser/notification_source.h" | 37 #include "content/public/browser/notification_source.h" |
37 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
38 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
39 #include "content/public/browser/render_widget_host.h" | 40 #include "content/public/browser/render_widget_host.h" |
40 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
41 #include "content/public/common/content_client.h" | 42 #include "content/public/common/content_client.h" |
42 #include "content/public/common/url_utils.h" | 43 #include "content/public/common/url_utils.h" |
43 #include "extensions/browser/event_router.h" | 44 #include "extensions/browser/event_router.h" |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 726 |
726 } // namespace | 727 } // namespace |
727 | 728 |
728 DebuggerGetTargetsFunction::DebuggerGetTargetsFunction() { | 729 DebuggerGetTargetsFunction::DebuggerGetTargetsFunction() { |
729 } | 730 } |
730 | 731 |
731 DebuggerGetTargetsFunction::~DebuggerGetTargetsFunction() { | 732 DebuggerGetTargetsFunction::~DebuggerGetTargetsFunction() { |
732 } | 733 } |
733 | 734 |
734 bool DebuggerGetTargetsFunction::RunAsync() { | 735 bool DebuggerGetTargetsFunction::RunAsync() { |
735 DevToolsTargetImpl::EnumerateAllTargets( | 736 std::vector<DevToolsTargetImpl*> list = DevToolsTargetImpl::EnumerateAll(); |
736 base::Bind(&DebuggerGetTargetsFunction::SendTargetList, this)); | 737 content::BrowserThread::PostTask( |
| 738 content::BrowserThread::UI, |
| 739 FROM_HERE, |
| 740 base::Bind(&DebuggerGetTargetsFunction::SendTargetList, this, list)); |
737 return true; | 741 return true; |
738 } | 742 } |
739 | 743 |
740 void DebuggerGetTargetsFunction::SendTargetList( | 744 void DebuggerGetTargetsFunction::SendTargetList( |
741 const std::vector<DevToolsTargetImpl*>& target_list) { | 745 const std::vector<DevToolsTargetImpl*>& target_list) { |
742 scoped_ptr<base::ListValue> result(new base::ListValue()); | 746 scoped_ptr<base::ListValue> result(new base::ListValue()); |
743 for (size_t i = 0; i < target_list.size(); ++i) | 747 for (size_t i = 0; i < target_list.size(); ++i) |
744 result->Append(SerializeTarget(*target_list[i])); | 748 result->Append(SerializeTarget(*target_list[i])); |
745 STLDeleteContainerPointers(target_list.begin(), target_list.end()); | 749 STLDeleteContainerPointers(target_list.begin(), target_list.end()); |
746 SetResult(result.release()); | 750 SetResult(result.release()); |
747 SendResponse(true); | 751 SendResponse(true); |
748 } | 752 } |
749 | 753 |
750 } // namespace extensions | 754 } // namespace extensions |
OLD | NEW |