| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * This variable is checked in SelectFileDialogExtensionBrowserTest. | 8 * This variable is checked in SelectFileDialogExtensionBrowserTest. |
| 9 * @type {number} | 9 * @type {number} |
| 10 */ | 10 */ |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 * @private | 784 * @private |
| 785 */ | 785 */ |
| 786 FileManager.prototype.initDialogs_ = function() { | 786 FileManager.prototype.initDialogs_ = function() { |
| 787 var d = cr.ui.dialogs; | 787 var d = cr.ui.dialogs; |
| 788 d.BaseDialog.OK_LABEL = str('OK_LABEL'); | 788 d.BaseDialog.OK_LABEL = str('OK_LABEL'); |
| 789 d.BaseDialog.CANCEL_LABEL = str('CANCEL_LABEL'); | 789 d.BaseDialog.CANCEL_LABEL = str('CANCEL_LABEL'); |
| 790 this.error = new ErrorDialog(this.dialogDom_); | 790 this.error = new ErrorDialog(this.dialogDom_); |
| 791 this.alert = new d.AlertDialog(this.dialogDom_); | 791 this.alert = new d.AlertDialog(this.dialogDom_); |
| 792 this.confirm = new d.ConfirmDialog(this.dialogDom_); | 792 this.confirm = new d.ConfirmDialog(this.dialogDom_); |
| 793 this.prompt = new d.PromptDialog(this.dialogDom_); | 793 this.prompt = new d.PromptDialog(this.dialogDom_); |
| 794 |
| 795 FileManagerDialogBase.setFileManager(this); |
| 794 this.shareDialog_ = new ShareDialog(this.dialogDom_); | 796 this.shareDialog_ = new ShareDialog(this.dialogDom_); |
| 795 this.defaultTaskPicker = | 797 this.defaultTaskPicker = |
| 796 new cr.filebrowser.DefaultActionDialog(this.dialogDom_); | 798 new cr.filebrowser.DefaultActionDialog(this.dialogDom_); |
| 797 this.suggestAppsDialog = | 799 this.suggestAppsDialog = |
| 798 new SuggestAppsDialog(this.dialogDom_); | 800 new SuggestAppsDialog(this.dialogDom_); |
| 799 }; | 801 }; |
| 800 | 802 |
| 801 /** | 803 /** |
| 802 * One-time initialization of various DOM nodes. Loads the additional DOM | 804 * One-time initialization of various DOM nodes. Loads the additional DOM |
| 803 * elements visible to the user. Initialize here elements, which are expensive | 805 * elements visible to the user. Initialize here elements, which are expensive |
| (...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 * Shows the share dialog for the selected file or directory. | 2109 * Shows the share dialog for the selected file or directory. |
| 2108 */ | 2110 */ |
| 2109 FileManager.prototype.shareSelection = function() { | 2111 FileManager.prototype.shareSelection = function() { |
| 2110 var entries = this.getSelection().entries; | 2112 var entries = this.getSelection().entries; |
| 2111 if (entries.length != 1) { | 2113 if (entries.length != 1) { |
| 2112 console.warn('Unable to share multiple items at once.'); | 2114 console.warn('Unable to share multiple items at once.'); |
| 2113 return; | 2115 return; |
| 2114 } | 2116 } |
| 2115 // Add the overlapped class to prevent the applicaiton window from | 2117 // Add the overlapped class to prevent the applicaiton window from |
| 2116 // captureing mouse events. | 2118 // captureing mouse events. |
| 2117 this.enableDragOnTitleArea_(false); | |
| 2118 this.shareDialog_.show(entries[0], function(result) { | 2119 this.shareDialog_.show(entries[0], function(result) { |
| 2119 this.enableDragOnTitleArea_(true); | |
| 2120 if (result == ShareDialog.Result.NETWORK_ERROR) | 2120 if (result == ShareDialog.Result.NETWORK_ERROR) |
| 2121 this.error.show(str('SHARE_ERROR')); | 2121 this.error.show(str('SHARE_ERROR')); |
| 2122 }.bind(this)); | 2122 }.bind(this)); |
| 2123 }; | 2123 }; |
| 2124 | 2124 |
| 2125 /** | 2125 /** |
| 2126 * Folder shared feature is under development and hidden behind flag. This | 2126 * Folder shared feature is under development and hidden behind flag. This |
| 2127 * method returns if the feature is explicitly enabled by the flag or not. | 2127 * method returns if the feature is explicitly enabled by the flag or not. |
| 2128 * TODO(yoshiki): Remove this after launching folder feature feature. | 2128 * TODO(yoshiki): Remove this after launching folder feature feature. |
| 2129 * | 2129 * |
| (...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3784 defaultIndex = i; | 3784 defaultIndex = i; |
| 3785 } | 3785 } |
| 3786 var item = { | 3786 var item = { |
| 3787 id: actions[i].id, | 3787 id: actions[i].id, |
| 3788 label: title, | 3788 label: title, |
| 3789 class: actions[i].class, | 3789 class: actions[i].class, |
| 3790 iconUrl: actions[i].icon100 | 3790 iconUrl: actions[i].icon100 |
| 3791 }; | 3791 }; |
| 3792 items.push(item); | 3792 items.push(item); |
| 3793 } | 3793 } |
| 3794 this.defaultTaskPicker.show( | 3794 var show = this.defaultTaskPicker.showOkCancelDialog( |
| 3795 str('CHANGE_DEFAULT_APP_BUTTON_LABEL'), | 3795 str('CHANGE_DEFAULT_APP_BUTTON_LABEL'), |
| 3796 '', | 3796 '', |
| 3797 items, | 3797 items, |
| 3798 defaultIndex, | 3798 defaultIndex, |
| 3799 function(action) { | 3799 function(action) { |
| 3800 ActionChoiceUtil.setRememberedActionId(action.id); | 3800 ActionChoiceUtil.setRememberedActionId(action.id); |
| 3801 }); | 3801 }); |
| 3802 if (!show) |
| 3803 console.error('DefaultTaskPicker can\'t be shown.'); |
| 3802 }.bind(this); | 3804 }.bind(this); |
| 3803 | 3805 |
| 3804 ActionChoiceUtil.getDefinedActions(loadTimeData, function(actions) { | 3806 ActionChoiceUtil.getDefinedActions(loadTimeData, function(actions) { |
| 3805 ActionChoiceUtil.getRememberedActionId(function(actionId) { | 3807 ActionChoiceUtil.getRememberedActionId(function(actionId) { |
| 3806 onActionsReady(actions, actionId); | 3808 onActionsReady(actions, actionId); |
| 3807 }); | 3809 }); |
| 3808 }); | 3810 }); |
| 3809 }; | 3811 }; |
| 3810 | 3812 |
| 3811 FileManager.prototype.decorateSplitter = function(splitterElement) { | 3813 FileManager.prototype.decorateSplitter = function(splitterElement) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3936 */ | 3938 */ |
| 3937 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { | 3939 FileManager.prototype.setCtrlKeyPressed_ = function(flag) { |
| 3938 this.ctrlKeyPressed_ = flag; | 3940 this.ctrlKeyPressed_ = flag; |
| 3939 // Before the DOM is constructed, the key event can be handled. | 3941 // Before the DOM is constructed, the key event can be handled. |
| 3940 var cacheClearCommand = | 3942 var cacheClearCommand = |
| 3941 this.document_.querySelector('#drive-clear-local-cache'); | 3943 this.document_.querySelector('#drive-clear-local-cache'); |
| 3942 if (cacheClearCommand) | 3944 if (cacheClearCommand) |
| 3943 cacheClearCommand.canExecuteChange(); | 3945 cacheClearCommand.canExecuteChange(); |
| 3944 }; | 3946 }; |
| 3945 })(); | 3947 })(); |
| OLD | NEW |