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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionView.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
13 * distribution. 13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 16 * this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30
31 /** 30 /**
32 * @constructor 31 * @unrestricted
33 * @extends {WebInspector.Widget}
34 * @param {!WebInspector.ExtensionServer} server
35 * @param {string} id
36 * @param {string} src
37 * @param {string} className
38 */ 32 */
39 WebInspector.ExtensionView = function(server, id, src, className) 33 WebInspector.ExtensionView = class extends WebInspector.Widget {
40 { 34 /**
41 WebInspector.Widget.call(this); 35 * @param {!WebInspector.ExtensionServer} server
36 * @param {string} id
37 * @param {string} src
38 * @param {string} className
39 */
40 constructor(server, id, src, className) {
41 super();
42 this.setHideOnDetach(); 42 this.setHideOnDetach();
43 this.element.className = "vbox flex-auto"; // Override 43 this.element.className = 'vbox flex-auto'; // Override
44 44
45 this._server = server; 45 this._server = server;
46 this._id = id; 46 this._id = id;
47 this._iframe = createElement("iframe"); 47 this._iframe = createElement('iframe');
48 this._iframe.addEventListener("load", this._onLoad.bind(this), false); 48 this._iframe.addEventListener('load', this._onLoad.bind(this), false);
49 this._iframe.src = src; 49 this._iframe.src = src;
50 this._iframe.className = className; 50 this._iframe.className = className;
51 this.setDefaultFocusedElement(this._iframe); 51 this.setDefaultFocusedElement(this._iframe);
52 52
53 this.element.appendChild(this._iframe); 53 this.element.appendChild(this._iframe);
54 }; 54 }
55 55
56 WebInspector.ExtensionView.prototype = { 56 /**
57 wasShown: function() 57 * @override
58 { 58 */
59 if (typeof this._frameIndex === "number") 59 wasShown() {
60 this._server.notifyViewShown(this._id, this._frameIndex); 60 if (typeof this._frameIndex === 'number')
61 }, 61 this._server.notifyViewShown(this._id, this._frameIndex);
62 }
62 63
63 willHide: function() 64 /**
64 { 65 * @override
65 if (typeof this._frameIndex === "number") 66 */
66 this._server.notifyViewHidden(this._id); 67 willHide() {
67 }, 68 if (typeof this._frameIndex === 'number')
69 this._server.notifyViewHidden(this._id);
70 }
68 71
69 _onLoad: function() 72 _onLoad() {
70 { 73 var frames = /** @type {!Array.<!Window>} */ (window.frames);
71 var frames = /** @type {!Array.<!Window>} */ (window.frames); 74 this._frameIndex = Array.prototype.indexOf.call(frames, this._iframe.content Window);
72 this._frameIndex = Array.prototype.indexOf.call(frames, this._iframe.con tentWindow); 75 if (this.isShowing())
73 if (this.isShowing()) 76 this._server.notifyViewShown(this._id, this._frameIndex);
74 this._server.notifyViewShown(this._id, this._frameIndex); 77 }
75 },
76
77 __proto__: WebInspector.Widget.prototype
78 }; 78 };
79 79
80 /** 80 /**
81 * @constructor 81 * @unrestricted
82 * @extends {WebInspector.VBox}
83 * @param {!WebInspector.ExtensionServer} server
84 * @param {string} id
85 */ 82 */
86 WebInspector.ExtensionNotifierView = function(server, id) 83 WebInspector.ExtensionNotifierView = class extends WebInspector.VBox {
87 { 84 /**
88 WebInspector.VBox.call(this); 85 * @param {!WebInspector.ExtensionServer} server
86 * @param {string} id
87 */
88 constructor(server, id) {
89 super();
89 90
90 this._server = server; 91 this._server = server;
91 this._id = id; 92 this._id = id;
93 }
94
95 /**
96 * @override
97 */
98 wasShown() {
99 this._server.notifyViewShown(this._id);
100 }
101
102 /**
103 * @override
104 */
105 willHide() {
106 this._server.notifyViewHidden(this._id);
107 }
92 }; 108 };
93
94 WebInspector.ExtensionNotifierView.prototype = {
95 wasShown: function()
96 {
97 this._server.notifyViewShown(this._id);
98 },
99
100 willHide: function()
101 {
102 this._server.notifyViewHidden(this._id);
103 },
104
105 __proto__: WebInspector.VBox.prototype
106 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698