| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 cr.define('help', function() { | 5 cr.define('help', function() { |
| 6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Encapsulated handling of the About page. Called 'help' internally to avoid | 10 * Encapsulated handling of the About page. Called 'help' internally to avoid |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 * @private | 45 * @private |
| 46 */ | 46 */ |
| 47 status_: null, | 47 status_: null, |
| 48 | 48 |
| 49 /** | 49 /** |
| 50 * Last message received from the version updater. | 50 * Last message received from the version updater. |
| 51 * @private | 51 * @private |
| 52 */ | 52 */ |
| 53 message_: null, | 53 message_: null, |
| 54 | 54 |
| 55 /** |
| 56 * True if user is allowed to change channels, false otherwise. |
| 57 * @private |
| 58 */ |
| 59 can_change_channel_: false, |
| 60 |
| 55 /** @override */ | 61 /** @override */ |
| 56 initializePage: function() { | 62 initializePage: function() { |
| 57 Page.prototype.initializePage.call(this); | 63 Page.prototype.initializePage.call(this); |
| 58 | 64 |
| 59 $('product-license').innerHTML = loadTimeData.getString('productLicense'); | 65 $('product-license').innerHTML = loadTimeData.getString('productLicense'); |
| 60 if (cr.isChromeOS) { | 66 if (cr.isChromeOS) { |
| 61 $('product-os-license').innerHTML = | 67 $('product-os-license').innerHTML = |
| 62 loadTimeData.getString('productOsLicense'); | 68 loadTimeData.getString('productOsLicense'); |
| 63 } | 69 } |
| 64 | 70 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 314 } |
| 309 } else if (status == 'updated') { | 315 } else if (status == 'updated') { |
| 310 this.setUpdateImage_('up-to-date'); | 316 this.setUpdateImage_('up-to-date'); |
| 311 $('update-status-message').innerHTML = | 317 $('update-status-message').innerHTML = |
| 312 loadTimeData.getString('upToDate'); | 318 loadTimeData.getString('upToDate'); |
| 313 } else if (status == 'failed') { | 319 } else if (status == 'failed') { |
| 314 this.setUpdateImage_('failed'); | 320 this.setUpdateImage_('failed'); |
| 315 $('update-status-message').innerHTML = message; | 321 $('update-status-message').innerHTML = message; |
| 316 } | 322 } |
| 317 | 323 |
| 324 $('change-channel').disabled = !this.can_change_channel_ || |
| 325 status == 'nearly_updated'; |
| 326 $('channel-change-disallowed-icon').hidden = this.can_change_channel_; |
| 327 |
| 318 // Following invariant must be established at the end of this function: | 328 // Following invariant must be established at the end of this function: |
| 319 // { ~$('relaunch_and_powerwash').hidden -> $('relaunch').hidden } | 329 // { ~$('relaunch_and_powerwash').hidden -> $('relaunch').hidden } |
| 320 var relaunchAndPowerwashHidden = true; | 330 var relaunchAndPowerwashHidden = true; |
| 321 if ($('relaunch-and-powerwash')) { | 331 if ($('relaunch-and-powerwash')) { |
| 322 // It's allowed to do powerwash only for customer devices, | 332 // It's allowed to do powerwash only for customer devices, |
| 323 // when user explicitly decides to update to a more stable | 333 // when user explicitly decides to update to a more stable |
| 324 // channel. | 334 // channel. |
| 325 relaunchAndPowerwashHidden = | 335 relaunchAndPowerwashHidden = |
| 326 !this.targetChannelIsMoreStable_() || status != 'nearly_updated'; | 336 !this.targetChannelIsMoreStable_() || status != 'nearly_updated'; |
| 327 $('relaunch-and-powerwash').hidden = relaunchAndPowerwashHidden; | 337 $('relaunch-and-powerwash').hidden = relaunchAndPowerwashHidden; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 help.ChannelChangePage.updateTargetChannel(channel); | 498 help.ChannelChangePage.updateTargetChannel(channel); |
| 489 this.updateUI_(); | 499 this.updateUI_(); |
| 490 }, | 500 }, |
| 491 | 501 |
| 492 /** | 502 /** |
| 493 * @param {boolean} enabled True if the release channel can be enabled. | 503 * @param {boolean} enabled True if the release channel can be enabled. |
| 494 * @private | 504 * @private |
| 495 */ | 505 */ |
| 496 updateEnableReleaseChannel_: function(enabled) { | 506 updateEnableReleaseChannel_: function(enabled) { |
| 497 this.updateChannelChangerContainerVisibility_(enabled); | 507 this.updateChannelChangerContainerVisibility_(enabled); |
| 498 $('change-channel').disabled = !enabled; | 508 this.can_change_channel_ = enabled; |
| 499 $('channel-change-disallowed-icon').hidden = enabled; | 509 this.updateUI_(); |
| 500 }, | 510 }, |
| 501 | 511 |
| 502 /** | 512 /** |
| 503 * Sets the device target channel. | 513 * Sets the device target channel. |
| 504 * @param {string} channel The name of the target channel. | 514 * @param {string} channel The name of the target channel. |
| 505 * @param {boolean} isPowerwashAllowed True iff powerwash is allowed. | 515 * @param {boolean} isPowerwashAllowed True iff powerwash is allowed. |
| 506 * @private | 516 * @private |
| 507 */ | 517 */ |
| 508 setChannel_: function(channel, isPowerwashAllowed) { | 518 setChannel_: function(channel, isPowerwashAllowed) { |
| 509 chrome.send('setChannel', [channel, isPowerwashAllowed]); | 519 chrome.send('setChannel', [channel, isPowerwashAllowed]); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 | 628 |
| 619 HelpPage.setBuildDate = function(buildDate) { | 629 HelpPage.setBuildDate = function(buildDate) { |
| 620 HelpPage.getInstance().setBuildDate_(buildDate); | 630 HelpPage.getInstance().setBuildDate_(buildDate); |
| 621 }; | 631 }; |
| 622 | 632 |
| 623 // Export | 633 // Export |
| 624 return { | 634 return { |
| 625 HelpPage: HelpPage | 635 HelpPage: HelpPage |
| 626 }; | 636 }; |
| 627 }); | 637 }); |
| OLD | NEW |