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

Side by Side 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 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" );
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
16 WebInspector.setInspectedTabId = this._wrapInvocation.bind(this, "setInspect edTabId");
17 this._invokeOnWebInspectorOnceLoaded = [];
18
19 /**
20 * @type {?Window}
21 */
22 this._inspectorWindow = null;
23 this._loadInspectorAppInIframe();
24 }
25
26 WebInspector.DevToolsApp.prototype = {
27 /**
28 * @param {!Window} window
29 * @override
30 */
31 inspectorAppWindowLoaded: function(window)
32 {
33 this._inspectorWindow = window;
34 },
35
36 /**
37 * @override
38 */
39 beforeInspectorAppLoad: function()
40 {
41 },
42
43 /**
44 * @override
45 */
46 afterInspectorAppLoad: function()
47 {
48 while (this._invokeOnWebInspectorOnceLoaded.length) {
49 var methodAndParams = this._invokeOnWebInspectorOnceLoaded.shift();
50 this._invokeOnWebInspector(methodAndParams[0], methodAndParams[1]);
51 }
52 },
53
54 /**
55 * @param {string} method
56 */
57 _wrapInvocation: function(method)
58 {
59 var params = Array.prototype.slice.call(arguments, 1);
60 if (this._inspectorWindow) {
61 this._invokeOnWebInspector(method, params);
62 } else {
63 this._invokeOnWebInspectorOnceLoaded.push([method, params]);
64 }
65 },
66
67 /**
68 * @param {string} method
69 * @param {!Array.<*>} params
70 */
71 _invokeOnWebInspector: function(method, params)
72 {
73 var webInspector = this._inspectorWindow["WebInspector"];
74 webInspector[method].apply(webInspector, params);
75 },
76
77 /**
78 * @suppressGlobalPropertiesCheck
79 */
80 _loadInspectorAppInIframe: function()
81 {
82 this._iframe = document.body.createChild("iframe", "inspector-app-iframe ");
83 var url = window.location.href;
84 url = url.replace("devtools.html", "inspector.html");
85 this._iframe.setAttribute("src", url);
86 }
87 }
88
89 runOnWindowLoad(function() { new WebInspector.DevToolsApp(); });
OLDNEW
« 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