Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Unified Diff: ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js

Issue 2930443002: Show confirmation dialog when copy/move operation affect other members. (Closed)
Patch Set: Address comments. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
index 54cf35f6743e09bc7700242bdd03fda795f4adff..06f54f2cb0824cf287844f0fdf36c52623f72be8 100644
--- a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
+++ b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
@@ -72,6 +72,22 @@ function FileManagerUI(providersModel, element, launchParam) {
this.deleteConfirmDialog = new FilesConfirmDialog(this.element);
this.deleteConfirmDialog.setOkLabel(str('DELETE_BUTTON_LABEL'));
+ /**
+ * Confirm dialog for file move operation.
+ * @type {!FilesConfirmDialog}
+ * @const
+ */
+ this.moveConfirmDialog = new FilesConfirmDialog(this.element);
+ this.moveConfirmDialog.setOkLabel(str('CONFIRM_MOVE_BUTTON_LABEL'));
+
+ /**
+ * Confirm dialog for file copy operation.
+ * @type {!FilesConfirmDialog}
+ * @const
+ */
+ this.copyConfirmDialog = new FilesConfirmDialog(this.element);
+ this.copyConfirmDialog.setOkLabel(str('CONFIRM_COPY_BUTTON_LABEL'));
+
/**
* Share dialog.
* @type {!ShareDialog}
@@ -541,3 +557,29 @@ FileManagerUI.prototype.showOpenInOtherDesktopAlert = function(entries) {
this.alertDialog.showWithTitle(title, message, null, null, null);
}.bind(this));
};
+
+/**
+ * Shows confirmation dialog and handles user interaction.
+ * @param {boolean} isMove true if the operation is move. false if copy.
+ * @param {!Array<string>} messages The messages to show in the dialog.
+ * box.
+ * @return {!Promise<boolean>}
+ */
+FileManagerUI.prototype.showConfirmationDialog = function(isMove, messages) {
+ var dialog = null;
+ if (isMove) {
+ dialog = this.moveConfirmDialog;
+ } else {
+ dialog = this.copyConfirmDialog;
+ }
+ return new Promise(function(resolve, reject) {
+ dialog.show(
+ messages.join(' '),
+ function() {
+ resolve(true);
+ },
+ function() {
+ resolve(false);
+ });
+ });
+};

Powered by Google App Engine
This is Rietveld 408576698