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

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

Issue 10006013: [NOT FOR COMMIT] Use chrome://gdata in Photo Editor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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) 2012 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 * A base class for metadata provider. Implementing in-memory caching. 6 * A base class for metadata provider. Implementing in-memory caching.
7 */ 7 */
8 function MetadataCache() { 8 function MetadataCache() {
9 this.cache_ = {}; 9 this.cache_ = {};
10 } 10 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 213 }
214 214
215 GDataMetadataFetcher.prototype = { __proto__: MetadataFetcher.prototype }; 215 GDataMetadataFetcher.prototype = { __proto__: MetadataFetcher.prototype };
216 216
217 GDataMetadataFetcher.prototype.doFetch = function(url) { 217 GDataMetadataFetcher.prototype.doFetch = function(url) {
218 function convertMetadata(result) { 218 function convertMetadata(result) {
219 return { 219 return {
220 remote: true, 220 remote: true,
221 thumbnailURL: result.thumbnailUrl, 221 thumbnailURL: result.thumbnailUrl,
222 contentURL: (result.contentUrl || '').replace(/\?.*$/gi, ''), 222 contentURL: (result.contentUrl || '').replace(/\?.*$/gi, ''),
223 cachedURL: result.editUrl,
223 fileSize: 0 // TODO(kaznacheev) Get the correct size from File API. 224 fileSize: 0 // TODO(kaznacheev) Get the correct size from File API.
224 } 225 }
225 } 226 }
226 227
227 chrome.fileBrowserPrivate.getGDataFileProperties([url], 228 chrome.fileBrowserPrivate.getGDataFileProperties([url],
228 function(results) { 229 function(results) {
229 this.processResult(url, convertMetadata(results[0])); 230 this.processResult(url, convertMetadata(results[0]));
230 }.bind(this)); 231 }.bind(this));
231 }; 232 };
232 233
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 MetadataProvider.prototype.fetchLocal = function(url, callback) { 280 MetadataProvider.prototype.fetchLocal = function(url, callback) {
280 this.fetch(url, function(metadata) { 281 this.fetch(url, function(metadata) {
281 if (metadata.remote) { 282 if (metadata.remote) {
282 delete metadata.remote; 283 delete metadata.remote;
283 this.fetch(url, callback, [this.local_]); 284 this.fetch(url, callback, [this.local_]);
284 } else { 285 } else {
285 callback(metadata); 286 callback(metadata);
286 } 287 }
287 }.bind(this)); 288 }.bind(this));
288 }; 289 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698