| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 5 * Copyright (C) 2009 Joseph Pecoraro | 5 * Copyright (C) 2009 Joseph Pecoraro |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2007 */ | 2007 */ |
| 2008 UI.loadImage = function(url) { | 2008 UI.loadImage = function(url) { |
| 2009 return new Promise(fulfill => { | 2009 return new Promise(fulfill => { |
| 2010 var image = new Image(); | 2010 var image = new Image(); |
| 2011 image.addEventListener('load', () => fulfill(image)); | 2011 image.addEventListener('load', () => fulfill(image)); |
| 2012 image.addEventListener('error', () => fulfill(null)); | 2012 image.addEventListener('error', () => fulfill(null)); |
| 2013 image.src = url; | 2013 image.src = url; |
| 2014 }); | 2014 }); |
| 2015 }; | 2015 }; |
| 2016 | 2016 |
| 2017 /** |
| 2018 * @param {?string} data |
| 2019 * @return {!Promise<?Image>} |
| 2020 */ |
| 2021 UI.loadImageFromData = function(data) { |
| 2022 return data ? UI.loadImage('data:image/jpg;base64,' + data) : Promise.resolve(
null); |
| 2023 }; |
| 2024 |
| 2017 /** @type {!UI.ThemeSupport} */ | 2025 /** @type {!UI.ThemeSupport} */ |
| 2018 UI.themeSupport; | 2026 UI.themeSupport; |
| 2019 | 2027 |
| 2020 /** | 2028 /** |
| 2021 * @param {function(!File)} callback | 2029 * @param {function(!File)} callback |
| 2022 * @return {!Node} | 2030 * @return {!Node} |
| 2023 */ | 2031 */ |
| 2024 UI.createFileSelectorElement = function(callback) { | 2032 UI.createFileSelectorElement = function(callback) { |
| 2025 var fileSelectorElement = createElement('input'); | 2033 var fileSelectorElement = createElement('input'); |
| 2026 fileSelectorElement.type = 'file'; | 2034 fileSelectorElement.type = 'file'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 */ | 2080 */ |
| 2073 constructor(message, okCallback, cancelCallback) { | 2081 constructor(message, okCallback, cancelCallback) { |
| 2074 super(true); | 2082 super(true); |
| 2075 this.registerRequiredCSS('ui/confirmDialog.css'); | 2083 this.registerRequiredCSS('ui/confirmDialog.css'); |
| 2076 this.contentElement.createChild('div', 'message').createChild('span').textCo
ntent = message; | 2084 this.contentElement.createChild('div', 'message').createChild('span').textCo
ntent = message; |
| 2077 var buttonsBar = this.contentElement.createChild('div', 'button'); | 2085 var buttonsBar = this.contentElement.createChild('div', 'button'); |
| 2078 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback
)); | 2086 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback
)); |
| 2079 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel
Callback)); | 2087 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel
Callback)); |
| 2080 } | 2088 } |
| 2081 }; | 2089 }; |
| OLD | NEW |