Chromium Code Reviews| Index: chrome/browser/resources/file_manager/js/file_manager.js |
| diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js |
| index 3a4c45e12f9a26dc19d2e9b545a7eedcf6458097..7e30198940bac79e3d0a99edffcca8d9cb03e1c6 100644 |
| --- a/chrome/browser/resources/file_manager/js/file_manager.js |
| +++ b/chrome/browser/resources/file_manager/js/file_manager.js |
| @@ -1015,7 +1015,6 @@ DialogType.isModal = function(type) { |
| this.listType_ = type; |
| this.updateStartupPrefs_(); |
| - this.updateColumnModel_(); |
| this.onResize_(); |
| this.table_.list.endBatchUpdates(); |
| @@ -1056,7 +1055,10 @@ DialogType.isModal = function(type) { |
| fullPage ? 200 : 160), |
| new cr.ui.table.TableColumn('modificationTime', |
| str('DATE_COLUMN_LABEL'), |
| - fullPage ? 150 : 210) |
| + fullPage ? 150 : 210), |
| + new cr.ui.table.TableColumn('offline', |
| + str('OFFLINE_COLUMN_LABEL'), |
| + 150) |
| ]; |
| // TODO(dgozman): refactor render/update/display stuff. |
| @@ -1072,17 +1074,28 @@ DialogType.isModal = function(type) { |
| this.renderNameColumnHeader_.bind(this, columns[0].name); |
| } |
| - this.regularColumnModel_ = new cr.ui.table.TableColumnModel(columns); |
| + columns[4].renderFunction = this.renderOffline_.bind(this); |
| + var columnModel = new cr.ui.table.TableColumnModel(columns); |
| + columnModel.__defineGetter__('size', function() { |
|
arv (Not doing code reviews)
2012/11/30 19:05:52
Don't use __defineGetter___. Use ES5 Object.define
SeRya
2012/12/01 20:14:37
Done.
|
| + if (fullPage && this.isOnGData()) |
| + return columns.length; |
| + else |
| + return columns.length - 1; |
| + }.bind(this)); |
| if (fullPage) { |
| - columns.push(new cr.ui.table.TableColumn( |
| - 'offline', str('OFFLINE_COLUMN_LABEL'), 150)); |
| - columns[4].renderFunction = this.renderOffline_.bind(this); |
| - |
| - this.gdataColumnModel_ = new cr.ui.table.TableColumnModel(columns); |
| - } else { |
| - this.gdataColumnModel_ = null; |
| + function isOnDrive(entry) { |
|
arv (Not doing code reviews)
2012/11/30 19:05:52
FunctionDeclaration is not allowed here. "use stri
SeRya
2012/12/01 20:14:37
Done.
|
| + return PathUtil.getRootType(entry.fullPath) == RootType.GDATA; |
| + } |
| + var table = this.table_; |
| + this.directoryModel_.addEventListener('directory-changed', function(e) { |
| + if (isOnDrive(e.previousDirEntry) != isOnDrive(e.newDirEntry)) { |
| + // Columns number changed. |
| + table.redraw(); |
| + } |
| + }); |
| } |
| + this.table_.columnModel = columnModel; |
| this.table_.list.addEventListener('click', this.onDetailClick_.bind(this)); |
| }; |
| @@ -1135,15 +1148,6 @@ DialogType.isModal = function(type) { |
| } |
| }; |
| - FileManager.prototype.updateColumnModel_ = function() { |
| - if (this.listType_ != FileManager.ListType.DETAIL) |
| - return; |
| - this.table_.columnModel = |
| - (this.isOnGData() && this.gdataColumnModel_) ? |
| - this.gdataColumnModel_ : |
| - this.regularColumnModel_; |
| - }; |
| - |
| /** |
| * Fills the file type list or hides it. |
| */ |
| @@ -2420,7 +2424,6 @@ DialogType.isModal = function(type) { |
| */ |
| FileManager.prototype.onDirectoryChanged_ = function(event) { |
| this.selectionHandler_.onSelectionChanged(); |
| - this.updateColumnModel_(); |
| this.updateSearchBoxOnDirChange_(); |
| util.updateAppState(event.initial, this.getCurrentDirectory()); |