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

Side by Side Diff: chrome/browser/resources/extensions/extension_code.js

Issue 475633006: Typecheck JS files for chrome://extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@D_asserts_codingconvention
Patch Set: looked twice Created 6 years, 4 months 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 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /**
6 * @typedef {{afterHighlight: string,
7 * beforeHighlight: string,
8 * highlight:string,
Dan Beam 2014/08/21 18:27:47 space after :
Vitaly Pavlenko 2014/08/22 01:43:39 Done.
9 * title: string}}
10 */
11 var ExtensionCodeObject;
Dan Beam 2014/08/21 18:27:47 ExtensionHighlight
Vitaly Pavlenko 2014/08/22 01:43:39 Done.
12
5 cr.define('extensions', function() { 13 cr.define('extensions', function() {
6 'use strict'; 14 'use strict';
7 15
8 /** 16 /**
9 * ExtensionCode is an element which displays code in a styled div, and is 17 * ExtensionCode is an element which displays code in a styled div, and is
10 * designed to highlight errors. 18 * designed to highlight errors.
19 * @constructor
20 * @extends {HTMLDivElement}
11 */ 21 */
12 function ExtensionCode(div) { 22 function ExtensionCode(div) {
13 div.__proto__ = ExtensionCode.prototype; 23 div.__proto__ = ExtensionCode.prototype;
14 return div; 24 return div;
15 } 25 }
16 26
17 ExtensionCode.prototype = { 27 ExtensionCode.prototype = {
18 __proto__: HTMLDivElement.prototype, 28 __proto__: HTMLDivElement.prototype,
19 29
20 /** 30 /**
21 * Populate the content area of the code div with the given code. This will 31 * Populate the content area of the code div with the given code. This will
22 * highlight the erroneous section (if any). 32 * highlight the erroneous section (if any).
23 * @param {Object} code An object with four strings: beforeHighlight, 33 * @param {ExtensionCodeObject} code The 'highlight' strings
Dan Beam 2014/08/21 18:27:47 wrap better
Vitaly Pavlenko 2014/08/22 01:43:39 Done.
24 * afterHighlight, highlight, and the message. The 'highlight' strings
25 * represent the three portions of the file's content to display - the 34 * represent the three portions of the file's content to display - the
26 * portion which is most relevant and should be emphasized (highlight), 35 * portion which is most relevant and should be emphasized (highlight),
27 * and the parts both before and after this portion. The message is the 36 * and the parts both before and after this portion. The title is the
28 * error message, which will be the mouseover hint for the highlighted 37 * error message, which will be the mouseover hint for the highlighted
29 * region. These may be empty. 38 * region. These may be empty.
30 * @param {string} emptyMessage The message to display if the code 39 * @param {string} emptyMessage The message to display if the code
31 * object is empty (e.g., 'could not load code'). 40 * object is empty (e.g., 'could not load code').
32 */ 41 */
33 populate: function(code, emptyMessage) { 42 populate: function(code, emptyMessage) {
34 // Clear any remnant content, so we don't have multiple code listed. 43 // Clear any remnant content, so we don't have multiple code listed.
35 this.clear(); 44 this.clear();
36 45
37 var sourceDiv = document.createElement('div'); 46 var sourceDiv = document.createElement('div');
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (errorSpan) 109 if (errorSpan)
101 this.scrollTop = errorSpan.offsetTop - this.clientHeight / 2; 110 this.scrollTop = errorSpan.offsetTop - this.clientHeight / 2;
102 } 111 }
103 }; 112 };
104 113
105 // Export 114 // Export
106 return { 115 return {
107 ExtensionCode: ExtensionCode 116 ExtensionCode: ExtensionCode
108 }; 117 };
109 }); 118 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698