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

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

Issue 710033003: [DevTools] Extract part of DevTools into inspector app. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased 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_app/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_app/DevToolsApp.js
diff --git a/Source/devtools/front_end/devtools_app/DevToolsApp.js b/Source/devtools/front_end/devtools_app/DevToolsApp.js
new file mode 100644
index 0000000000000000000000000000000000000000..38652b27937c172e52fb27d880d9977b4349f628
--- /dev/null
+++ b/Source/devtools/front_end/devtools_app/DevToolsApp.js
@@ -0,0 +1,83 @@
+// 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");
+ WebInspector.setInspectedTabId = this._wrapInvocation.bind(this, "setInspectedTabId");
+ this._invokeOnWebInspectorOnceLoaded = [];
+
+ /**
+ * @type {?Window}
+ */
+ this._inspectorWindow = null;
+}
+
+WebInspector.DevToolsApp.prototype = {
+ /**
+ * @param {!Window} inspectorWindow
+ * @override
+ */
+ inspectorAppWindowLoaded: function(inspectorWindow)
+ {
+ this._inspectorWindow = inspectorWindow;
+ if (window.domAutomationController)
+ this._inspectorWindow.domAutomationController = window.domAutomationController;
+ },
+
+ /**
+ * @override
+ */
+ beforeInspectorAppLoad: function()
+ {
+ if (this._inspectorWindow.uiTests) {
+ // FIXME: move Tests to the host or teach browser counterpart about iframe.
+ window.uiTests = this._inspectorWindow.uiTests;
+ }
+ },
+
+ /**
+ * @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);
+ }
+}
+
+new WebInspector.DevToolsApp();
« no previous file with comments | « Source/devtools/front_end/devtools.json ('k') | Source/devtools/front_end/devtools_app/module.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698