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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
622 util.updateAppState(null /* keep path */, '' /* remove search. */); | 622 util.updateAppState(null /* keep path */, '' /* remove search. */); |
623 } | 623 } |
624 | 624 |
625 var savedAppState = window.appState; | 625 var savedAppState = window.appState; |
626 var savedTitle = document.title; | 626 var savedTitle = document.title; |
627 | 627 |
628 // Push a temporary state which will be replaced every time the selection | 628 // Push a temporary state which will be replaced every time the selection |
629 // changes in the Gallery and popped when the Gallery is closed. | 629 // changes in the Gallery and popped when the Gallery is closed. |
630 util.updateAppState(); | 630 util.updateAppState(); |
631 | 631 |
632 // TODO(mtomasz): Pass entries instead of urls. | 632 var onBack = function(selectedEntries) { |
633 var onBack = function(selectedUrls) { | 633 fm.directoryModel_.selectEntries(selectedEntries); |
634 fm.directoryModel_.selectUrls(selectedUrls); | |
635 fm.closeFilePopup(); // Will call Gallery.unload. | 634 fm.closeFilePopup(); // Will call Gallery.unload. |
636 window.appState = savedAppState; | 635 window.appState = savedAppState; |
637 util.saveAppState(); | 636 util.saveAppState(); |
638 document.title = savedTitle; | 637 document.title = savedTitle; |
639 }; | 638 }; |
640 | 639 |
641 var onClose = function() { | 640 var onClose = function() { |
642 fm.onClose(); | 641 fm.onClose(); |
643 }; | 642 }; |
644 | 643 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
677 searchResults: fm.directoryModel_.isSearching(), | 676 searchResults: fm.directoryModel_.isSearching(), |
678 metadataCache: fm.metadataCache_, | 677 metadataCache: fm.metadataCache_, |
679 pageState: this.params_, | 678 pageState: this.params_, |
680 appWindow: chrome.app.window.current(), | 679 appWindow: chrome.app.window.current(), |
681 onBack: onBack, | 680 onBack: onBack, |
682 onClose: onClose, | 681 onClose: onClose, |
683 onMaximize: onMaximize, | 682 onMaximize: onMaximize, |
684 onAppRegionChanged: onAppRegionChanged, | 683 onAppRegionChanged: onAppRegionChanged, |
685 displayStringFunction: strf | 684 displayStringFunction: strf |
686 }; | 685 }; |
687 // TODO(mtomasz): Pass entries instead. | |
688 var allUrls = util.entriesToURLs(allEntries); | |
689 var urls = util.entriesToURLs(entries); | |
690 galleryFrame.contentWindow.Gallery.open( | 686 galleryFrame.contentWindow.Gallery.open( |
691 context, fm.volumeManager_, allUrls, urls); | 687 context, fm.volumeManager_, allEntries, entries); |
hirono
2013/12/10 03:36:53
FileManager have a public 'volumeManager' getter.
mtomasz
2013/12/10 05:07:01
Done.
| |
692 }.bind(this); | 688 }.bind(this); |
693 | 689 |
694 galleryFrame.src = 'gallery.html'; | 690 galleryFrame.src = 'gallery.html'; |
695 fm.openFilePopup(galleryFrame, fm.updateTitle_.bind(fm)); | 691 fm.openFilePopup(galleryFrame, fm.updateTitle_.bind(fm)); |
696 }; | 692 }; |
697 | 693 |
698 /** | 694 /** |
699 * Displays the list of tasks in a task picker combobutton. | 695 * Displays the list of tasks in a task picker combobutton. |
700 * | 696 * |
701 * @param {cr.ui.ComboButton} combobutton The task picker element. | 697 * @param {cr.ui.ComboButton} combobutton The task picker element. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
829 items, defaultIdx, | 825 items, defaultIdx, |
830 function(item) { | 826 function(item) { |
831 onSuccess(item.task); | 827 onSuccess(item.task); |
832 }); | 828 }); |
833 }; | 829 }; |
834 | 830 |
835 FileTasks.decorate('display'); | 831 FileTasks.decorate('display'); |
836 FileTasks.decorate('updateMenuItem'); | 832 FileTasks.decorate('updateMenuItem'); |
837 FileTasks.decorate('execute'); | 833 FileTasks.decorate('execute'); |
838 FileTasks.decorate('executeDefault'); | 834 FileTasks.decorate('executeDefault'); |
OLD | NEW |