OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Controller for list contents update. | 6 * Controller for list contents update. |
7 * @param {!ListContainer} listContainer | 7 * @param {!ListContainer} listContainer |
| 8 * @param {!DetailsContainer} detailsContainer |
8 * @param {!DirectoryModel} directoryModel | 9 * @param {!DirectoryModel} directoryModel |
9 * @param {!MetadataModel} metadataModel | 10 * @param {!MetadataModel} metadataModel |
10 * @constructor | 11 * @constructor |
11 * @struct | 12 * @struct |
12 */ | 13 */ |
13 function MetadataUpdateController(listContainer, | 14 function MetadataUpdateController(listContainer, |
| 15 detailsContainer, |
14 directoryModel, | 16 directoryModel, |
15 metadataModel) { | 17 metadataModel) { |
16 /** | 18 /** |
17 * @private {!DirectoryModel} | 19 * @private {!DirectoryModel} |
18 * @const | 20 * @const |
19 */ | 21 */ |
20 this.directoryModel_ = directoryModel; | 22 this.directoryModel_ = directoryModel; |
21 | 23 |
22 /** | 24 /** |
23 * @private {!MetadataModel} | 25 * @private {!MetadataModel} |
24 * @const | 26 * @const |
25 */ | 27 */ |
26 this.metadataModel_ = metadataModel; | 28 this.metadataModel_ = metadataModel; |
27 | 29 |
28 /** | 30 /** |
29 * @private {!ListContainer} | 31 * @private {!ListContainer} |
30 * @const | 32 * @const |
31 */ | 33 */ |
32 this.listContainer_ = listContainer; | 34 this.listContainer_ = listContainer; |
33 | 35 |
| 36 /** |
| 37 * @private {!DetailsContainer} |
| 38 * @const |
| 39 */ |
| 40 this.detailsContainer_ = detailsContainer; |
| 41 |
34 chrome.fileManagerPrivate.onPreferencesChanged.addListener( | 42 chrome.fileManagerPrivate.onPreferencesChanged.addListener( |
35 this.onPreferencesChanged_.bind(this)); | 43 this.onPreferencesChanged_.bind(this)); |
36 this.onPreferencesChanged_(); | 44 this.onPreferencesChanged_(); |
37 metadataModel.addEventListener( | 45 metadataModel.addEventListener( |
38 'update', this.onCachedMetadataUpdate_.bind(this)); | 46 'update', this.onCachedMetadataUpdate_.bind(this)); |
39 | 47 |
40 // Update metadata to change 'Today' and 'Yesterday' dates. | 48 // Update metadata to change 'Today' and 'Yesterday' dates. |
41 var today = new Date(); | 49 var today = new Date(); |
42 today.setHours(0); | 50 today.setHours(0); |
43 today.setMinutes(0); | 51 today.setMinutes(0); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 MetadataUpdateController.MILLISECONDS_IN_DAY_); | 111 MetadataUpdateController.MILLISECONDS_IN_DAY_); |
104 }; | 112 }; |
105 | 113 |
106 /** | 114 /** |
107 * @private | 115 * @private |
108 */ | 116 */ |
109 MetadataUpdateController.prototype.onPreferencesChanged_ = function() { | 117 MetadataUpdateController.prototype.onPreferencesChanged_ = function() { |
110 chrome.fileManagerPrivate.getPreferences(function(prefs) { | 118 chrome.fileManagerPrivate.getPreferences(function(prefs) { |
111 var use12hourClock = !prefs.use24hourClock; | 119 var use12hourClock = !prefs.use24hourClock; |
112 this.listContainer_.table.setDateTimeFormat(use12hourClock); | 120 this.listContainer_.table.setDateTimeFormat(use12hourClock); |
| 121 this.detailsContainer_.setDateTimeFormat(use12hourClock); |
113 this.refreshCurrentDirectoryMetadata(); | 122 this.refreshCurrentDirectoryMetadata(); |
114 }.bind(this)); | 123 }.bind(this)); |
115 }; | 124 }; |
OLD | NEW |