Index: chrome/browser/resources/file_manager/foreground/js/default_action_dialog.js |
diff --git a/chrome/browser/resources/file_manager/foreground/js/default_action_dialog.js b/chrome/browser/resources/file_manager/foreground/js/default_action_dialog.js |
index a5c8290a2397b3b6b0097df240bb7167a14787e0..9683ca8dd6fe98742f03a927afa7863125a771f4 100644 |
--- a/chrome/browser/resources/file_manager/foreground/js/default_action_dialog.js |
+++ b/chrome/browser/resources/file_manager/foreground/js/default_action_dialog.js |
@@ -93,14 +93,17 @@ cr.define('cr.filebrowser', function() { |
* @param {string} message Message in dialog caption. |
* @param {Array.<Object>} items Items to render in the list. |
* @param {number} defaultIndex Item to select by default. |
- * @param {function(Object=)} opt_onOk OK callback with the selected item. |
- * @param {function()=} opt_onCancel Cancel callback. |
+ * @param {function(Object=)} onSelected Callback with the selected item. |
hirono
2013/12/09 06:30:16
An argument of the callback function seems not to
yoshiki
2013/12/12 13:22:25
Done.
|
+ * @param {function()=} opt_onCancel Cancel callback with no selected item. |
*/ |
DefaultActionDialog.prototype.show = function(title, message, items, |
hirono
2013/12/09 06:30:16
Could you move the file into the js/ui directory?
yoshiki
2013/12/12 13:22:25
I think so, but there are some other files which s
|
- defaultIndex, opt_onOk, opt_onCancel) { |
+ defaultIndex, onSelectedItem, opt_onCancel) { |
- var show = FileManagerDialogBase.prototype.showOkCancelDialog.call( |
- this, title, message, opt_onOk, opt_onCancel); |
+ this.onSelectedItemCallback_ = onSelectedItem; |
+ this.onCancelledCallback_ = opt_onCancel || function() {}; |
+ |
+ var show = FileManagerDialogBase.prototype.showTitleAndTextDialog.call( |
+ this, title, message); |
if (!show) { |
console.error('DefaultActionDialog can\'t be shown.'); |
@@ -128,14 +131,14 @@ cr.define('cr.filebrowser', function() { |
*/ |
DefaultActionDialog.prototype.activateItemAtIndex_ = function(index) { |
this.hide(); |
- this.onOk_(this.dataModel_.item(index)); |
+ this.onSelectedItemCallback_(this.dataModel_.item(index)); |
}; |
/** |
* Closes dialog and invokes callback with currently-selected item. |
* @override |
hirono
2013/12/09 06:30:16
This is no longer override method.
yoshiki
2013/12/12 13:22:25
Done.
|
*/ |
- DefaultActionDialog.prototype.onOkClick_ = function() { |
+ DefaultActionDialog.prototype.onSelected_ = function() { |
this.activateItemAtIndex_(this.selectionModel_.selectedIndex); |
}; |
@@ -145,10 +148,10 @@ cr.define('cr.filebrowser', function() { |
DefaultActionDialog.prototype.onContainerKeyDown_ = function(event) { |
// Handle Escape. |
if (event.keyCode == 27) { |
- this.onCancelClick_(event); |
+ this.hide(); |
event.preventDefault(); |
} else if (event.keyCode == 32 || event.keyCode == 13) { |
- this.onOkClick_(); |
+ this.onSelected_(); |
hirono
2013/12/09 06:30:16
According to the comments of crbug.com/222941, cli
yoshiki
2013/12/12 13:22:25
Done.
|
event.preventDefault(); |
} |
}; |