Chromium Code Reviews| 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 * FileManager constructor. | 8 * FileManager constructor. |
| 9 * | 9 * |
| 10 * FileManager objects encapsulate the functionality of the file selector | 10 * FileManager objects encapsulate the functionality of the file selector |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1304 | 1304 |
| 1305 option.value = i + 1; | 1305 option.value = i + 1; |
| 1306 | 1306 |
| 1307 if (fileType.selected) | 1307 if (fileType.selected) |
| 1308 option.selected = true; | 1308 option.selected = true; |
| 1309 | 1309 |
| 1310 this.fileTypeSelector_.appendChild(option); | 1310 this.fileTypeSelector_.appendChild(option); |
| 1311 } | 1311 } |
| 1312 | 1312 |
| 1313 var options = this.fileTypeSelector_.querySelectorAll('option'); | 1313 var options = this.fileTypeSelector_.querySelectorAll('option'); |
| 1314 if (options.length < 2) { | 1314 if (options.length >= 2) { |
| 1315 // There is in fact no choice, hide the selector. | 1315 // There is in fact no choice, show the selector. |
|
mtomasz
2013/11/21 04:24:11
Please fix this comment, it is wrong.
| |
| 1316 this.fileTypeSelector_.hidden = true; | 1316 this.fileTypeSelector_.hidden = false; |
| 1317 return; | 1317 |
| 1318 this.fileTypeSelector_.addEventListener('change', | |
| 1319 this.updateFileTypeFilter_.bind(this)); | |
| 1318 } | 1320 } |
| 1319 | |
| 1320 this.fileTypeSelector_.addEventListener('change', | |
| 1321 this.updateFileTypeFilter_.bind(this)); | |
| 1322 }; | 1321 }; |
| 1323 | 1322 |
| 1324 /** | 1323 /** |
| 1325 * Filters file according to the selected file type. | 1324 * Filters file according to the selected file type. |
| 1326 * @private | 1325 * @private |
| 1327 */ | 1326 */ |
| 1328 FileManager.prototype.updateFileTypeFilter_ = function() { | 1327 FileManager.prototype.updateFileTypeFilter_ = function() { |
| 1329 this.fileFilter_.removeFilter('fileType'); | 1328 this.fileFilter_.removeFilter('fileType'); |
| 1330 var selectedIndex = this.getSelectedFilterIndex_(); | 1329 var selectedIndex = this.getSelectedFilterIndex_(); |
| 1331 if (selectedIndex > 0) { // Specific filter selected. | 1330 if (selectedIndex > 0) { // Specific filter selected. |
| (...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3619 callback(this.preferences_); | 3618 callback(this.preferences_); |
| 3620 return; | 3619 return; |
| 3621 } | 3620 } |
| 3622 | 3621 |
| 3623 chrome.fileBrowserPrivate.getPreferences(function(prefs) { | 3622 chrome.fileBrowserPrivate.getPreferences(function(prefs) { |
| 3624 this.preferences_ = prefs; | 3623 this.preferences_ = prefs; |
| 3625 callback(prefs); | 3624 callback(prefs); |
| 3626 }.bind(this)); | 3625 }.bind(this)); |
| 3627 }; | 3626 }; |
| 3628 })(); | 3627 })(); |
| OLD | NEW |