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 /** | 5 /** |
6 * FileManager constructor. | 6 * FileManager constructor. |
7 * | 7 * |
8 * FileManager objects encapsulate the functionality of the file selector | 8 * FileManager objects encapsulate the functionality of the file selector |
9 * dialogs, as well as the full screen file manager application (though the | 9 * dialogs, as well as the full screen file manager application (though the |
10 * latter is not yet implemented). | 10 * latter is not yet implemented). |
(...skipping 28 matching lines...) Expand all Loading... |
39 this.document_ = dialogDom.ownerDocument; | 39 this.document_ = dialogDom.ownerDocument; |
40 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE; | 40 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE; |
41 | 41 |
42 metrics.recordEnum('Create', this.dialogType_, | 42 metrics.recordEnum('Create', this.dialogType_, |
43 [FileManager.DialogType.SELECT_FOLDER, | 43 [FileManager.DialogType.SELECT_FOLDER, |
44 FileManager.DialogType.SELECT_SAVEAS_FILE, | 44 FileManager.DialogType.SELECT_SAVEAS_FILE, |
45 FileManager.DialogType.SELECT_OPEN_FILE, | 45 FileManager.DialogType.SELECT_OPEN_FILE, |
46 FileManager.DialogType.SELECT_OPEN_MULTI_FILE, | 46 FileManager.DialogType.SELECT_OPEN_MULTI_FILE, |
47 FileManager.DialogType.FULL_PAGE]); | 47 FileManager.DialogType.FULL_PAGE]); |
48 | 48 |
49 // TODO(dgozman): This will be changed to LocaleInfo. | |
50 this.locale_ = new v8Locale(navigator.language); | |
51 | |
52 this.initFileSystem_(); | 49 this.initFileSystem_(); |
53 this.volumeManager_ = VolumeManager.getInstance(); | 50 this.volumeManager_ = VolumeManager.getInstance(); |
54 this.initDom_(); | 51 this.initDom_(); |
55 this.initDialogType_(); | 52 this.initDialogType_(); |
56 } | 53 } |
57 | 54 |
58 /** | 55 /** |
59 * Maximum delay in milliseconds for updating thumbnails in the bottom panel | 56 * Maximum delay in milliseconds for updating thumbnails in the bottom panel |
60 * to mitigate flickering. If images load faster then the delay they replace | 57 * to mitigate flickering. If images load faster then the delay they replace |
61 * old images smoothly. On the other hand we don't want to keep old images | 58 * old images smoothly. On the other hand we don't want to keep old images |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 /** | 428 /** |
432 * Continue initializing the file manager after resolving roots. | 429 * Continue initializing the file manager after resolving roots. |
433 */ | 430 */ |
434 FileManager.prototype.init_ = function() { | 431 FileManager.prototype.init_ = function() { |
435 metrics.startInterval('Load.DOM'); | 432 metrics.startInterval('Load.DOM'); |
436 this.initCommands_(); | 433 this.initCommands_(); |
437 | 434 |
438 this.metadataCache_ = MetadataCache.createFull(); | 435 this.metadataCache_ = MetadataCache.createFull(); |
439 | 436 |
440 this.dateFormatter_ = v8Intl.DateTimeFormat( | 437 this.dateFormatter_ = v8Intl.DateTimeFormat( |
441 {} /* default locale */, | 438 [] /* default locale */, |
442 {year: 'numeric', month: 'short', day: 'numeric', | 439 {year: 'numeric', month: 'short', day: 'numeric', |
443 hour: 'numeric', minute: 'numeric'}); | 440 hour: 'numeric', minute: 'numeric'}); |
444 this.timeFormatter_ = v8Intl.DateTimeFormat( | 441 this.timeFormatter_ = v8Intl.DateTimeFormat( |
445 {} /* default locale */, | 442 [] /* default locale */, |
446 {hour: 'numeric', minute: 'numeric'}); | 443 {hour: 'numeric', minute: 'numeric'}); |
447 | 444 |
448 this.collator_ = this.locale_.createCollator({ | 445 this.collator_ = v8Intl.Collator([], {numeric: true, sensitivity: 'base'}); |
449 'numeric': true, 'ignoreCase': true, 'ignoreAccents': true}); | |
450 | 446 |
451 // Optional list of file types. | 447 // Optional list of file types. |
452 this.fileTypes_ = this.params_.typeList; | 448 this.fileTypes_ = this.params_.typeList; |
453 | 449 |
454 this.showCheckboxes_ = | 450 this.showCheckboxes_ = |
455 (this.dialogType_ == FileManager.DialogType.FULL_PAGE || | 451 (this.dialogType_ == FileManager.DialogType.FULL_PAGE || |
456 this.dialogType_ == FileManager.DialogType.SELECT_OPEN_MULTI_FILE); | 452 this.dialogType_ == FileManager.DialogType.SELECT_OPEN_MULTI_FILE); |
457 | 453 |
458 this.table_.startBatchUpdates(); | 454 this.table_.startBatchUpdates(); |
459 this.grid_.startBatchUpdates(); | 455 this.grid_.startBatchUpdates(); |
(...skipping 4147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4607 function closeBanner() { | 4603 function closeBanner() { |
4608 self.cleanupGDataWelcome_(); | 4604 self.cleanupGDataWelcome_(); |
4609 // Stop showing the welcome banner. | 4605 // Stop showing the welcome banner. |
4610 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; | 4606 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; |
4611 } | 4607 } |
4612 | 4608 |
4613 return maybeShowBanner; | 4609 return maybeShowBanner; |
4614 }; | 4610 }; |
4615 })(); | 4611 })(); |
4616 | 4612 |
OLD | NEW |