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

Side by Side Diff: chrome/browser/resources/file_manager/js/metadata_provider.js

Issue 8497009: Simplifying loading file JS and CSS files from external source. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cide review fixes. Created 9 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/main.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 * @param {string} opt_workerPath path to the worker source JS file. 6 * @param {string} opt_workerPath path to the worker source JS file.
7 */ 7 */
8 function MetadataProvider(opt_workerPath) { 8 function MetadataProvider(opt_workerPath) {
9 this.cache_ = {}; 9 this.cache_ = {};
10 10
11 // Pass all URLs to the metadata reader until we have a correct filter. 11 // Pass all URLs to the metadata reader until we have a correct filter.
12 this.urlFilter = /.*/; 12 this.urlFilter = /.*/;
13 13
14 this.dispatcher_ = new Worker(opt_workerPath || 'js/metadata_dispatcher.js'); 14 this.dispatcher_ = new Worker(opt_workerPath ||
15 document.location.origin + '/js/metadata_dispatcher.js');
15 this.dispatcher_.onmessage = this.onMessage_.bind(this); 16 this.dispatcher_.onmessage = this.onMessage_.bind(this);
16 this.dispatcher_.postMessage({verb: 'init'}); 17 this.dispatcher_.postMessage({verb: 'init'});
17 // Initialization is not complete until the Worker sends back the 18 // Initialization is not complete until the Worker sends back the
18 // 'initialized' message. See below. 19 // 'initialized' message. See below.
19 } 20 }
20 21
21 MetadataProvider.prototype.fetch = function(url, callback) { 22 MetadataProvider.prototype.fetch = function(url, callback) {
22 var cacheValue = this.cache_[url]; 23 var cacheValue = this.cache_[url];
23 24
24 if (!cacheValue) { 25 if (!cacheValue) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 this.cache_[url] = metadata; 99 this.cache_[url] = metadata;
99 }; 100 };
100 101
101 MetadataProvider.prototype.onError_ = function(url, step, error, metadata) { 102 MetadataProvider.prototype.onError_ = function(url, step, error, metadata) {
102 console.warn('metadata: ' + url + ': ' + step + ': ' + error); 103 console.warn('metadata: ' + url + ': ' + step + ': ' + error);
103 this.onResult_(url, metadata || {}); 104 this.onResult_(url, metadata || {});
104 }; 105 };
105 106
106 MetadataProvider.prototype.onLog_ = function(arglist) { 107 MetadataProvider.prototype.onLog_ = function(arglist) {
107 console.log.apply(console, ['metadata:'].concat(arglist)); 108 console.log.apply(console, ['metadata:'].concat(arglist));
108 }; 109 };
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698