Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / devtools_util.cc
blob722f8c09f035c0d65cf98f75e6e345a5b7dea43b
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.
5 #include "chrome/browser/extensions/devtools_util.h"
7 #include "chrome/browser/devtools/devtools_window.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "extensions/browser/extension_host.h"
10 #include "extensions/browser/lazy_background_task_queue.h"
11 #include "extensions/browser/process_manager.h"
12 #include "extensions/common/extension.h"
14 namespace extensions {
15 namespace devtools_util {
17 namespace {
19 // Helper to inspect an ExtensionHost after it has been loaded.
20 void InspectExtensionHost(ExtensionHost* host) {
21 if (host)
22 DevToolsWindow::OpenDevToolsWindow(host->host_contents());
25 } // namespace
27 void InspectBackgroundPage(const Extension* extension, Profile* profile) {
28 DCHECK(extension);
29 ExtensionHost* host = ProcessManager::Get(profile)
30 ->GetBackgroundHostForExtension(extension->id());
31 if (host) {
32 InspectExtensionHost(host);
33 } else {
34 LazyBackgroundTaskQueue::Get(profile)->AddPendingTask(
35 profile,
36 extension->id(),
37 base::Bind(&InspectExtensionHost));
41 } // namespace devtools_util
42 } // namespace extensions