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

Unified Diff: Source/devtools/front_end/devtools_bootstrap/DevToolsApp.js

Issue 710033003: [DevTools] Extract part of DevTools into inspector app. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | « Source/devtools/front_end/devtools.json ('k') | Source/devtools/front_end/devtools_bootstrap/module.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/devtools_bootstrap/DevToolsApp.js
diff --git a/Source/devtools/front_end/devtools_bootstrap/DevToolsApp.js b/Source/devtools/front_end/devtools_bootstrap/DevToolsApp.js
new file mode 100644
index 0000000000000000000000000000000000000000..7b42708e4061aca02bcf81c75f2bb15d1333c4cc
--- /dev/null
+++ b/Source/devtools/front_end/devtools_bootstrap/DevToolsApp.js
@@ -0,0 +1,89 @@
+// Copyright 2014 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.
+
+/**
+ * @constructor
+ * @implements {InspectorAppHostAPI}
+ */
+WebInspector.DevToolsApp = function()
+{
+ window.InspectorAppHost = this;
+
+ // FIXME: These methods are invoked from the backend and should be removed
+ // once we migrate to the "pull" model for extensions retrieval.
+ WebInspector.addExtensions = this._wrapInvocation.bind(this, "addExtensions");
pfeldman 2014/11/10 15:48:36 We should reverse the direction of these and make
dgozman 2014/11/10 18:19:42 We'll have to keep pushing model for old frontends
+ WebInspector.setInspectedTabId = this._wrapInvocation.bind(this, "setInspectedTabId");
+ this._invokeOnWebInspectorOnceLoaded = [];
+
+ /**
+ * @type {?Window}
+ */
+ this._inspectorWindow = null;
+ this._loadInspectorAppInIframe();
+}
+
+WebInspector.DevToolsApp.prototype = {
+ /**
+ * @param {!Window} window
+ * @override
+ */
+ inspectorAppWindowLoaded: function(window)
+ {
+ this._inspectorWindow = window;
+ },
+
+ /**
+ * @override
+ */
+ beforeInspectorAppLoad: function()
+ {
+ },
+
+ /**
+ * @override
+ */
+ afterInspectorAppLoad: function()
+ {
+ while (this._invokeOnWebInspectorOnceLoaded.length) {
+ var methodAndParams = this._invokeOnWebInspectorOnceLoaded.shift();
+ this._invokeOnWebInspector(methodAndParams[0], methodAndParams[1]);
+ }
+ },
+
+ /**
+ * @param {string} method
+ */
+ _wrapInvocation: function(method)
+ {
+ var params = Array.prototype.slice.call(arguments, 1);
+ if (this._inspectorWindow) {
+ this._invokeOnWebInspector(method, params);
+ } else {
+ this._invokeOnWebInspectorOnceLoaded.push([method, params]);
+ }
+ },
+
+ /**
+ * @param {string} method
+ * @param {!Array.<*>} params
+ */
+ _invokeOnWebInspector: function(method, params)
+ {
+ var webInspector = this._inspectorWindow["WebInspector"];
+ webInspector[method].apply(webInspector, params);
+ },
+
+ /**
+ * @suppressGlobalPropertiesCheck
+ */
+ _loadInspectorAppInIframe: function()
+ {
+ this._iframe = document.body.createChild("iframe", "inspector-app-iframe");
+ var url = window.location.href;
+ url = url.replace("devtools.html", "inspector.html");
+ this._iframe.setAttribute("src", url);
+ }
+}
+
+runOnWindowLoad(function() { new WebInspector.DevToolsApp(); });
« no previous file with comments | « Source/devtools/front_end/devtools.json ('k') | Source/devtools/front_end/devtools_bootstrap/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698