OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 * Updates sub-elements of {@code parentElement} reading {@code DirectoryEntry} | 8 * Updates sub-elements of {@code parentElement} reading {@code DirectoryEntry} |
9 * with calling {@code iterator}. | 9 * with calling {@code iterator}. |
10 * | 10 * |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 eject.hidden = !PathUtil.isUnmountableByUser(path); | 157 eject.hidden = !PathUtil.isUnmountableByUser(path); |
158 eject.addEventListener('click', | 158 eject.addEventListener('click', |
159 function(event) { | 159 function(event) { |
160 event.stopPropagation(); | 160 event.stopPropagation(); |
161 if (!PathUtil.isUnmountableByUser(path)) | 161 if (!PathUtil.isUnmountableByUser(path)) |
162 return; | 162 return; |
163 | 163 |
164 volumeManager.unmount(path, function() {}, function() {}); | 164 volumeManager.unmount(path, function() {}, function() {}); |
165 }.bind(this)); | 165 }.bind(this)); |
166 | 166 |
167 if ('expanded' in parentDirItem || parentDirItem.expanded) | 167 if (parentDirItem.expanded) |
168 this.updateSubDirectories_(); | 168 this.updateSubDirectories_(); |
169 }; | 169 }; |
170 | 170 |
171 /** | 171 /** |
172 * Invoked when the item is being expanded. | 172 * Invoked when the item is being expanded. |
173 * @param {!UIEvent} e Event. | 173 * @param {!UIEvent} e Event. |
174 * @private | 174 * @private |
175 **/ | 175 **/ |
176 DirectoryItem.prototype.onExpand_ = function(e) { | 176 DirectoryItem.prototype.onExpand_ = function(e) { |
177 this.updateSubDirectories_(function() { | 177 this.updateSubDirectories_(function() { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 * @param {HTMLElement} el Element to be DirectoryTree. | 261 * @param {HTMLElement} el Element to be DirectoryTree. |
262 * @param {DirectoryModel} directoryModel Current DirectoryModel. | 262 * @param {DirectoryModel} directoryModel Current DirectoryModel. |
263 */ | 263 */ |
264 DirectoryTree.decorate = function(el, directoryModel) { | 264 DirectoryTree.decorate = function(el, directoryModel) { |
265 el.__proto__ = DirectoryTree.prototype; | 265 el.__proto__ = DirectoryTree.prototype; |
266 (/** @type {DirectoryTree} */ el).decorate(directoryModel); | 266 (/** @type {DirectoryTree} */ el).decorate(directoryModel); |
267 }; | 267 }; |
268 | 268 |
269 DirectoryTree.prototype = { | 269 DirectoryTree.prototype = { |
270 __proto__: cr.ui.Tree.prototype, | 270 __proto__: cr.ui.Tree.prototype, |
| 271 |
| 272 // DirectoryTree is always expanded. |
| 273 get expanded() { return true; }, |
| 274 /** |
| 275 * @param {boolean} value Not used. |
| 276 */ |
| 277 set expanded(value) {} |
271 }; | 278 }; |
272 | 279 |
273 /** | 280 /** |
274 * Decorates an element. | 281 * Decorates an element. |
275 * @param {DirectoryModel} directoryModel Current DirectoryModel. | 282 * @param {DirectoryModel} directoryModel Current DirectoryModel. |
276 */ | 283 */ |
277 DirectoryTree.prototype.decorate = function(directoryModel) { | 284 DirectoryTree.prototype.decorate = function(directoryModel) { |
278 cr.ui.Tree.prototype.decorate.call(this); | 285 cr.ui.Tree.prototype.decorate.call(this); |
279 | 286 |
280 this.directoryModel_ = directoryModel; | 287 this.directoryModel_ = directoryModel; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 this.setContextMenu(this.contextMenu_); | 338 this.setContextMenu(this.contextMenu_); |
332 }; | 339 }; |
333 | 340 |
334 /** | 341 /** |
335 * Returns the path of the selected item. | 342 * Returns the path of the selected item. |
336 * @return {string} The current path. | 343 * @return {string} The current path. |
337 */ | 344 */ |
338 DirectoryTree.prototype.getCurrentPath = function() { | 345 DirectoryTree.prototype.getCurrentPath = function() { |
339 return this.selectedItem ? this.selectedItem.fullPath : null; | 346 return this.selectedItem ? this.selectedItem.fullPath : null; |
340 }; | 347 }; |
OLD | NEW |