OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Setting the src of an img to an empty string can crash the browser, so we | 5 // Setting the src of an img to an empty string can crash the browser, so we |
6 // use an empty 1x1 gif instead. | 6 // use an empty 1x1 gif instead. |
7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' | 7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' |
8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; | 8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; |
9 | 9 |
10 var g_slideshow_data = null; | 10 var g_slideshow_data = null; |
(...skipping 3685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3696 if (name.substring(0, text.length).toLowerCase() == text) { | 3696 if (name.substring(0, text.length).toLowerCase() == text) { |
3697 this.currentList_.selectionModel.selectedIndexes = [index]; | 3697 this.currentList_.selectionModel.selectedIndexes = [index]; |
3698 return; | 3698 return; |
3699 } | 3699 } |
3700 } | 3700 } |
3701 | 3701 |
3702 this.textSearchState_.text = ''; | 3702 this.textSearchState_.text = ''; |
3703 }; | 3703 }; |
3704 | 3704 |
3705 /** | 3705 /** |
3706 * Handle a click of the cancel button. Closes the window. Does not return. | 3706 * Handle a click of the cancel button. Closes the window. |
3707 * TODO(jamescook): Make unload handler work automatically, crbug.com/104811 | 3707 * TODO(jamescook): Make unload handler work automatically, crbug.com/104811 |
3708 * | 3708 * |
3709 * @param {Event} event The click event. | 3709 * @param {Event} event The click event. |
3710 */ | 3710 */ |
3711 FileManager.prototype.onCancel_ = function(event) { | 3711 FileManager.prototype.onCancel_ = function(event) { |
| 3712 chrome.fileBrowserPrivate.cancelDialog(); |
3712 this.onUnload_(); | 3713 this.onUnload_(); |
3713 // Closes the window and does not return. | 3714 window.close(); |
3714 chrome.fileBrowserPrivate.cancelDialog(); | |
3715 }; | 3715 }; |
3716 | 3716 |
3717 /** | 3717 /** |
3718 * Selects a file. Closes the window. Does not return. | 3718 * Selects a file. Closes the window. |
3719 * TODO(jamescook): Make unload handler work automatically, crbug.com/104811 | 3719 * TODO(jamescook): Make unload handler work automatically, crbug.com/104811 |
3720 * | 3720 * |
3721 * @param {string} fileUrl The filename as a URL. | 3721 * @param {string} fileUrl The filename as a URL. |
3722 * @param {number} filterIndex The integer file filter index. | 3722 * @param {number} filterIndex The integer file filter index. |
3723 */ | 3723 */ |
3724 FileManager.prototype.selectFile_ = function(fileUrl, filterIndex) { | 3724 FileManager.prototype.selectFile_ = function(fileUrl, filterIndex) { |
| 3725 chrome.fileBrowserPrivate.selectFile(fileUrl, filterIndex); |
3725 this.onUnload_(); | 3726 this.onUnload_(); |
3726 // Closes the window and does not return. | 3727 window.close(); |
3727 chrome.fileBrowserPrivate.selectFile(fileUrl, filterIndex); | |
3728 }; | 3728 }; |
3729 | 3729 |
3730 /** | 3730 /** |
3731 * Selects multiple files. Closes the window. Does not return. | 3731 * Selects multiple files. Closes the window. |
3732 * TODO(jamescook): Make unload handler work automatically, crbug.com/104811 | 3732 * TODO(jamescook): Make unload handler work automatically, crbug.com/104811 |
3733 * | 3733 * |
3734 * @param {Array.<string>} fileUrls Array of filename URLs. | 3734 * @param {Array.<string>} fileUrls Array of filename URLs. |
3735 */ | 3735 */ |
3736 FileManager.prototype.selectFiles_ = function(fileUrls) { | 3736 FileManager.prototype.selectFiles_ = function(fileUrls) { |
| 3737 chrome.fileBrowserPrivate.selectFiles(fileUrls); |
3737 this.onUnload_(); | 3738 this.onUnload_(); |
3738 // Closes the window and does not return. | 3739 window.close(); |
3739 chrome.fileBrowserPrivate.selectFiles(fileUrls); | |
3740 }; | 3740 }; |
3741 | 3741 |
3742 /** | 3742 /** |
3743 * Handle a click of the ok button. | 3743 * Handle a click of the ok button. |
3744 * | 3744 * |
3745 * The ok button has different UI labels depending on the type of dialog, but | 3745 * The ok button has different UI labels depending on the type of dialog, but |
3746 * in code it's always referred to as 'ok'. | 3746 * in code it's always referred to as 'ok'. |
3747 * | 3747 * |
3748 * @param {Event} event The click event. | 3748 * @param {Event} event The click event. |
3749 */ | 3749 */ |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3960 }); | 3960 }); |
3961 }, onError); | 3961 }, onError); |
3962 | 3962 |
3963 function onError(err) { | 3963 function onError(err) { |
3964 console.log('Error while checking free space: ' + err); | 3964 console.log('Error while checking free space: ' + err); |
3965 setTimeout(doCheck, 1000 * 60); | 3965 setTimeout(doCheck, 1000 * 60); |
3966 } | 3966 } |
3967 } | 3967 } |
3968 } | 3968 } |
3969 })(); | 3969 })(); |
OLD | NEW |