| Index: ui/file_manager/file_manager/background/js/background.js
|
| diff --git a/ui/file_manager/file_manager/background/js/background.js b/ui/file_manager/file_manager/background/js/background.js
|
| index 8a12975ca011d2cb054bc5fe8521da9197efe000..8f95590f04bd85296b4171dab509389e1df7df2c 100644
|
| --- a/ui/file_manager/file_manager/background/js/background.js
|
| +++ b/ui/file_manager/file_manager/background/js/background.js
|
| @@ -20,12 +20,18 @@ var LaunchType = Object.freeze({
|
| */
|
| function Background() {
|
| /**
|
| - * Map of all currently open app windows. The key is an app id.
|
| + * Map of all currently open app windows. The key is an app ID.
|
| * @type {Object.<string, AppWindow>}
|
| */
|
| this.appWindows = {};
|
|
|
| /**
|
| + * Map of all currently open file dialogs. The key is an app ID.
|
| + * @type {Object.<string, DOMWindow>}
|
| + */
|
| + this.dialogs = {};
|
| +
|
| + /**
|
| * Synchronous queue for asynchronous calls.
|
| * @type {AsyncUtil.Queue}
|
| */
|
| @@ -536,20 +542,38 @@ SingletonAppWindowWrapper.prototype.reopen = function(opt_callback) {
|
|
|
| /**
|
| * Prefix for the file manager window ID.
|
| + * @type {string}
|
| + * @const
|
| */
|
| var FILES_ID_PREFIX = 'files#';
|
|
|
| /**
|
| * Regexp matching a file manager window ID.
|
| + * @type {RegExp}
|
| + * @const
|
| */
|
| var FILES_ID_PATTERN = new RegExp('^' + FILES_ID_PREFIX + '(\\d*)$');
|
|
|
| /**
|
| + * Prefix for the dialog ID.
|
| + * @type {string}
|
| + * @const
|
| + */
|
| +var DIALOG_ID_PREFIX = 'dialog#';
|
| +
|
| +/**
|
| * Value of the next file manager window ID.
|
| + * @type {number}
|
| */
|
| var nextFileManagerWindowID = 0;
|
|
|
| /**
|
| + * Value of the next file manager dialog ID.
|
| + * @type {number}
|
| + */
|
| +var nextFileManagerDialogID = 0;
|
| +
|
| +/**
|
| * File manager window create options.
|
| * @type {Object}
|
| * @const
|
| @@ -685,6 +709,19 @@ function launchFileManager(opt_appState, opt_id, opt_type, opt_callback) {
|
| }
|
|
|
| /**
|
| + * Registers dialog window to the background page.
|
| + *
|
| + * @param {DOMWindow} dialogWindow Window of the dialog.
|
| + */
|
| +function registerDialog(dialogWindow) {
|
| + var id = DIALOG_ID_PREFIX + (nextFileManagerDialogID++);
|
| + background.dialogs[id] = dialogWindow;
|
| + dialogWindow.addEventListener('pagehide', function() {
|
| + delete background.dialogs[id];
|
| + });
|
| +}
|
| +
|
| +/**
|
| * Executes a file browser task.
|
| *
|
| * @param {string} action Task id.
|
|
|