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

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

Issue 2678723002: Compile several targets in Gallery in gyp v2. (Closed)
Patch Set: Rebased. Created 3 years, 10 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 /** 5 /**
6 * Overrided metadata worker's path. 6 * Overrided metadata worker's path.
7 * @type {string} 7 * @type {string}
8 */ 8 */
9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js'; 9 ContentMetadataProvider.WORKER_SCRIPT = '/js/metadata_worker.js';
10 10
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 chrome.accessibilityFeatures.highContrast.onChange.addListener( 222 chrome.accessibilityFeatures.highContrast.onChange.addListener(
223 this.onGetOrChangedAccessibilityConfiguration_.bind( 223 this.onGetOrChangedAccessibilityConfiguration_.bind(
224 this, 'high-contrast')); 224 this, 'high-contrast'));
225 chrome.accessibilityFeatures.highContrast.get({}, 225 chrome.accessibilityFeatures.highContrast.get({},
226 this.onGetOrChangedAccessibilityConfiguration_.bind( 226 this.onGetOrChangedAccessibilityConfiguration_.bind(
227 this, 'high-contrast')); 227 this, 'high-contrast'));
228 } 228 }
229 229
230 /** 230 /**
231 * Tools fade-out timeout in milliseconds.
232 * @const
233 * @type {number}
234 */
235 Gallery.FADE_TIMEOUT = 2000;
236
237 /**
238 * First time tools fade-out timeout in milliseconds. 231 * First time tools fade-out timeout in milliseconds.
239 * @const 232 * @const
240 * @type {number} 233 * @type {number}
241 */ 234 */
242 Gallery.FIRST_FADE_TIMEOUT = 1000; 235 Gallery.FIRST_FADE_TIMEOUT = 1000;
243 236
244 /** 237 /**
245 * Time until mosaic is initialized in the background. Used to make gallery 238 * Time until mosaic is initialized in the background. Used to make gallery
246 * in the slide mode load faster. In milliseconds. 239 * in the slide mode load faster. In milliseconds.
247 * @const 240 * @const
248 * @type {number} 241 * @type {number}
249 */ 242 */
250 Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000; 243 Gallery.MOSAIC_BACKGROUND_INIT_DELAY = 1000;
251 244
252 /** 245 /**
253 * Types of metadata Gallery uses (to query the metadata cache).
254 * @const
255 * @type {!Array<string>}
256 */
257 Gallery.PREFETCH_PROPERTY_NAMES =
258 ['imageWidth', 'imageHeight', 'imageRotation', 'size', 'present'];
259
260 /**
261 * Modes in Gallery. 246 * Modes in Gallery.
262 * @enum {string} 247 * @enum {string}
263 */ 248 */
264 Gallery.Mode = { 249 Gallery.Mode = {
265 SLIDE: 'slide', 250 SLIDE: 'slide',
266 THUMBNAIL: 'thumbnail' 251 THUMBNAIL: 'thumbnail'
267 }; 252 };
268 253
269 /** 254 /**
270 * Sub modes in Gallery. 255 * Sub modes in Gallery.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 // Use the self variable capture-by-closure because it is faster than bind. 373 // Use the self variable capture-by-closure because it is faster than bind.
389 var self = this; 374 var self = this;
390 var thumbnailModel = new ThumbnailModel(this.metadataModel_); 375 var thumbnailModel = new ThumbnailModel(this.metadataModel_);
391 var loadNext = function(index) { 376 var loadNext = function(index) {
392 // Extract chunk. 377 // Extract chunk.
393 if (index >= items.length) 378 if (index >= items.length)
394 return; 379 return;
395 var item = items[index]; 380 var item = items[index];
396 var entry = item.getEntry(); 381 var entry = item.getEntry();
397 var metadataPromise = self.metadataModel_.get([entry], 382 var metadataPromise = self.metadataModel_.get([entry],
398 Gallery.PREFETCH_PROPERTY_NAMES); 383 GalleryItem.PREFETCH_PROPERTY_NAMES);
399 var thumbnailPromise = thumbnailModel.get([entry]); 384 var thumbnailPromise = thumbnailModel.get([entry]);
400 return Promise.all([metadataPromise, thumbnailPromise]).then( 385 return Promise.all([metadataPromise, thumbnailPromise]).then(
401 function(metadataLists) { 386 function(metadataLists) {
402 // Add items to the model. 387 // Add items to the model.
403 item.setMetadataItem(metadataLists[0][0]); 388 item.setMetadataItem(metadataLists[0][0]);
404 item.setThumbnailMetadataItem(metadataLists[1][0]); 389 item.setThumbnailMetadataItem(metadataLists[1][0]);
405 390
406 var event = new Event('content'); 391 var event = new Event('content');
407 event.item = item; 392 event.item = item;
408 event.oldEntry = entry; 393 event.oldEntry = entry;
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 */ 1059 */
1075 var initializePromise = 1060 var initializePromise =
1076 Promise.all([loadTimeDataPromise, volumeManagerPromise]). 1061 Promise.all([loadTimeDataPromise, volumeManagerPromise]).
1077 then(function(args) { 1062 then(function(args) {
1078 var volumeManager = args[1]; 1063 var volumeManager = args[1];
1079 gallery = new Gallery(volumeManager); 1064 gallery = new Gallery(volumeManager);
1080 }); 1065 });
1081 1066
1082 // Loads entries. 1067 // Loads entries.
1083 initializePromise.then(reload); 1068 initializePromise.then(reload);
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/compiled_resources2.gyp ('k') | ui/file_manager/gallery/js/gallery_data_model.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698