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

Unified Diff: chrome/browser/resources/file_manager/foreground/js/photo/mosaic_mode.js

Issue 130383003: Migrate from fullPath to Entry in the mosaic view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/file_manager/foreground/js/photo/gallery.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/foreground/js/photo/mosaic_mode.js
diff --git a/chrome/browser/resources/file_manager/foreground/js/photo/mosaic_mode.js b/chrome/browser/resources/file_manager/foreground/js/photo/mosaic_mode.js
index 7c5b748ee55bad1b6f35968dc518a46b93c929a5..e17efcb10ea89c10af4112e097062db8cd19268c 100644
--- a/chrome/browser/resources/file_manager/foreground/js/photo/mosaic_mode.js
+++ b/chrome/browser/resources/file_manager/foreground/js/photo/mosaic_mode.js
@@ -9,13 +9,16 @@
* @param {cr.ui.ArrayDataModel} dataModel Data model.
* @param {cr.ui.ListSelectionModel} selectionModel Selection model.
* @param {MetadataCache} metadataCache Metadata cache.
+ * @param {VolumeManagerWrapper} volumeManager Volume manager.
* @param {function} toggleMode Function to switch to the Slide mode.
* @constructor
*/
function MosaicMode(
- container, dataModel, selectionModel, metadataCache, toggleMode) {
+ container, dataModel, selectionModel, metadataCache, volumeManager,
+ toggleMode) {
this.mosaic_ = new Mosaic(
- container.ownerDocument, dataModel, selectionModel, metadataCache);
+ container.ownerDocument, dataModel, selectionModel, metadataCache,
+ volumeManager);
container.appendChild(this.mosaic_);
this.toggleMode_ = toggleMode;
@@ -73,12 +76,15 @@ MosaicMode.prototype.onKeyDown = function(event) {
* @param {cr.ui.ArrayDataModel} dataModel Data model.
* @param {cr.ui.ListSelectionModel} selectionModel Selection model.
* @param {MetadataCache} metadataCache Metadata cache.
+ * @param {VolumeManagerWrapper} volumeManager Volume manager.
* @return {Element} Mosaic element.
* @constructor
*/
-function Mosaic(document, dataModel, selectionModel, metadataCache) {
+function Mosaic(document, dataModel, selectionModel, metadataCache,
+ volumeManager) {
var self = document.createElement('div');
- Mosaic.decorate(self, dataModel, selectionModel, metadataCache);
+ Mosaic.decorate(
+ self, dataModel, selectionModel, metadataCache, volumeManager);
return self;
}
@@ -109,14 +115,17 @@ Mosaic.ANIMATED_SCROLL_DURATION = 500;
* @param {cr.ui.ArrayDataModel} dataModel Data model.
* @param {cr.ui.ListSelectionModel} selectionModel Selection model.
* @param {MetadataCache} metadataCache Metadata cache.
+ * @param {VolumeManagerWrapper} volumeManager Volume manager.
*/
-Mosaic.decorate = function(self, dataModel, selectionModel, metadataCache) {
+Mosaic.decorate = function(
+ self, dataModel, selectionModel, metadataCache, volumeManager) {
self.__proto__ = Mosaic.prototype;
self.className = 'mosaic';
self.dataModel_ = dataModel;
self.selectionModel_ = selectionModel;
self.metadataCache_ = metadataCache;
+ self.volumeManager_ = volumeManager;
hirono 2014/01/09 04:05:39 Is this member used?
mtomasz 2014/01/10 01:40:10 Yes, in #149.
// Initialization is completed lazily on the first call to |init|.
};
@@ -135,8 +144,12 @@ Mosaic.prototype.init = function() {
new Mosaic.SelectionController(this.selectionModel_, this.layoutModel_);
this.tiles_ = [];
- for (var i = 0; i !== this.dataModel_.length; i++)
- this.tiles_.push(new Mosaic.Tile(this, this.dataModel_.item(i)));
+ for (var i = 0; i !== this.dataModel_.length; i++) {
+ var locationInfo =
+ this.volumeManager_.getLocationInfo(this.dataModel_.item(i).getEntry());
+ this.tiles_.push(
+ new Mosaic.Tile(this, this.dataModel_.item(i), locationInfo));
+ }
this.selectionModel_.selectedIndexes.forEach(function(index) {
this.tiles_[index].select(true);
@@ -1622,12 +1635,13 @@ Mosaic.Row.prototype.layout = function(left, top, width, height) {
*
* @param {Element} container Container element.
* @param {Gallery.Item} item Gallery item associated with this tile.
+ * @param {EntryLocation} locationInfo Location information for the tile.
hirono 2014/01/09 04:05:39 How about passing hidpiEmbedded flag instead of lo
mtomasz 2014/01/10 01:40:10 I was thinking about it. This would limit dependen
hirono 2014/01/10 03:18:23 So how about getting the flag in the constructor o
* @return {Element} The new tile element.
* @constructor
*/
-Mosaic.Tile = function(container, item) {
+Mosaic.Tile = function(container, item, locationInfo) {
var self = container.ownerDocument.createElement('div');
- Mosaic.Tile.decorate(self, container, item);
+ Mosaic.Tile.decorate(self, container, item, locationInfo);
return self;
};
@@ -1635,13 +1649,15 @@ Mosaic.Tile = function(container, item) {
* @param {Element} self Self pointer.
* @param {Element} container Container element.
* @param {Gallery.Item} item Gallery item associated with this tile.
+ * @param {EntryLocation} locationInfo Location info for the tile image.
*/
-Mosaic.Tile.decorate = function(self, container, item) {
+Mosaic.Tile.decorate = function(self, container, item, locationInfo) {
self.__proto__ = Mosaic.Tile.prototype;
self.className = 'mosaic-tile';
self.container_ = container;
self.item_ = item;
+ self.locationInfo_ = locationInfo;
self.left_ = null; // Mark as not laid out.
};
@@ -1777,9 +1793,7 @@ Mosaic.Tile.prototype.init = function(metadata, onImageMeasured) {
var priority = this.getAttribute('selected') ? 2 : 3;
// Use embedded thumbnails on Drive, since they have higher resolution.
- // TODO(mtomasz): Use Entry instead of paths.
- var hidpiEmbedded =
- PathUtil.isDriveBasedPath(this.getItem().getEntry().fullPath);
+ var hidpiEmbedded = this.locationInfo_ && this.locationInfo_.isDriveBased;
this.thumbnailLoader_ = new ThumbnailLoader(
this.getItem().getEntry(),
ThumbnailLoader.LoaderType.CANVAS,
« no previous file with comments | « chrome/browser/resources/file_manager/foreground/js/photo/gallery.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698