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 // This variable is checked in SelectFileDialogExtensionBrowserTest. | 5 // This variable is checked in SelectFileDialogExtensionBrowserTest. |
6 var JSErrorCount = 0; | 6 var JSErrorCount = 0; |
7 | 7 |
8 /** | 8 /** |
9 * Count uncaught exceptions. | 9 * Count uncaught exceptions. |
10 */ | 10 */ |
(...skipping 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 * Update the tab title. | 1960 * Update the tab title. |
1961 */ | 1961 */ |
1962 FileManager.prototype.updateTitle_ = function() { | 1962 FileManager.prototype.updateTitle_ = function() { |
1963 if (this.dialogType != DialogType.FULL_PAGE) | 1963 if (this.dialogType != DialogType.FULL_PAGE) |
1964 return; | 1964 return; |
1965 | 1965 |
1966 var path = this.getCurrentDirectory(); | 1966 var path = this.getCurrentDirectory(); |
1967 var rootPath = PathUtil.getRootPath(path); | 1967 var rootPath = PathUtil.getRootPath(path); |
1968 this.document_.title = PathUtil.getRootLabel(rootPath) + | 1968 this.document_.title = PathUtil.getRootLabel(rootPath) + |
1969 path.substring(rootPath.length); | 1969 path.substring(rootPath.length); |
1970 }, | 1970 }; |
1971 | 1971 |
1972 /** | 1972 /** |
1973 * Updates search box value when directory gets changed. | 1973 * Updates search box value when directory gets changed. |
1974 */ | 1974 */ |
1975 FileManager.prototype.updateSearchBoxOnDirChange_ = function() { | 1975 FileManager.prototype.updateSearchBoxOnDirChange_ = function() { |
1976 var searchBox = this.dialogDom_.querySelector('#search-box'); | 1976 var searchBox = this.dialogDom_.querySelector('#search-box'); |
1977 if (!searchBox.disabled) | 1977 if (!searchBox.disabled) |
1978 searchBox.value = ''; | 1978 searchBox.value = ''; |
1979 }, | 1979 }; |
1980 | 1980 |
1981 /** | 1981 /** |
1982 * Update the UI when the current directory changes. | 1982 * Update the UI when the current directory changes. |
1983 * | 1983 * |
1984 * @param {cr.Event} event The directory-changed event. | 1984 * @param {cr.Event} event The directory-changed event. |
1985 */ | 1985 */ |
1986 FileManager.prototype.onDirectoryChanged_ = function(event) { | 1986 FileManager.prototype.onDirectoryChanged_ = function(event) { |
1987 this.selectionHandler_.onFileSelectionChanged(); | 1987 this.selectionHandler_.onFileSelectionChanged(); |
1988 this.updateSearchBoxOnDirChange_(); | 1988 this.updateSearchBoxOnDirChange_(); |
1989 if (this.dialogType == DialogType.FULL_PAGE) | 1989 if (this.dialogType == DialogType.FULL_PAGE) |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 if (event.srcElement === this.renameInput_) { | 2342 if (event.srcElement === this.renameInput_) { |
2343 // Ignore keydown handler in the rename input box. | 2343 // Ignore keydown handler in the rename input box. |
2344 return; | 2344 return; |
2345 } | 2345 } |
2346 | 2346 |
2347 switch (util.getKeyModifiers(event) + event.keyCode) { | 2347 switch (util.getKeyModifiers(event) + event.keyCode) { |
2348 case '17': // Ctrl => Hide hidden setting | 2348 case '17': // Ctrl => Hide hidden setting |
2349 this.dialogDom_.removeAttribute('ctrl-pressing'); | 2349 this.dialogDom_.removeAttribute('ctrl-pressing'); |
2350 return; | 2350 return; |
2351 } | 2351 } |
2352 } | 2352 }; |
2353 | 2353 |
2354 /** | 2354 /** |
2355 * KeyDown event handler for the div#list-container element. | 2355 * KeyDown event handler for the div#list-container element. |
2356 */ | 2356 */ |
2357 FileManager.prototype.onListKeyDown_ = function(event) { | 2357 FileManager.prototype.onListKeyDown_ = function(event) { |
2358 if (event.srcElement.tagName == 'INPUT') { | 2358 if (event.srcElement.tagName == 'INPUT') { |
2359 // Ignore keydown handler in the rename input box. | 2359 // Ignore keydown handler in the rename input box. |
2360 return; | 2360 return; |
2361 } | 2361 } |
2362 | 2362 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 if (localPaths[i]) { | 2494 if (localPaths[i]) { |
2495 // Add "localPath" parameter to the drive file URL. | 2495 // Add "localPath" parameter to the drive file URL. |
2496 fileUrls[i] += '?localPath=' + encodeURIComponent(localPaths[i]); | 2496 fileUrls[i] += '?localPath=' + encodeURIComponent(localPaths[i]); |
2497 } | 2497 } |
2498 } | 2498 } |
2499 callback(fileUrls); | 2499 callback(fileUrls); |
2500 }); | 2500 }); |
2501 } else { | 2501 } else { |
2502 callback(fileUrls); | 2502 callback(fileUrls); |
2503 } | 2503 } |
2504 }, | 2504 }; |
2505 | 2505 |
2506 /** | 2506 /** |
2507 * Closes this modal dialog with some files selected. | 2507 * Closes this modal dialog with some files selected. |
2508 * TODO(jamescook): Make unload handler work automatically, crbug.com/104811 | 2508 * TODO(jamescook): Make unload handler work automatically, crbug.com/104811 |
2509 * @param {Object} selection Contains urls, filterIndex and multiple fields. | 2509 * @param {Object} selection Contains urls, filterIndex and multiple fields. |
2510 */ | 2510 */ |
2511 FileManager.prototype.callSelectFilesApiAndClose_ = function(selection) { | 2511 FileManager.prototype.callSelectFilesApiAndClose_ = function(selection) { |
2512 if (selection.multiple) { | 2512 if (selection.multiple) { |
2513 chrome.fileBrowserPrivate.selectFiles(selection.urls); | 2513 chrome.fileBrowserPrivate.selectFiles(selection.urls); |
2514 } else { | 2514 } else { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2954 return this.directoryModel_.getFileList(); | 2954 return this.directoryModel_.getFileList(); |
2955 }; | 2955 }; |
2956 | 2956 |
2957 /** | 2957 /** |
2958 * @return {cr.ui.List} Current list object. | 2958 * @return {cr.ui.List} Current list object. |
2959 */ | 2959 */ |
2960 FileManager.prototype.getCurrentList = function() { | 2960 FileManager.prototype.getCurrentList = function() { |
2961 return this.currentList_; | 2961 return this.currentList_; |
2962 }; | 2962 }; |
2963 })(); | 2963 })(); |
OLD | NEW |