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

Side by Side Diff: chrome/browser/resources/local_ntp/instant_iframe_validation.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 /** 6 /**
7 * @fileoverview Helpers for validating parameters to chrome-search:// iframes. 7 * @fileoverview Helpers for validating parameters to chrome-search:// iframes.
8 */ 8 */
9 9
10 10
(...skipping 20 matching lines...) Expand all
31 * @param {number} component An RGBA component. 31 * @param {number} component An RGBA component.
32 * @return {boolean} True if the component is valid. 32 * @return {boolean} True if the component is valid.
33 */ 33 */
34 function isValidRBGAComponent(component) { 34 function isValidRBGAComponent(component) {
35 return isFinite(component) && component >= 0 && component <= 255; 35 return isFinite(component) && component >= 0 && component <= 255;
36 } 36 }
37 37
38 38
39 /** 39 /**
40 * Converts an Array of color components into RGBA format "rgba(R,G,B,A)". 40 * Converts an Array of color components into RGBA format "rgba(R,G,B,A)".
41 * @param {Array.<number>} rgbaColor Array of rgba color components. 41 * @param {Array<number>} rgbaColor Array of rgba color components.
42 * @return {?string} CSS color in RGBA format or null if invalid. 42 * @return {?string} CSS color in RGBA format or null if invalid.
43 */ 43 */
44 function convertArrayToRGBAColor(rgbaColor) { 44 function convertArrayToRGBAColor(rgbaColor) {
45 // Array must contain 4 valid components. 45 // Array must contain 4 valid components.
46 if (rgbaColor instanceof Array && rgbaColor.length === 4 && 46 if (rgbaColor instanceof Array && rgbaColor.length === 4 &&
47 isValidRBGAComponent(rgbaColor[0]) && 47 isValidRBGAComponent(rgbaColor[0]) &&
48 isValidRBGAComponent(rgbaColor[1]) && 48 isValidRBGAComponent(rgbaColor[1]) &&
49 isValidRBGAComponent(rgbaColor[2]) && 49 isValidRBGAComponent(rgbaColor[2]) &&
50 isValidRBGAComponent(rgbaColor[3])) { 50 isValidRBGAComponent(rgbaColor[3])) {
51 return 'rgba(' + 51 return 'rgba(' +
52 rgbaColor[0] + ',' + 52 rgbaColor[0] + ',' +
53 rgbaColor[1] + ',' + 53 rgbaColor[1] + ',' +
54 rgbaColor[2] + ',' + 54 rgbaColor[2] + ',' +
55 rgbaColor[3] / 255 + ')'; 55 rgbaColor[3] / 255 + ')';
56 } 56 }
57 return null; 57 return null;
58 } 58 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/local_discovery/local_discovery.js ('k') | chrome/browser/resources/local_ntp/local_ntp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698