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 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 oldDropTarget.classList.remove('accepts'); | 1514 oldDropTarget.classList.remove('accepts'); |
1515 }, 0); | 1515 }, 0); |
1516 } | 1516 } |
1517 this.dropTarget_ = listItem; | 1517 this.dropTarget_ = listItem; |
1518 }; | 1518 }; |
1519 | 1519 |
1520 FileManager.prototype.initButter_ = function() { | 1520 FileManager.prototype.initButter_ = function() { |
1521 var self = this; | 1521 var self = this; |
1522 var progress = this.copyManager_.getProgress(); | 1522 var progress = this.copyManager_.getProgress(); |
1523 | 1523 |
1524 var options = {progress: progress.percentage, actions: {}}; | 1524 var options = {progress: progress.percentage, actions: {}, timeout: 0}; |
1525 options.actions[str('CANCEL_LABEL')] = function cancelPaste() { | 1525 options.actions[str('CANCEL_LABEL')] = function cancelPaste() { |
1526 self.copyManager_.requestCancel(); | 1526 self.copyManager_.requestCancel(); |
1527 }; | 1527 }; |
1528 this.showButter(strf('PASTE_ITEMS_REMAINING', progress.pendingItems), | 1528 this.showButter(strf('PASTE_ITEMS_REMAINING', progress.pendingItems), |
1529 options); | 1529 options); |
1530 }; | 1530 }; |
1531 | 1531 |
1532 FileManager.prototype.onCopyProgress_ = function(event) { | 1532 FileManager.prototype.onCopyProgress_ = function(event) { |
1533 var progress = this.copyManager_.getProgress(); | 1533 var progress = this.copyManager_.getProgress(); |
1534 | 1534 |
1535 if (event.reason == 'BEGIN') { | 1535 if (event.reason == 'BEGIN') { |
1536 if (this.currentButter_) | 1536 if (this.currentButter_) |
1537 this.hideButter(); | 1537 this.hideButter(); |
1538 | 1538 |
1539 clearTimeout(this.butterTimeout_); | 1539 clearTimeout(this.butterTimeout_); |
1540 // If the copy process lasts more than 500 ms, we show a progress bar. | 1540 // If the copy process lasts more than 500 ms, we show a progress bar. |
1541 this.butterTimeout_ = setTimeout(this.initButter_.bind(this), 500); | 1541 this.butterTimeout_ = setTimeout(this.initButter_.bind(this), 500); |
1542 return; | 1542 return; |
1543 } | 1543 } |
1544 if (event.reason == 'PROGRESS') { | 1544 if (event.reason == 'PROGRESS') { |
1545 // Perform this check inside Progress event handler, avoid to log error | 1545 // Perform this check inside Progress event handler, avoid to log error |
1546 // message 'Unknown event reason: PROGRESS' in console. | 1546 // message 'Unknown event reason: PROGRESS' in console. |
1547 if (this.currentButter_) { | 1547 if (this.currentButter_) { |
1548 var options = {progress: progress.percentage}; | 1548 var options = {progress: progress.percentage, timeout: 0}; |
1549 this.updateButter(strf('PASTE_ITEMS_REMAINING', progress.pendingItems), | 1549 this.updateButter(strf('PASTE_ITEMS_REMAINING', progress.pendingItems), |
1550 options); | 1550 options); |
1551 } | 1551 } |
1552 return; | 1552 return; |
1553 } | 1553 } |
1554 if (event.reason == 'SUCCESS') { | 1554 if (event.reason == 'SUCCESS') { |
1555 clearTimeout(this.butterTimeout_); | 1555 clearTimeout(this.butterTimeout_); |
1556 if (this.currentButter_) | 1556 if (this.currentButter_) |
1557 this.hideButter(); | 1557 this.hideButter(); |
1558 | 1558 |
(...skipping 3164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4723 | 4723 |
4724 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); | 4724 chrome.fileBrowserPrivate.setGDataPreferences(changeInfo); |
4725 | 4725 |
4726 if (oldValue) { | 4726 if (oldValue) { |
4727 event.target.removeAttribute('checked'); | 4727 event.target.removeAttribute('checked'); |
4728 } else { | 4728 } else { |
4729 event.target.setAttribute('checked', 'checked'); | 4729 event.target.setAttribute('checked', 'checked'); |
4730 } | 4730 } |
4731 }; | 4731 }; |
4732 })(); | 4732 })(); |
OLD | NEW |