| OLD | NEW |
| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 onSuccess(contentType, response); | 246 onSuccess(contentType, response); |
| 247 }.bind(this); | 247 }.bind(this); |
| 248 var onMaybeFailure = function(opt_code) { | 248 var onMaybeFailure = function(opt_code) { |
| 249 if (!this.aborted_) | 249 if (!this.aborted_) |
| 250 onFailure(); | 250 onFailure(); |
| 251 }.bind(this); | 251 }.bind(this); |
| 252 | 252 |
| 253 // Fetches the access token and makes an authorized call. If refresh is true, | 253 // Fetches the access token and makes an authorized call. If refresh is true, |
| 254 // then forces refreshing the access token. | 254 // then forces refreshing the access token. |
| 255 var requestTokenAndCall = function(refresh, onInnerSuccess, onInnerFailure) { | 255 var requestTokenAndCall = function(refresh, onInnerSuccess, onInnerFailure) { |
| 256 chrome.fileBrowserPrivate.requestAccessToken(refresh, function(token) { | 256 chrome.fileManagerPrivate.requestAccessToken(refresh, function(token) { |
| 257 if (this.aborted_) | 257 if (this.aborted_) |
| 258 return; | 258 return; |
| 259 if (!token) { | 259 if (!token) { |
| 260 onInnerFailure(); | 260 onInnerFailure(); |
| 261 return; | 261 return; |
| 262 } | 262 } |
| 263 this.xhr_ = AuthorizedXHR.load_( | 263 this.xhr_ = AuthorizedXHR.load_( |
| 264 token, url, onInnerSuccess, onInnerFailure); | 264 token, url, onInnerSuccess, onInnerFailure); |
| 265 }.bind(this)); | 265 }.bind(this)); |
| 266 }.bind(this); | 266 }.bind(this); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + | 436 this.image_.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAA' + |
| 437 'ABAAEAAAICTAEAOw=='; | 437 'ABAAEAAAICTAEAOw=='; |
| 438 | 438 |
| 439 this.xhr_.onload = function() {}; | 439 this.xhr_.onload = function() {}; |
| 440 this.xhr_.abort(); | 440 this.xhr_.abort(); |
| 441 | 441 |
| 442 // Dispose memory allocated by Canvas. | 442 // Dispose memory allocated by Canvas. |
| 443 this.canvas_.width = 0; | 443 this.canvas_.width = 0; |
| 444 this.canvas_.height = 0; | 444 this.canvas_.height = 0; |
| 445 }; | 445 }; |
| OLD | NEW |