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() { ...@@ -229,10 +229,8 @@ cr.define('cr.ui.login', function() {
if (this.isOobeUI()) if (this.isOobeUI())
this.showDeviceRequisitionPrompt_(); this.showDeviceRequisitionPrompt_();
} else if (name == ACCELERATOR_DEVICE_REQUISITION_REMORA) { } else if (name == ACCELERATOR_DEVICE_REQUISITION_REMORA) {
if (this.isOobeUI()) { if (this.isOobeUI())
this.deviceRequisition_ = 'remora'; this.showDeviceRequisitionRemoraPrompt_();
this.showDeviceRequisitionPrompt_();
}
} else if (name == ACCELERATOR_APP_LAUNCH_BAILOUT) { } else if (name == ACCELERATOR_APP_LAUNCH_BAILOUT) {
var currentStepId = this.screens_[this.currentStep_]; var currentStepId = this.screens_[this.currentStep_];
if (currentStepId == SCREEN_APP_LAUNCH_SPLASH) if (currentStepId == SCREEN_APP_LAUNCH_SPLASH)
...@@ -589,6 +587,24 @@ cr.define('cr.ui.login', function() { ...@@ -589,6 +587,24 @@ cr.define('cr.ui.login', function() {
this.deviceRequisition_ = requisition; 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. * Returns true if Oobe UI is shown.
*/ */
......
...@@ -89,8 +89,11 @@ void CoreOobeHandler::DeclareLocalizedValues(LocalizedValuesBuilder* builder) { ...@@ -89,8 +89,11 @@ void CoreOobeHandler::DeclareLocalizedValues(LocalizedValuesBuilder* builder) {
IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_CANCEL); IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_CANCEL);
builder->Add("deviceRequisitionPromptOk", builder->Add("deviceRequisitionPromptOk",
IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_OK); IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_OK);
// TODO(xiyuan): Restore generic device requisition prompt text.
builder->Add("deviceRequisitionPromptText", builder->Add("deviceRequisitionPromptText",
IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_TEXT); IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_TEXT);
builder->Add("deviceRequisitionRemoraPromptText",
IDS_ENTERPRISE_DEVICE_REQUISITION_PROMPT_TEXT);
} }
void CoreOobeHandler::Initialize() { void CoreOobeHandler::Initialize() {
......
...@@ -91,7 +91,9 @@ cr.define('cr.ui.dialogs', function() { ...@@ -91,7 +91,9 @@ cr.define('cr.ui.dialogs', function() {
BaseDialog.prototype.onContainerKeyDown_ = function(event) { BaseDialog.prototype.onContainerKeyDown_ = function(event) {
// Handle Escape. // Handle Escape.
if (event.keyCode == 27 && !this.cancelButton_.disabled) { if (event.keyCode == 27 &&
!this.cancelButton_.disabled &&
!this.cancelButton_.hidden) {
this.onCancelClick_(event); this.onCancelClick_(event);
event.stopPropagation(); event.stopPropagation();
// Prevent the event from being handled by the container of the dialog. // Prevent the event from being handled by the container of the dialog.
...@@ -242,7 +244,8 @@ cr.define('cr.ui.dialogs', function() { ...@@ -242,7 +244,8 @@ cr.define('cr.ui.dialogs', function() {
*/ */
function AlertDialog(parentNode) { function AlertDialog(parentNode) {
BaseDialog.apply(this, [parentNode]); BaseDialog.apply(this, [parentNode]);
this.cancelButton_.style.display = 'none'; this.cancelButton_.hidden = true;
this.closeButton_.hidden = true;
} }
AlertDialog.prototype = {__proto__: BaseDialog.prototype}; 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