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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 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 /**
6 * @constructor
7 * @implements {InspectorAppHostAPI}
8 */
9 WebInspector.DevToolsApp = function()
10 {
11 window.InspectorAppHost = this;
12
13 // FIXME: These methods are invoked from the backend and should be removed
14 // once we migrate to the "pull" model for extensions retrieval.
15 WebInspector.addExtensions = this._wrapInvocation.bind(this, "addExtensions" );
16 WebInspector.setInspectedTabId = this._wrapInvocation.bind(this, "setInspect edTabId");
17 this._invokeOnWebInspectorOnceLoaded = [];
18
19 /**
20 * @type {?Window}
21 */
22 this._inspectorWindow = null;
23 }
24
25 WebInspector.DevToolsApp.prototype = {
26 /**
27 * @param {!Window} inspectorWindow
28 * @override
29 */
30 inspectorAppWindowLoaded: function(inspectorWindow)
31 {
32 this._inspectorWindow = inspectorWindow;
33 if (window.domAutomationController)
34 this._inspectorWindow.domAutomationController = window.domAutomation Controller;
35 },
36
37 /**
38 * @override
39 */
40 beforeInspectorAppLoad: function()
41 {
42 if (this._inspectorWindow.uiTests) {
43 // FIXME: move Tests to the host or teach browser counterpart about iframe.
44 window.uiTests = this._inspectorWindow.uiTests;
45 }
46 },
47
48 /**
49 * @override
50 */
51 afterInspectorAppLoad: function()
52 {
53 while (this._invokeOnWebInspectorOnceLoaded.length) {
54 var methodAndParams = this._invokeOnWebInspectorOnceLoaded.shift();
55 this._invokeOnWebInspector(methodAndParams[0], methodAndParams[1]);
56 }
57 },
58
59 /**
60 * @param {string} method
61 */
62 _wrapInvocation: function(method)
63 {
64 var params = Array.prototype.slice.call(arguments, 1);
65 if (this._inspectorWindow) {
66 this._invokeOnWebInspector(method, params);
67 } else {
68 this._invokeOnWebInspectorOnceLoaded.push([method, params]);
69 }
70 },
71
72 /**
73 * @param {string} method
74 * @param {!Array.<*>} params
75 */
76 _invokeOnWebInspector: function(method, params)
77 {
78 var webInspector = this._inspectorWindow["WebInspector"];
79 webInspector[method].apply(webInspector, params);
80 }
81 }
82
83 new WebInspector.DevToolsApp();
OLDNEW
« 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