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 /** @private {?settings.AboutPageBrowserProxy} */ |
| 16 browserProxy_: null, |
| 17 |
15 /** @override */ | 18 /** @override */ |
16 ready: function() { | 19 ready: function() { |
17 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); | 20 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); |
18 }, | 21 }, |
19 | 22 |
20 /** @override */ | 23 /** @override */ |
21 attached: function() { | 24 attached: function() { |
22 this.$.dialog.showModal(); | 25 this.$.dialog.showModal(); |
23 }, | 26 }, |
24 | 27 |
25 /** @private */ | 28 /** @private */ |
26 onCancelTap_: function() { | 29 onCancelTap_: function() { |
27 // TODO(weidongg): implement the real behaviors here. | |
28 this.$.dialog.close(); | 30 this.$.dialog.close(); |
29 }, | 31 }, |
30 | 32 |
31 /** @private */ | 33 /** @private */ |
32 onContinueTap_: function() { | 34 onContinueTap_: function() { |
33 // TODO(weidongg): implement the real behaviors here. | 35 this.browserProxy_.requestUpdateOverCellular(this.target_version, |
| 36 this.target_size); |
34 this.$.dialog.close(); | 37 this.$.dialog.close(); |
35 }, | 38 }, |
36 | 39 |
37 /** | 40 /** |
38 * @param {string} updateSizeMb Size of the update in megabytes. | 41 * @param {string} updateSize Size of the update in bytes. |
39 * @private | 42 * @private |
40 */ | 43 */ |
41 setUpdateWarningMessage: function(updateSizeMb) { | 44 setUpdateWarningMessage: function(version, size) { |
42 this.$$("#update-warning-message").innerHTML = | 45 this.target_version = version; |
43 this.i18n("aboutUpdateWarningMessage", updateSizeMb); | 46 this.target_size = size; |
| 47 this.$$("#update-warning-message").innerHTML = |
| 48 this.i18n("aboutUpdateWarningMessage", |
| 49 // Convert bytes to megabytes |
| 50 Math.floor(Number(size) / (1024 * 1024))); |
44 }, | 51 }, |
45 }); | 52 }); |
OLD | NEW |