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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * This object encapsulates everything related to tasks execution. | 8 * This object encapsulates everything related to tasks execution. |
9 * | 9 * |
10 * @param {FileManager} fileManager FileManager instance. | 10 * @param {FileManager} fileManager FileManager instance. |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 }; | 549 }; |
550 | 550 |
551 galleryFrame.onload = function() { | 551 galleryFrame.onload = function() { |
552 galleryFrame.contentWindow.ImageUtil.metrics = metrics; | 552 galleryFrame.contentWindow.ImageUtil.metrics = metrics; |
553 | 553 |
554 // TODO(haruki): isOnReadonlyDirectory() only checks the permission for the | 554 // TODO(haruki): isOnReadonlyDirectory() only checks the permission for the |
555 // root. We should check more granular permission to know whether the file | 555 // root. We should check more granular permission to know whether the file |
556 // is writable or not. | 556 // is writable or not. |
557 var readonly = fm.isOnReadonlyDirectory(); | 557 var readonly = fm.isOnReadonlyDirectory(); |
558 var currentDir = fm.directoryModel_.getCurrentDirEntry(); | 558 var currentDir = fm.directoryModel_.getCurrentDirEntry(); |
559 var downloadsDir = fm.directoryModel_.getRootsList().item(0); | 559 var downloadsVolume = |
| 560 fm.volumeManager_.getVolumeInfo(RootDirectory.DOWNLOADS); |
| 561 var downloadsDir = downloadsVolume && downloadsVolume.root; |
560 var readonlyDirName = null; | 562 var readonlyDirName = null; |
561 if (readonly) { | 563 if (readonly) { |
562 readonlyDirName = fm.isOnDrive() ? | 564 readonlyDirName = fm.isOnDrive() ? |
563 PathUtil.getRootLabel(PathUtil.getRootPath(currentDir.fullPath)) : | 565 PathUtil.getRootLabel(PathUtil.getRootPath(currentDir.fullPath)) : |
564 fm.directoryModel_.getCurrentRootName(); | 566 fm.directoryModel_.getCurrentRootName(); |
565 } | 567 } |
566 | 568 |
567 var context = { | 569 var context = { |
568 // We show the root label in readonly warning (e.g. archive name). | 570 // We show the root label in readonly warning (e.g. archive name). |
569 readonlyDirName: readonlyDirName, | 571 readonlyDirName: readonlyDirName, |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 items, defaultIdx, | 722 items, defaultIdx, |
721 function(item) { | 723 function(item) { |
722 onSuccess(item.task); | 724 onSuccess(item.task); |
723 }); | 725 }); |
724 }; | 726 }; |
725 | 727 |
726 FileTasks.decorate('display'); | 728 FileTasks.decorate('display'); |
727 FileTasks.decorate('updateMenuItem'); | 729 FileTasks.decorate('updateMenuItem'); |
728 FileTasks.decorate('execute'); | 730 FileTasks.decorate('execute'); |
729 FileTasks.decorate('executeDefault'); | 731 FileTasks.decorate('executeDefault'); |
OLD | NEW |