OLD | NEW |
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 // Setting the src of an img to an empty string can crash the browser, so we | 5 // Setting the src of an img to an empty string can crash the browser, so we |
6 // use an empty 1x1 gif instead. | 6 // use an empty 1x1 gif instead. |
7 | 7 |
8 /** | 8 /** |
9 * FileManager constructor. | 9 * FileManager constructor. |
10 * | 10 * |
(...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2455 }.bind(this)); | 2455 }.bind(this)); |
2456 }; | 2456 }; |
2457 | 2457 |
2458 FileManager.prototype.executeIfAvailable_ = function(urls, callback) { | 2458 FileManager.prototype.executeIfAvailable_ = function(urls, callback) { |
2459 if (this.isOnGData() && this.isOffline()) { | 2459 if (this.isOnGData() && this.isOffline()) { |
2460 chrome.fileBrowserPrivate.getGDataFileProperties(urls, function(props) { | 2460 chrome.fileBrowserPrivate.getGDataFileProperties(urls, function(props) { |
2461 for (var i = 0; i != props.length; i++) { | 2461 for (var i = 0; i != props.length; i++) { |
2462 if (!this.isAvaliableOffline_(props[i], FileType.getType(urls[i]))) { | 2462 if (!this.isAvaliableOffline_(props[i], FileType.getType(urls[i]))) { |
2463 this.alert.showHtml( | 2463 this.alert.showHtml( |
2464 str('OFFLINE_HEADER'), | 2464 str('OFFLINE_HEADER'), |
2465 strf('OFFLINE_MESSAGE', str('OFFLINE_COLUMN_LABEL'))); | 2465 strf( |
| 2466 urls.length == 1 ? |
| 2467 'OFFLINE_MESSAGE' : |
| 2468 'OFFLINE_MESSAGE_PLURAL', |
| 2469 str('OFFLINE_COLUMN_LABEL'))); |
2466 return; | 2470 return; |
2467 } | 2471 } |
2468 } | 2472 } |
2469 callback(urls); | 2473 callback(urls); |
2470 }.bind(this)); | 2474 }.bind(this)); |
2471 } else { | 2475 } else { |
2472 callback(urls); | 2476 callback(urls); |
2473 } | 2477 } |
2474 }; | 2478 }; |
2475 | 2479 |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3167 // checkbox back off. | 3171 // checkbox back off. |
3168 // | 3172 // |
3169 // Since we're going to force checkboxes into the correct state for any | 3173 // Since we're going to force checkboxes into the correct state for any |
3170 // multi-selection, we can prevent this shift click from toggling the | 3174 // multi-selection, we can prevent this shift click from toggling the |
3171 // checkbox and avoid the trouble. | 3175 // checkbox and avoid the trouble. |
3172 event.preventDefault(); | 3176 event.preventDefault(); |
3173 } | 3177 } |
3174 }; | 3178 }; |
3175 | 3179 |
3176 FileManager.prototype.onPinClick_ = function(checkbox, entry, event) { | 3180 FileManager.prototype.onPinClick_ = function(checkbox, entry, event) { |
| 3181 var self = this; |
3177 function callback(props) { | 3182 function callback(props) { |
| 3183 if (props.errorCode) { |
| 3184 // TODO(serya): Do not show the message if unpin failed. |
| 3185 cacheEntryDateAndSize(entry, function() { |
| 3186 self.alert.showHtml(str('GDATA_OUT_OF_SPACE_HEADER'), |
| 3187 strf('GDATA_OUT_OF_SPACE_MESSAGE', |
| 3188 util.bytesToSi(entry.cachedSize_))); |
| 3189 }); |
| 3190 } |
3178 checkbox.checked = entry.gdata_.isPinned = props[0].isPinned; | 3191 checkbox.checked = entry.gdata_.isPinned = props[0].isPinned; |
3179 } | 3192 } |
3180 | 3193 |
3181 chrome.fileBrowserPrivate.pinGDataFile([entry.toURL()], | 3194 chrome.fileBrowserPrivate.pinGDataFile([entry.toURL()], |
3182 !checkbox.checked, callback); | 3195 !checkbox.checked, callback); |
3183 event.preventDefault(); | 3196 event.preventDefault(); |
3184 }; | 3197 }; |
3185 | 3198 |
3186 FileManager.prototype.selectDefaultPathInFilenameInput_ = function() { | 3199 FileManager.prototype.selectDefaultPathInFilenameInput_ = function() { |
3187 var input = this.filenameInput_; | 3200 var input = this.filenameInput_; |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4222 }); | 4235 }); |
4223 }, onError); | 4236 }, onError); |
4224 | 4237 |
4225 function onError(err) { | 4238 function onError(err) { |
4226 console.log('Error while checking free space: ' + err); | 4239 console.log('Error while checking free space: ' + err); |
4227 setTimeout(doCheck, 1000 * 60); | 4240 setTimeout(doCheck, 1000 * 60); |
4228 } | 4241 } |
4229 } | 4242 } |
4230 } | 4243 } |
4231 })(); | 4244 })(); |
OLD | NEW |