Chromium Code Reviews| 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 /** @public */ | |
|
stevenjb
2017/05/11 17:20:16
We don't use @public since that is the default. We
weidongg
2017/05/11 18:09:30
Done.
| |
| 17 updateInfo: { | |
| 18 type: Object, | |
| 19 value: {version: '', size: ''}, | |
|
stevenjb
2017/05/11 17:20:16
Shouldn't need to provide a default value here sin
weidongg
2017/05/11 18:09:30
Done.
| |
| 20 observer: '_updateInfoChanged', | |
|
stevenjb
2017/05/11 17:20:16
Polymer uses _foo, but in the WebUI code we use fo
weidongg
2017/05/11 18:09:30
Done.
| |
| 21 }, | |
| 22 }, | |
| 23 | |
| 24 /** @private {?settings.AboutPageBrowserProxy} */ | |
| 25 browserProxy_: null, | |
| 26 | |
| 15 /** @override */ | 27 /** @override */ |
| 16 ready: function() { | 28 ready: function() { |
| 17 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); | 29 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); |
| 18 }, | 30 }, |
| 19 | 31 |
| 20 /** @override */ | 32 /** @override */ |
| 21 attached: function() { | 33 attached: function() { |
| 22 this.$.dialog.showModal(); | 34 this.$.dialog.showModal(); |
| 23 }, | 35 }, |
| 24 | 36 |
| 25 /** @private */ | 37 /** @private */ |
| 26 onCancelTap_: function() { | 38 onCancelTap_: function() { |
| 27 // TODO(weidongg): implement the real behaviors here. | |
| 28 this.$.dialog.close(); | 39 this.$.dialog.close(); |
| 29 }, | 40 }, |
| 30 | 41 |
| 31 /** @private */ | 42 /** @private */ |
| 32 onContinueTap_: function() { | 43 onContinueTap_: function() { |
| 33 // TODO(weidongg): implement the real behaviors here. | 44 this.browserProxy_.requestUpdateOverCellular(this.updateInfo.version, |
| 45 this.updateInfo.size); | |
| 34 this.$.dialog.close(); | 46 this.$.dialog.close(); |
| 35 }, | 47 }, |
| 36 | 48 |
| 37 /** | 49 /** |
| 38 * @param {string} updateSizeMb Size of the update in megabytes. | 50 * @param {string} updateSize Size of the update in bytes. |
| 39 * @private | 51 * @private |
| 40 */ | 52 */ |
| 41 setUpdateWarningMessage: function(updateSizeMb) { | 53 _updateInfoChanged: function() { |
|
stevenjb
2017/05/11 17:20:16
updateInfoChanged_:
weidongg
2017/05/11 18:09:30
Done.
| |
| 42 this.$$("#update-warning-message").innerHTML = | 54 this.$$("#update-warning-message").innerHTML = |
| 43 this.i18n("aboutUpdateWarningMessage", updateSizeMb); | 55 this.i18n("aboutUpdateWarningMessage", |
| 56 // Convert bytes to megabytes | |
| 57 Math.floor(Number(this.updateInfo.size) / (1024 * 1024))); | |
| 44 }, | 58 }, |
| 45 }); | 59 }); |
| OLD | NEW |