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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/devtools_util.h ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/devtools_util.cc
diff --git a/chrome/browser/extensions/devtools_util.cc b/chrome/browser/extensions/devtools_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b17530da3a6d6265e7a5569e3d0b5c4cba67fcb5
--- /dev/null
+++ b/chrome/browser/extensions/devtools_util.cc
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/devtools_util.h"
+
+#include "chrome/browser/devtools/devtools_window.h"
+#include "chrome/browser/extensions/extension_host.h"
+#include "chrome/browser/extensions/extension_process_manager.h"
+#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/extensions/lazy_background_task_queue.h"
+#include "chrome/common/extensions/extension.h"
+
+namespace extensions {
+namespace devtools_util {
+
+namespace {
+
+// Helper to inspect an ExtensionHost after it has been loaded.
+void InspectExtensionHost(ExtensionHost* host) {
+ if (host)
+ DevToolsWindow::OpenDevToolsWindow(host->render_view_host());
+}
+
+} // namespace
+
+void InspectBackgroundPage(const Extension* extension, Profile* profile) {
+ DCHECK(extension);
+ ExtensionSystem* system = ExtensionSystem::Get(profile);
+ ExtensionHost* host =
+ system->process_manager()->GetBackgroundHostForExtension(extension->id());
+ if (host) {
+ InspectExtensionHost(host);
+ } else {
+ system->lazy_background_task_queue()->AddPendingTask(
+ profile,
+ extension->id(),
+ base::Bind(&InspectExtensionHost));
+ }
+}
+
+} // namespace devtools_util
+} // namespace extensions
« 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