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 // DirectoryTreeUtil | 8 // DirectoryTreeUtil |
9 | 9 |
10 /** | 10 /** |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 * Executes the assigned action as a drop target. | 367 * Executes the assigned action as a drop target. |
368 */ | 368 */ |
369 DirectoryItem.prototype.doDropTargetAction = function() { | 369 DirectoryItem.prototype.doDropTargetAction = function() { |
370 this.expanded = true; | 370 this.expanded = true; |
371 }; | 371 }; |
372 | 372 |
373 /** | 373 /** |
374 * Executes the assigned action. DirectoryItem performs changeDirectory. | 374 * Executes the assigned action. DirectoryItem performs changeDirectory. |
375 */ | 375 */ |
376 DirectoryItem.prototype.doAction = function() { | 376 DirectoryItem.prototype.doAction = function() { |
377 if (this.fullPath !== this.directoryModel_.getCurrentDirPath()) | 377 // TODO(mtomasz, yoshiki): Do not use fullPaths here, but Entry instead. |
| 378 if (!this.directoryModel_.getCurrentDirEntry() || |
| 379 this.fullPath !== this.directoryModel_.getCurrentDirEntry().fullPath) { |
378 this.directoryModel_.changeDirectory(this.fullPath); | 380 this.directoryModel_.changeDirectory(this.fullPath); |
| 381 } |
379 }; | 382 }; |
380 | 383 |
381 /** | 384 /** |
382 * Sets the context menu for directory tree. | 385 * Sets the context menu for directory tree. |
383 * @param {cr.ui.Menu} menu Menu to be set. | 386 * @param {cr.ui.Menu} menu Menu to be set. |
384 */ | 387 */ |
385 DirectoryItem.prototype.setContextMenu = function(menu) { | 388 DirectoryItem.prototype.setContextMenu = function(menu) { |
386 if (this.entry && PathUtil.isEligibleForFolderShortcut(this.entry.fullPath)) | 389 if (this.entry && PathUtil.isEligibleForFolderShortcut(this.entry.fullPath)) |
387 cr.ui.contextMenuHandler.setContextMenu(this, menu); | 390 cr.ui.contextMenuHandler.setContextMenu(this, menu); |
388 }; | 391 }; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 this.style.paddingBottom = margin + 'px'; | 660 this.style.paddingBottom = margin + 'px'; |
658 this.scrollBar_.setBottomMarginForPanel(margin); | 661 this.scrollBar_.setBottomMarginForPanel(margin); |
659 }; | 662 }; |
660 | 663 |
661 /** | 664 /** |
662 * Updates the UI after the layout has changed. | 665 * Updates the UI after the layout has changed. |
663 */ | 666 */ |
664 DirectoryTree.prototype.relayout = function() { | 667 DirectoryTree.prototype.relayout = function() { |
665 cr.dispatchSimpleEvent(this, 'relayout'); | 668 cr.dispatchSimpleEvent(this, 'relayout'); |
666 }; | 669 }; |
OLD | NEW |