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

Side by Side Diff: ui/file_manager/gallery/js/gallery_item.js

Issue 529413002: Rename DriveProvider to ExternalProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * Object representing an image item (a photo). 8 * Object representing an image item (a photo).
9 * 9 *
10 * @param {FileEntry} entry Image entry. 10 * @param {FileEntry} entry Image entry.
11 * @param {EntryLocation} locationInfo Entry location information.
11 * @param {function():Promise} fethcedMediaProvider Function to provide the 12 * @param {function():Promise} fethcedMediaProvider Function to provide the
12 * fetchedMedia metadata. 13 * fetchedMedia metadata.
13 * @param {boolean} original Whether the entry is original or edited. 14 * @param {boolean} original Whether the entry is original or edited.
14 * @param {boolean} readonly Whether the entry is located at readonly directory 15 * @param {boolean} readonly Whether the entry is located at readonly directory
hirono 2014/09/04 03:45:02 If the item takes EntryLocation, we don't need to
15 * or not. 16 * or not.
16 * @constructor 17 * @constructor
17 */ 18 */
18 Gallery.Item = function(entry, metadata, metadataCache, original, readonly) { 19 Gallery.Item = function(
20 entry, locationInfo, metadata, metadataCache, original, readonly) {
19 /** 21 /**
20 * @type {FileEntry} 22 * @type {FileEntry}
21 * @private 23 * @private
22 */ 24 */
23 this.entry_ = entry; 25 this.entry_ = entry;
24 26
25 /** 27 /**
28 * @type {EntryLocation}
29 * @private
30 */
31 this.locationInfo_ = locationInfo;
32
33 /**
26 * @type {Object} 34 * @type {Object}
27 * @private 35 * @private
28 */ 36 */
29 this.metadata_ = Object.freeze(metadata); 37 this.metadata_ = Object.freeze(metadata);
30 38
31 /** 39 /**
32 * @type {MetadataCache} 40 * @type {MetadataCache}
33 * @private 41 * @private
34 */ 42 */
35 this.metadataCache_ = metadataCache; 43 this.metadataCache_ = metadataCache;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 79
72 Object.seal(this); 80 Object.seal(this);
73 }; 81 };
74 82
75 /** 83 /**
76 * @return {FileEntry} Image entry. 84 * @return {FileEntry} Image entry.
77 */ 85 */
78 Gallery.Item.prototype.getEntry = function() { return this.entry_; }; 86 Gallery.Item.prototype.getEntry = function() { return this.entry_; };
79 87
80 /** 88 /**
89 * @return {EntryLocation} Entry location information.
90 */
91 Gallery.Item.prototype.getLocationInfo = function() {
92 return this.locationInfo_;
93 };
94
95 /**
81 * @return {Object} Metadata. 96 * @return {Object} Metadata.
82 */ 97 */
83 Gallery.Item.prototype.getMetadata = function() { return this.metadata_; }; 98 Gallery.Item.prototype.getMetadata = function() { return this.metadata_; };
84 99
85 /** 100 /**
86 * Obtains the latest media metadata. 101 * Obtains the latest media metadata.
87 * 102 *
88 * This is a heavy operation since it forces to load the image data to obtain 103 * This is a heavy operation since it forces to load the image data to obtain
89 * the metadata. 104 * the metadata.
90 * @return {Promise} Promise to be fulfilled with fetched metadata. 105 * @return {Promise} Promise to be fulfilled with fetched metadata.
(...skipping 29 matching lines...) Expand all
120 135
121 /** 136 /**
122 * @return {boolean} True if this image has not been created in this session. 137 * @return {boolean} True if this image has not been created in this session.
123 */ 138 */
124 Gallery.Item.prototype.isOriginal = function() { return this.original_; }; 139 Gallery.Item.prototype.isOriginal = function() { return this.original_; };
125 140
126 /** 141 /**
127 * @return {boolean} Whther the item is located at a readonly directory. 142 * @return {boolean} Whther the item is located at a readonly directory.
128 */ 143 */
129 Gallery.Item.prototype.isReadOnly = function() { 144 Gallery.Item.prototype.isReadOnly = function() {
130 return this.isReadOnly_; 145 return this.isReadOnly_;
131 }; 146 };
132 147
133 /** 148 /**
134 * Obtains the item is on the drive volume or not. 149 * @return {boolean} Whther the item supports sharing, or not.
135 * @return {boolean} True if the item is on the drive volume.
136 */ 150 */
137 Gallery.Item.prototype.isOnDrive = function() { 151 Gallery.Item.prototype.isShareable = function() {
hirono 2014/09/04 03:45:02 Is it used?
138 return !!this.metadata_.drive; 152 return this.locationInfo_.isShareable;
139 }; 153 };
140 154
141 /** 155 /**
142 * Obtains the last accessed date. 156 * Obtains the last accessed date.
143 * @return {number} Last accessed date. 157 * @return {number} Last accessed date.
144 */ 158 */
145 Gallery.Item.prototype.getLastAccessedDate = function() { 159 Gallery.Item.prototype.getLastAccessedDate = function() {
146 return this.lastAccessed_; 160 return this.lastAccessed_;
147 }; 161 };
148 162
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 return Promise.reject(str('GALLERY_FILE_EXISTS')); 359 return Promise.reject(str('GALLERY_FILE_EXISTS'));
346 }, function() { 360 }, function() {
347 return new Promise( 361 return new Promise(
348 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName)); 362 this.entry_.moveTo.bind(this.entry_, parentDirectory, newFileName));
349 }.bind(this)); 363 }.bind(this));
350 }.bind(this)); 364 }.bind(this));
351 }.bind(this)).then(function(entry) { 365 }.bind(this)).then(function(entry) {
352 this.entry_ = entry; 366 this.entry_ = entry;
353 }.bind(this)); 367 }.bind(this));
354 }; 368 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/gallery.js ('k') | ui/file_manager/gallery/js/image_editor/image_view.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698