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

Side by Side Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 8770028: cros: Defer file selection callback until the window closes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/extension_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/extensions/extension_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698