// found in the LICENSE file.
cr.define('help', function() {
+ var Page = cr.ui.pageManager.Page;
+ var PageManager = cr.ui.pageManager.PageManager;
+
/**
* Encapsulated handling of the channel change overlay.
*/
- function ChannelChangePage() {}
+ function ChannelChangePage() {
+ Page.call(this, 'channel-change-page', '', 'channel-change-page');
+ }
cr.addSingletonGetter(ChannelChangePage);
ChannelChangePage.prototype = {
- __proto__: help.HelpBasePage.prototype,
+ __proto__: Page.prototype,
/**
* Name of the channel the device is currently on.
'selected-channel-good',
'selected-channel-unstable'],
- /**
- * Perform initial setup.
- */
- initialize: function() {
- help.HelpBasePage.prototype.initialize.call(this, 'channel-change-page');
+ /** override */
+ initializePage: function() {
+ Page.prototype.initializePage.call(this);
- var self = this;
-
- $('channel-change-page-cancel-button').onclick = function() {
- help.HelpPage.cancelOverlay();
- };
+ $('channel-change-page-cancel-button').onclick =
+ PageManager.closeOverlay.bind(PageManager);
+ var self = this;
var options = this.getAllChannelOptions_();
for (var i = 0; i < options.length; i++) {
var option = options[i];
$('channel-change-page-powerwash-button').onclick = function() {
self.setChannel_(self.getSelectedOption_(), true);
- help.HelpPage.cancelOverlay();
+ PageManager.closeOverlay();
};
$('channel-change-page-change-button').onclick = function() {
self.setChannel_(self.getSelectedOption_(), false);
- help.HelpPage.cancelOverlay();
+ PageManager.closeOverlay();
};
},
- onBeforeShow: function() {
- help.HelpBasePage.prototype.onBeforeShow.call(this);
+ /** @override */
+ didShowPage: function() {
if (this.targetChannel_ != null)
this.selectOption_(this.targetChannel_);
else if (this.currentChannel_ != null)
/**
* Returns the list of all radio buttons responsible for channel selection.
- * @return {Array.<HTMLInputElement>} Array of radio buttons
+ * @return {NodeList} Array of radio buttons
* @private
*/
getAllChannelOptions_: function() {
- return $('channel-change-page').querySelectorAll('input[type="radio"]');
+ return this.pageDiv.querySelectorAll('input[type="radio"]');
},
/**
* Returns value of the selected option.
- * @return {string} Selected channel name or null, if neither
+ * @return {?string} Selected channel name or null, if neither
* option is selected.
* @private
*/
// Switch to the new UI state.
for (var i = 0; i < this.uiClassTable_.length; i++)
- $('channel-change-page').classList.remove(this.uiClassTable_[i]);
+ this.pageDiv.classList.remove(this.uiClassTable_[i]);
if (newOverlayClass)
- $('channel-change-page').classList.add(newOverlayClass);
+ this.pageDiv.classList.add(newOverlayClass);
},
/**
*/
updateIsEnterpriseManaged_: function(isEnterpriseManaged) {
this.isEnterpriseManaged_ = isEnterpriseManaged;
- help.HelpPage.updateChannelChangePageContainerVisibility();
},
/**
return;
this.currentChannel_ = channel;
this.selectOption_(channel);
- help.HelpPage.updateChannelChangePageContainerVisibility();
},
/**
if (this.channelList_.indexOf(channel) < 0)
return;
this.targetChannel_ = channel;
- help.HelpPage.updateChannelChangePageContainerVisibility();
},
/**