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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 | 1311 |
1312 option.value = i + 1; | 1312 option.value = i + 1; |
1313 | 1313 |
1314 if (fileType.selected) | 1314 if (fileType.selected) |
1315 option.selected = true; | 1315 option.selected = true; |
1316 | 1316 |
1317 this.fileTypeSelector_.appendChild(option); | 1317 this.fileTypeSelector_.appendChild(option); |
1318 } | 1318 } |
1319 | 1319 |
1320 var options = this.fileTypeSelector_.querySelectorAll('option'); | 1320 var options = this.fileTypeSelector_.querySelectorAll('option'); |
1321 if (options.length < 2) { | 1321 if (options.length >= 2) { |
1322 // There is in fact no choice, hide the selector. | 1322 // There is in fact no choice, show the selector. |
1323 this.fileTypeSelector_.hidden = true; | 1323 this.fileTypeSelector_.hidden = false; |
1324 return; | 1324 |
| 1325 this.fileTypeSelector_.addEventListener('change', |
| 1326 this.updateFileTypeFilter_.bind(this)); |
1325 } | 1327 } |
1326 | |
1327 this.fileTypeSelector_.addEventListener('change', | |
1328 this.updateFileTypeFilter_.bind(this)); | |
1329 }; | 1328 }; |
1330 | 1329 |
1331 /** | 1330 /** |
1332 * Filters file according to the selected file type. | 1331 * Filters file according to the selected file type. |
1333 * @private | 1332 * @private |
1334 */ | 1333 */ |
1335 FileManager.prototype.updateFileTypeFilter_ = function() { | 1334 FileManager.prototype.updateFileTypeFilter_ = function() { |
1336 this.fileFilter_.removeFilter('fileType'); | 1335 this.fileFilter_.removeFilter('fileType'); |
1337 var selectedIndex = this.getSelectedFilterIndex_(); | 1336 var selectedIndex = this.getSelectedFilterIndex_(); |
1338 if (selectedIndex > 0) { // Specific filter selected. | 1337 if (selectedIndex > 0) { // Specific filter selected. |
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3627 callback(this.preferences_); | 3626 callback(this.preferences_); |
3628 return; | 3627 return; |
3629 } | 3628 } |
3630 | 3629 |
3631 chrome.fileBrowserPrivate.getPreferences(function(prefs) { | 3630 chrome.fileBrowserPrivate.getPreferences(function(prefs) { |
3632 this.preferences_ = prefs; | 3631 this.preferences_ = prefs; |
3633 callback(prefs); | 3632 callback(prefs); |
3634 }.bind(this)); | 3633 }.bind(this)); |
3635 }; | 3634 }; |
3636 })(); | 3635 })(); |
OLD | NEW |