OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/extensions/devtools_util.h" | 5 #include "chrome/browser/extensions/devtools_util.h" |
6 | 6 |
7 #include "chrome/browser/devtools/devtools_window.h" | 7 #include "chrome/browser/devtools/devtools_window.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "extensions/browser/extension_host.h" | 9 #include "extensions/browser/extension_host.h" |
10 #include "extensions/browser/extension_system.h" | |
11 #include "extensions/browser/lazy_background_task_queue.h" | 10 #include "extensions/browser/lazy_background_task_queue.h" |
12 #include "extensions/browser/process_manager.h" | 11 #include "extensions/browser/process_manager.h" |
13 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
14 | 13 |
15 namespace extensions { | 14 namespace extensions { |
16 namespace devtools_util { | 15 namespace devtools_util { |
17 | 16 |
18 namespace { | 17 namespace { |
19 | 18 |
20 // Helper to inspect an ExtensionHost after it has been loaded. | 19 // Helper to inspect an ExtensionHost after it has been loaded. |
21 void InspectExtensionHost(ExtensionHost* host) { | 20 void InspectExtensionHost(ExtensionHost* host) { |
22 if (host) | 21 if (host) |
23 DevToolsWindow::OpenDevToolsWindow(host->host_contents()); | 22 DevToolsWindow::OpenDevToolsWindow(host->host_contents()); |
24 } | 23 } |
25 | 24 |
26 } // namespace | 25 } // namespace |
27 | 26 |
28 void InspectBackgroundPage(const Extension* extension, Profile* profile) { | 27 void InspectBackgroundPage(const Extension* extension, Profile* profile) { |
29 DCHECK(extension); | 28 DCHECK(extension); |
30 ExtensionSystem* system = ExtensionSystem::Get(profile); | |
31 ExtensionHost* host = ProcessManager::Get(profile) | 29 ExtensionHost* host = ProcessManager::Get(profile) |
32 ->GetBackgroundHostForExtension(extension->id()); | 30 ->GetBackgroundHostForExtension(extension->id()); |
33 if (host) { | 31 if (host) { |
34 InspectExtensionHost(host); | 32 InspectExtensionHost(host); |
35 } else { | 33 } else { |
36 system->lazy_background_task_queue()->AddPendingTask( | 34 LazyBackgroundTaskQueue::Get(profile)->AddPendingTask( |
37 profile, | 35 profile, |
38 extension->id(), | 36 extension->id(), |
39 base::Bind(&InspectExtensionHost)); | 37 base::Bind(&InspectExtensionHost)); |
40 } | 38 } |
41 } | 39 } |
42 | 40 |
43 } // namespace devtools_util | 41 } // namespace devtools_util |
44 } // namespace extensions | 42 } // namespace extensions |
OLD | NEW |