OLD | NEW |
---|---|
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 * The global object. | 6 * The global object. |
7 * @type {!Object} | 7 * @type {!Object} |
8 * @const | 8 * @const |
9 */ | 9 */ |
10 var global = this; | 10 var global = this; |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1054 element.style.left = '-9999px'; | 1054 element.style.left = '-9999px'; |
1055 element.style.height = '0px'; | 1055 element.style.height = '0px'; |
1056 element.innerText = msg; | 1056 element.innerText = msg; |
1057 document.body.appendChild(element); | 1057 document.body.appendChild(element); |
1058 window.setTimeout(function() { | 1058 window.setTimeout(function() { |
1059 document.body.removeChild(element); | 1059 document.body.removeChild(element); |
1060 }, 0); | 1060 }, 0); |
1061 } | 1061 } |
1062 | 1062 |
1063 /** | 1063 /** |
1064 * Calls chrome.send with a callback and restores the original afterwards. | |
1065 * @param {string} name The name of the message to send. | |
1066 * @param {!Array} params The parameters to send. | |
1067 * @param {string} callbackName The name of the function that the backend calls. | |
1068 * @param {!Function} callback The function to call. | |
1069 */ | |
1070 function chromeSend(name, params, callbackName, callback) { | |
1071 var old = global[callbackName]; | |
1072 global[callbackName] = function() { | |
1073 // restore | |
1074 global[callbackName] = old; | |
1075 | |
1076 var args = Array.prototype.slice.call(arguments); | |
1077 return callback.apply(global, args); | |
1078 }; | |
1079 chrome.send(name, params); | |
1080 } | |
1081 | |
1082 /** | |
dschuyler
2016/03/04 19:16:38
This change seems unlike the other changes in this
Dan Beam
2016/03/04 20:23:16
no, the downloads page just hasn't been vulcanized
| |
1083 * Returns the scale factors supported by this platform for webui | 1064 * Returns the scale factors supported by this platform for webui |
1084 * resources. | 1065 * resources. |
1085 * @return {Array} The supported scale factors. | 1066 * @return {Array} The supported scale factors. |
1086 */ | 1067 */ |
1087 function getSupportedScaleFactors() { | 1068 function getSupportedScaleFactors() { |
1088 var supportedScaleFactors = []; | 1069 var supportedScaleFactors = []; |
1089 if (cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux) { | 1070 if (cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux) { |
1090 // All desktop platforms support zooming which also updates the | 1071 // All desktop platforms support zooming which also updates the |
1091 // renderer's device scale factors (a.k.a devicePixelRatio), and | 1072 // renderer's device scale factors (a.k.a devicePixelRatio), and |
1092 // these platforms has high DPI assets for 2.0x. Use 1x and 2x in | 1073 // these platforms has high DPI assets for 2.0x. Use 1x and 2x in |
(...skipping 9391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10484 Manager.get().updateItem_(index, data); | 10465 Manager.get().updateItem_(index, data); |
10485 }; | 10466 }; |
10486 | 10467 |
10487 return {Manager: Manager}; | 10468 return {Manager: Manager}; |
10488 }); | 10469 }); |
10489 // Copyright 2015 The Chromium Authors. All rights reserved. | 10470 // Copyright 2015 The Chromium Authors. All rights reserved. |
10490 // Use of this source code is governed by a BSD-style license that can be | 10471 // Use of this source code is governed by a BSD-style license that can be |
10491 // found in the LICENSE file. | 10472 // found in the LICENSE file. |
10492 | 10473 |
10493 window.addEventListener('load', downloads.Manager.onLoad); | 10474 window.addEventListener('load', downloads.Manager.onLoad); |
OLD | NEW |