Commit 9cc0da7d authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

cros: Use AlertDialog for remora device requisition.

BUG=313854

Review URL: https://codereview.chromium.org/61523002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@233547 0039d316-1c4b-4281-b951-d872f2087c98
parent 858310c0
......@@ -229,10 +229,8 @@ cr.define('cr.ui.login', function() {
if (this.isOobeUI())
this.showDeviceRequisitionPrompt_();
} else if (name == ACCELERATOR_DEVICE_REQUISITION_REMORA) {
if (this.isOobeUI()) {
this.deviceRequisition_ = 'remora';
this.showDeviceRequisitionPrompt_();
}
if (this.isOobeUI())
this.showDeviceRequisitionRemoraPrompt_();
} else if (name == ACCELERATOR_APP_LAUNCH_BAILOUT) {
var currentStepId = this.screens_[this.currentStep_];
if (currentStepId == SCREEN_APP_LAUNCH_SPLASH)
......@@ -589,6 +587,24 @@ cr.define('cr.ui.login', function() {
this.deviceRequisition_ = requisition;
},
/**
* Shows the special remora device requisition prompt.
* @private
*/
showDeviceRequisitionRemoraPrompt_: function() {
if (!this.deviceRequisitionRemoraDialog_) {
this.deviceRequisitionRemoraDialog_ =
new cr.ui.dialogs.AlertDialog(document.body);
this.deviceRequisitionRemoraDialog_.setOkLabel(
loadTimeData.getString('deviceRequisitionPromptOk'));
}
this.deviceRequisitionRemoraDialog_.show(
loadTimeData.getString('deviceRequisitionRemoraPromptText'),
function() {
chrome.send('setDeviceRequisition', ['remora']);
});
},
/**
* Returns true if Oobe UI is shown.
*/
......
......@@ -89,8 +89,11 @@ void CoreOobeHandler::DeclareLocalizedValues(LocalizedValuesBuilder* builder) {
IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_CANCEL);
builder->Add("deviceRequisitionPromptOk",
IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_OK);
// TODO(xiyuan): Restore generic device requisition prompt text.
builder->Add("deviceRequisitionPromptText",
IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_TEXT);
builder->Add("deviceRequisitionRemoraPromptText",
IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_TEXT);
}
void CoreOobeHandler::Initialize() {
......
......@@ -91,7 +91,9 @@ cr.define('cr.ui.dialogs', function() {
BaseDialog.prototype.onContainerKeyDown_ = function(event) {
// Handle Escape.
if (event.keyCode == 27 && !this.cancelButton_.disabled) {
if (event.keyCode == 27 &&
!this.cancelButton_.disabled &&
!this.cancelButton_.hidden) {
this.onCancelClick_(event);
event.stopPropagation();
// Prevent the event from being handled by the container of the dialog.
......@@ -242,7 +244,8 @@ cr.define('cr.ui.dialogs', function() {
*/
function AlertDialog(parentNode) {
BaseDialog.apply(this, [parentNode]);
this.cancelButton_.style.display = 'none';
this.cancelButton_.hidden = true;
this.closeButton_.hidden = true;
}
AlertDialog.prototype = {__proto__: BaseDialog.prototype};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment