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

Side by Side Diff: ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js

Issue 246543002: Add script files of the separated Gallery.app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 /**
8 * Protocol + host parts of extension URL.
9 * @type {string}
10 * @const
11 */
12 var FILE_MANAGER_HOST = 'chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj';
13
7 // All of these scripts could be imported with a single call to importScripts, 14 // All of these scripts could be imported with a single call to importScripts,
8 // but then load and compile time errors would all be reported from the same 15 // but then load and compile time errors would all be reported from the same
9 // line. 16 // line.
10 importScripts('metadata_parser.js'); 17 importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/metadata_parser.js');
11 importScripts('byte_reader.js'); 18 importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/byte_reader.js');
12 importScripts('../../../common/js/util.js'); 19 importScripts(FILE_MANAGER_HOST + '/common/js/util.js');
13 20
14 /** 21 /**
15 * Dispatches metadata requests to the correct parser. 22 * Dispatches metadata requests to the correct parser.
16 * 23 *
17 * @param {Object} port Worker port. 24 * @param {Object} port Worker port.
18 * @constructor 25 * @constructor
19 */ 26 */
20 function MetadataDispatcher(port) { 27 function MetadataDispatcher(port) {
21 this.port_ = port; 28 this.port_ = port;
22 this.port_.onmessage = this.onMessage.bind(this); 29 this.port_.onmessage = this.onMessage.bind(this);
23 30
24 // Make sure to update component_extension_resources.grd 31 // Make sure to update component_extension_resources.grd
25 // when adding new parsers. 32 // when adding new parsers.
26 importScripts('exif_parser.js'); 33 importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/exif_parser.js');
27 importScripts('image_parsers.js'); 34 importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/image_parsers.js');
28 importScripts('mpeg_parser.js'); 35 importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/mpeg_parser.js');
29 importScripts('id3_parser.js'); 36 importScripts(FILE_MANAGER_HOST + '/foreground/js/metadata/id3_parser.js');
30 37
31 var patterns = []; 38 var patterns = [];
32 39
33 this.parserInstances_ = []; 40 this.parserInstances_ = [];
34 for (var i = 0; i < MetadataDispatcher.parserClasses_.length; i++) { 41 for (var i = 0; i < MetadataDispatcher.parserClasses_.length; i++) {
35 var parserClass = MetadataDispatcher.parserClasses_[i]; 42 var parserClass = MetadataDispatcher.parserClasses_[i];
36 var parser = new parserClass(this); 43 var parser = new parserClass(this);
37 this.parserInstances_.push(parser); 44 this.parserInstances_.push(parser);
38 patterns.push(parser.urlFilter.source); 45 patterns.push(parser.urlFilter.source);
39 } 46 }
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 if (global.constructor.name == 'SharedWorkerGlobalScope') { 224 if (global.constructor.name == 'SharedWorkerGlobalScope') {
218 global.addEventListener('connect', function(e) { 225 global.addEventListener('connect', function(e) {
219 var port = e.ports[0]; 226 var port = e.ports[0];
220 new MetadataDispatcher(port); 227 new MetadataDispatcher(port);
221 port.start(); 228 port.start();
222 }); 229 });
223 } else { 230 } else {
224 // Non-shared worker. 231 // Non-shared worker.
225 new MetadataDispatcher(global); 232 new MetadataDispatcher(global);
226 } 233 }
OLDNEW
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/metadata/metadata_cache.js ('k') | ui/file_manager/file_manager/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698