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

Side by Side Diff: chrome/browser/resources/suggestions_internals/suggestions_internals.js

Issue 917093003: Shorten Closure template notation from Array.<*> to Array<*>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove cvox Created 5 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * Javascript for suggestions_internals.html, served from 6 * Javascript for suggestions_internals.html, served from
7 * chrome://suggestions-internals/. This is used to debug suggestions ranking. 7 * chrome://suggestions-internals/. This is used to debug suggestions ranking.
8 * When loaded, the page will show the current set of suggestions, along with a 8 * When loaded, the page will show the current set of suggestions, along with a
9 * large set of information (e.g. all the signals that were taken into 9 * large set of information (e.g. all the signals that were taken into
10 * consideration for deciding which pages were selected to be shown to the user) 10 * consideration for deciding which pages were selected to be shown to the user)
(...skipping 23 matching lines...) Expand all
34 * Reloads the suggestions data by sending a 'getSuggestions' message to 34 * Reloads the suggestions data by sending a 'getSuggestions' message to
35 * Chrome. The C++ code is then expected to call 'setSuggestions' when there 35 * Chrome. The C++ code is then expected to call 'setSuggestions' when there
36 * are suggestions ready. 36 * are suggestions ready.
37 */ 37 */
38 function refresh() { 38 function refresh() {
39 chrome.send('getSuggestions'); 39 chrome.send('getSuggestions');
40 } 40 }
41 41
42 /** 42 /**
43 * A list of columns that we do not want to display. 43 * A list of columns that we do not want to display.
44 * @type {Array.<string>} 44 * @type {Array<string>}
45 * @const 45 * @const
46 */ 46 */
47 var IGNORED_COLUMNS = [ 47 var IGNORED_COLUMNS = [
48 'direction' 48 'direction'
49 ]; 49 ];
50 50
51 /** 51 /**
52 * A list specifying the name of the first columns to be displayed. If 52 * A list specifying the name of the first columns to be displayed. If
53 * present, they will be displayed in this order, followed by the remaining 53 * present, they will be displayed in this order, followed by the remaining
54 * columns. 54 * columns.
55 * @type {Array.<string>} 55 * @type {Array<string>}
56 * @const 56 * @const
57 */ 57 */
58 var PREFERRED_COLUMN_ORDER = [ 58 var PREFERRED_COLUMN_ORDER = [
59 'title', 59 'title',
60 'url', 60 'url',
61 'score' 61 'score'
62 ]; 62 ];
63 63
64 function setBooleanColumn(column, value) { 64 function setBooleanColumn(column, value) {
65 if (value) { 65 if (value) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 anchor.innerText = data; 153 anchor.innerText = data;
154 column.appendChild(anchor); 154 column.appendChild(anchor);
155 } else { 155 } else {
156 column.innerText = data; 156 column.innerText = data;
157 } 157 }
158 } else if (columnName == 'rank') { 158 } else if (columnName == 'rank') {
159 column.innerText = rank++; 159 column.innerText = rank++;
160 } else if (columnName == 'screenshot') { 160 } else if (columnName == 'screenshot') {
161 var thumbnailUrl = 'chrome://thumb/' + entry.url; 161 var thumbnailUrl = 'chrome://thumb/' + entry.url;
162 var img = document.createElement('img'); 162 var img = document.createElement('img');
163 img.onload = function() { setBooleanColumn(column, true); } 163 img.onload = function() { setBooleanColumn(column, true); };
164 img.onerror = function() { setBooleanColumn(column, false); } 164 img.onerror = function() { setBooleanColumn(column, false); };
165 img.src = thumbnailUrl; 165 img.src = thumbnailUrl;
166 } else if (columnName == 'favicon') { 166 } else if (columnName == 'favicon') {
167 var faviconUrl = 'chrome://favicon/size/16@1x/' + entry.url; 167 var faviconUrl = 'chrome://favicon/size/16@1x/' + entry.url;
168 column.style.backgroundImage = url(faviconUrl); 168 column.style.backgroundImage = url(faviconUrl);
169 column.style.backgroundRepeat = 'no-repeat'; 169 column.style.backgroundRepeat = 'no-repeat';
170 column.style.backgroundPosition = 'center center'; 170 column.style.backgroundPosition = 'center center';
171 } 171 }
172 row.appendChild(column); 172 row.appendChild(column);
173 }); 173 });
174 table.appendChild(row); 174 table.appendChild(row);
175 }); 175 });
176 176
177 output.appendChild(table); 177 output.appendChild(table);
178 } 178 }
179 179
180 return { 180 return {
181 initialize: initialize, 181 initialize: initialize,
182 setSuggestions: setSuggestions 182 setSuggestions: setSuggestions
183 }; 183 };
184 }); 184 });
185 185
186 document.addEventListener('DOMContentLoaded', suggestionsInternals.initialize); 186 document.addEventListener('DOMContentLoaded', suggestionsInternals.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698