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

Side by Side Diff: chrome/browser/extensions/devtools_util.cc

Issue 23923010: Move Inspect[BackgroundPage|ExtensionHost] Out of ExtensionService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/devtools_util.h"
6
7 #include "chrome/browser/devtools/devtools_window.h"
8 #include "chrome/browser/extensions/extension_host.h"
9 #include "chrome/browser/extensions/extension_process_manager.h"
10 #include "chrome/browser/extensions/extension_system.h"
11 #include "chrome/browser/extensions/lazy_background_task_queue.h"
12 #include "chrome/common/extensions/extension.h"
13
14 namespace extensions {
15 namespace devtools_util {
16
17 namespace {
18
19 // Helper to inspect an ExtensionHost after it has been loaded.
20 void InspectExtensionHost(ExtensionHost* host) {
21 if (host)
22 DevToolsWindow::OpenDevToolsWindow(host->render_view_host());
23 }
24
25 } // namespace
26
27 void InspectBackgroundPage(const Extension* extension, Profile* profile) {
28 DCHECK(extension);
29 ExtensionSystem* system = ExtensionSystem::Get(profile);
30 ExtensionHost* host =
31 system->process_manager()->GetBackgroundHostForExtension(extension->id());
32 if (host) {
33 InspectExtensionHost(host);
34 } else {
35 system->lazy_background_task_queue()->AddPendingTask(
36 profile,
37 extension->id(),
38 base::Bind(&InspectExtensionHost));
39 }
40 }
41
42 } // namespace devtools_util
43 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/devtools_util.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698