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

Side by Side Diff: ui/file_manager/image_loader/request.js

Issue 310433004: Gallery.app: Update thumbnail when a file is edited on the photo editor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 6 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
« no previous file with comments | « ui/file_manager/gallery/js/slide_mode.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 * Creates and starts downloading and then resizing of the image. Finally, 8 * Creates and starts downloading and then resizing of the image. Finally,
9 * returns the image using the callback. 9 * returns the image using the callback.
10 * 10 *
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 }.bind(this); 266 }.bind(this);
267 267
268 // Refreshes the access token and retries the request. 268 // Refreshes the access token and retries the request.
269 var maybeRetryCall = function(code) { 269 var maybeRetryCall = function(code) {
270 if (this.aborted_) 270 if (this.aborted_)
271 return; 271 return;
272 requestTokenAndCall(true, onMaybeSuccess, onMaybeFailure); 272 requestTokenAndCall(true, onMaybeSuccess, onMaybeFailure);
273 }.bind(this); 273 }.bind(this);
274 274
275 // Do not request a token for local resources, since it is not necessary. 275 // Do not request a token for local resources, since it is not necessary.
276 if (url.indexOf('filesystem:') === 0) { 276 if (/^filesystem:/.test(url)) {
277 this.xhr_ = AuthorizedXHR.load_(null, url, onMaybeSuccess, onMaybeFailure); 277 // The query parameter is workaround for
278 // crbug.com/379678, which force to obtain the latest contents of the image.
279 var noCacheUrl = url + '?nocache=' + Date.now();
280 this.xhr_ = AuthorizedXHR.load_(
281 null,
282 noCacheUrl,
283 onMaybeSuccess,
284 onMaybeFailure);
278 return; 285 return;
279 } 286 }
280 287
281 // Make the request with reusing the current token. If it fails, then retry. 288 // Make the request with reusing the current token. If it fails, then retry.
282 requestTokenAndCall(false, onMaybeSuccess, maybeRetryCall); 289 requestTokenAndCall(false, onMaybeSuccess, maybeRetryCall);
283 }; 290 };
284 291
285 /** 292 /**
286 * Fetches data using authorized XmlHttpRequest with the provided OAuth2 token. 293 * Fetches data using authorized XmlHttpRequest with the provided OAuth2 token.
287 * If the token is invalid, the request will fail. 294 * If the token is invalid, the request will fail.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + 436 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' +
430 'ABAAEAAAICTAEAOw=='; 437 'ABAAEAAAICTAEAOw==';
431 438
432 this.xhr_.onload = function() {}; 439 this.xhr_.onload = function() {};
433 this.xhr_.abort(); 440 this.xhr_.abort();
434 441
435 // Dispose memory allocated by Canvas. 442 // Dispose memory allocated by Canvas.
436 this.canvas_.width = 0; 443 this.canvas_.width = 0;
437 this.canvas_.height = 0; 444 this.canvas_.height = 0;
438 }; 445 };
OLDNEW
« no previous file with comments | « ui/file_manager/gallery/js/slide_mode.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698