| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 * @fileoverview 'settings-update-warning-dialog' is a component warning the | 6 * @fileoverview 'settings-update-warning-dialog' is a component warning the |
| 7 * user about update over mobile data. By clicking 'Continue', the user | 7 * user about update over mobile data. By clicking 'Continue', the user |
| 8 * agrees to download update using mobile data. | 8 * agrees to download update using mobile data. |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| 11 is: 'settings-update-warning-dialog', | 11 is: 'settings-update-warning-dialog', |
| 12 | 12 |
| 13 behaviors: [I18nBehavior], | 13 behaviors: [I18nBehavior], |
| 14 | 14 |
| 15 properties: { |
| 16 /** @type {!AboutPageUpdateInfo|undefined} */ |
| 17 updateInfo: { |
| 18 type: Object, |
| 19 observer: 'updateInfoChanged_', |
| 20 }, |
| 21 }, |
| 22 |
| 23 /** @private {?settings.AboutPageBrowserProxy} */ |
| 24 browserProxy_: null, |
| 25 |
| 15 /** @override */ | 26 /** @override */ |
| 16 ready: function() { | 27 ready: function() { |
| 17 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); | 28 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); |
| 18 }, | 29 }, |
| 19 | 30 |
| 20 /** @override */ | 31 /** @override */ |
| 21 attached: function() { | 32 attached: function() { |
| 22 this.$.dialog.showModal(); | 33 this.$.dialog.showModal(); |
| 23 }, | 34 }, |
| 24 | 35 |
| 25 /** @private */ | 36 /** @private */ |
| 26 onCancelTap_: function() { | 37 onCancelTap_: function() { |
| 27 // TODO(weidongg): implement the real behaviors here. | |
| 28 this.$.dialog.close(); | 38 this.$.dialog.close(); |
| 29 }, | 39 }, |
| 30 | 40 |
| 31 /** @private */ | 41 /** @private */ |
| 32 onContinueTap_: function() { | 42 onContinueTap_: function() { |
| 33 // TODO(weidongg): implement the real behaviors here. | 43 this.browserProxy_.requestUpdateOverCellular(this.updateInfo.version, |
| 44 this.updateInfo.size); |
| 34 this.$.dialog.close(); | 45 this.$.dialog.close(); |
| 35 }, | 46 }, |
| 36 | 47 |
| 37 /** | 48 /** @private */ |
| 38 * @param {string} updateSizeMb Size of the update in megabytes. | 49 updateInfoChanged_: function() { |
| 39 * @private | 50 this.$$("#update-warning-message").innerHTML = |
| 40 */ | 51 this.i18n("aboutUpdateWarningMessage", |
| 41 setUpdateWarningMessage: function(updateSizeMb) { | 52 // Convert bytes to megabytes |
| 42 this.$$("#update-warning-message").innerHTML = | 53 Math.floor(Number(this.updateInfo.size) / (1024 * 1024))); |
| 43 this.i18n("aboutUpdateWarningMessage", updateSizeMb); | |
| 44 }, | 54 }, |
| 45 }); | 55 }); |
| OLD | NEW |