Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: chrome/browser/resources/file_manager/foreground/js/file_tasks.js

Issue 109973002: Migrate from URLs to Entries in the Files App's gallery. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 util.updateAppState(null /* keep path */, '' /* remove search. */); 610 util.updateAppState(null /* keep path */, '' /* remove search. */);
611 } 611 }
612 612
613 var savedAppState = window.appState; 613 var savedAppState = window.appState;
614 var savedTitle = document.title; 614 var savedTitle = document.title;
615 615
616 // Push a temporary state which will be replaced every time the selection 616 // Push a temporary state which will be replaced every time the selection
617 // changes in the Gallery and popped when the Gallery is closed. 617 // changes in the Gallery and popped when the Gallery is closed.
618 util.updateAppState(); 618 util.updateAppState();
619 619
620 // TODO(mtomasz): Pass entries instead of urls. 620 var onBack = function(selectedEntries) {
621 var onBack = function(selectedUrls) { 621 fm.directoryModel_.selectEntries(selectedEntries);
622 fm.directoryModel_.selectUrls(selectedUrls);
623 fm.closeFilePopup(); // Will call Gallery.unload. 622 fm.closeFilePopup(); // Will call Gallery.unload.
624 window.appState = savedAppState; 623 window.appState = savedAppState;
625 util.saveAppState(); 624 util.saveAppState();
626 document.title = savedTitle; 625 document.title = savedTitle;
627 }; 626 };
628 627
629 var onClose = function() { 628 var onClose = function() {
630 fm.onClose(); 629 fm.onClose();
631 }; 630 };
632 631
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 searchResults: fm.directoryModel_.isSearching(), 664 searchResults: fm.directoryModel_.isSearching(),
666 metadataCache: fm.metadataCache_, 665 metadataCache: fm.metadataCache_,
667 pageState: this.params_, 666 pageState: this.params_,
668 appWindow: chrome.app.window.current(), 667 appWindow: chrome.app.window.current(),
669 onBack: onBack, 668 onBack: onBack,
670 onClose: onClose, 669 onClose: onClose,
671 onMaximize: onMaximize, 670 onMaximize: onMaximize,
672 onAppRegionChanged: onAppRegionChanged, 671 onAppRegionChanged: onAppRegionChanged,
673 displayStringFunction: strf 672 displayStringFunction: strf
674 }; 673 };
675 // TODO(mtomasz): Pass entries instead. 674 // TODO(mtomasz): Pass entries instead.
hirono 2013/12/09 06:53:50 nit: The TODO has already done!
mtomasz 2013/12/10 02:37:34 Yay! Done.
676 var allUrls = util.entriesToURLs(allEntries);
677 var urls = util.entriesToURLs(entries);
678 galleryFrame.contentWindow.Gallery.open( 675 galleryFrame.contentWindow.Gallery.open(
679 context, fm.volumeManager_, allUrls, urls); 676 context, fm.volumeManager_, allEntries, entries);
680 }.bind(this); 677 }.bind(this);
681 678
682 galleryFrame.src = 'gallery.html'; 679 galleryFrame.src = 'gallery.html';
683 fm.openFilePopup(galleryFrame, fm.updateTitle_.bind(fm)); 680 fm.openFilePopup(galleryFrame, fm.updateTitle_.bind(fm));
684 }; 681 };
685 682
686 /** 683 /**
687 * Displays the list of tasks in a task picker combobutton. 684 * Displays the list of tasks in a task picker combobutton.
688 * 685 *
689 * @param {cr.ui.ComboButton} combobutton The task picker element. 686 * @param {cr.ui.ComboButton} combobutton The task picker element.
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 items, defaultIdx, 814 items, defaultIdx,
818 function(item) { 815 function(item) {
819 onSuccess(item.task); 816 onSuccess(item.task);
820 }); 817 });
821 }; 818 };
822 819
823 FileTasks.decorate('display'); 820 FileTasks.decorate('display');
824 FileTasks.decorate('updateMenuItem'); 821 FileTasks.decorate('updateMenuItem');
825 FileTasks.decorate('execute'); 822 FileTasks.decorate('execute');
826 FileTasks.decorate('executeDefault'); 823 FileTasks.decorate('executeDefault');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698