Chromium Code Reviews| Index: content/browser/resources/media/util/goog.js |
| diff --git a/content/browser/resources/media/util/goog.js b/content/browser/resources/media/util/goog.js |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..629a4bfd5b57c7a06e0eb9c0a77cdb879b45e0b3 |
| --- /dev/null |
| +++ b/content/browser/resources/media/util/goog.js |
| @@ -0,0 +1,54 @@ |
| +/** |
| + * @fileoverview Description of this file. |
| + */ |
| + |
| +var goog = {}; |
|
scherkus (not reviewing)
2013/07/18 02:18:10
what's the origin of this file?
is it copied from
Ty Overby
2013/07/18 16:57:17
Kind of. It uses the same names and sometimes the
|
| +goog.object = {}; |
| +goog.object.forEach = function (obj, f, optObj) { |
| + "use strict"; |
| + var key; |
| + for (key in obj) { |
| + if (obj.hasOwnProperty(key)) { |
| + f.call(optObj, obj[key], key, obj); |
| + } |
| + } |
| +}; |
| + |
| +goog.array = {}; |
| +goog.array.forEach = function (arr, f, env) { |
| + "use strict"; |
| + |
| + f = f.bind(env); |
| + |
| + var len = arr.length, |
| + i = 0; |
| + for (i = 0; i < len; i += 1) { |
| + f(arr[i]); |
| + } |
| +}; |
| + |
| +goog.array.filter = function (arr, f) { |
| + "use strict"; |
| + return arr.filter(f); |
| +}; |
| + |
| +goog.array.map = function (arr, f) { |
| + "use strict"; |
| + return arr.map(f); |
| +}; |
| + |
| +goog.time = {}; |
| +goog.time.millisToString = function (timeMillis) { |
| + "use strict"; |
| + function pad(num) { |
| + num = num.toString(); |
| + if (num.length < 2) { |
| + return "0" + num; |
| + } |
| + return num; |
| + } |
| + |
| + var date = new Date(timeMillis); |
| + return pad(date.getUTCHours()) + ':' + pad(date.getUTCMinutes()) + ':' + |
| + pad(date.getUTCSeconds()) + ' ' + pad((date.getMilliseconds()) % 1000); |
| +}; |