| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' | 7 const EMPTY_IMAGE_URI = 'data:image/gif;base64,' |
| 8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; | 8 + 'R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D'; |
| 9 | 9 |
| 10 var g_slideshow_data = null; | 10 var g_slideshow_data = null; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 * mounted archive file volumes. | 176 * mounted archive file volumes. |
| 177 */ | 177 */ |
| 178 const ARCHIVE_DIRECTORY = '/archive'; | 178 const ARCHIVE_DIRECTORY = '/archive'; |
| 179 | 179 |
| 180 /** | 180 /** |
| 181 * The DirectoryEntry.fullPath value of the downloads directory. | 181 * The DirectoryEntry.fullPath value of the downloads directory. |
| 182 */ | 182 */ |
| 183 const DOWNLOADS_DIRECTORY = '/Downloads'; | 183 const DOWNLOADS_DIRECTORY = '/Downloads'; |
| 184 | 184 |
| 185 /** | 185 /** |
| 186 * Height of the downloads folder warning, in px. | |
| 187 */ | |
| 188 const DOWNLOADS_WARNING_HEIGHT = '57px'; | |
| 189 | |
| 190 /** | |
| 191 * Location of the FAQ about the downloads directory. | 186 * Location of the FAQ about the downloads directory. |
| 192 */ | 187 */ |
| 193 const DOWNLOADS_FAQ_URL = 'http://www.google.com/support/chromeos/bin/' + | 188 const DOWNLOADS_FAQ_URL = 'http://www.google.com/support/chromeos/bin/' + |
| 194 'answer.py?hl=en&answer=1061547'; | 189 'answer.py?hl=en&answer=1061547'; |
| 195 | 190 |
| 196 /** | 191 /** |
| 197 * Mnemonics for the second parameter of the changeDirectory method. | 192 * Mnemonics for the second parameter of the changeDirectory method. |
| 198 */ | 193 */ |
| 199 const CD_WITH_HISTORY = true; | 194 const CD_WITH_HISTORY = true; |
| 200 const CD_NO_HISTORY = false; | 195 const CD_NO_HISTORY = false; |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); | 564 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); |
| 570 this.previewMetadata_ = this.dialogDom_.querySelector('.preview-metadata'); | 565 this.previewMetadata_ = this.dialogDom_.querySelector('.preview-metadata'); |
| 571 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); | 566 this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); |
| 572 this.taskButtons_ = this.dialogDom_.querySelector('.task-buttons'); | 567 this.taskButtons_ = this.dialogDom_.querySelector('.task-buttons'); |
| 573 this.okButton_ = this.dialogDom_.querySelector('.ok'); | 568 this.okButton_ = this.dialogDom_.querySelector('.ok'); |
| 574 this.cancelButton_ = this.dialogDom_.querySelector('.cancel'); | 569 this.cancelButton_ = this.dialogDom_.querySelector('.cancel'); |
| 575 this.newFolderButton_ = this.dialogDom_.querySelector('.new-folder'); | 570 this.newFolderButton_ = this.dialogDom_.querySelector('.new-folder'); |
| 576 this.copyButton_ = this.dialogDom_.querySelector('.clipboard-copy'); | 571 this.copyButton_ = this.dialogDom_.querySelector('.clipboard-copy'); |
| 577 this.pasteButton_ = this.dialogDom_.querySelector('.clipboard-paste'); | 572 this.pasteButton_ = this.dialogDom_.querySelector('.clipboard-paste'); |
| 578 | 573 |
| 579 this.downloadsWarning_ = | |
| 580 this.dialogDom_.querySelector('.downloads-warning'); | |
| 581 var html = util.htmlUnescape(strf('DOWNLOADS_DIRECTORY_WARNING', | |
| 582 DOWNLOADS_FAQ_URL)); | |
| 583 // TODO(rginda): Fix this string in the grd file to include the target | |
| 584 // attribute, post R14. | |
| 585 html = html.replace('<a href=', '<a target=new_ href='); | |
| 586 this.downloadsWarning_.lastElementChild.innerHTML = html; | |
| 587 | |
| 588 this.document_.addEventListener('keydown', this.onKeyDown_.bind(this)); | 574 this.document_.addEventListener('keydown', this.onKeyDown_.bind(this)); |
| 589 | 575 |
| 590 this.descriptionTable_ = | 576 this.descriptionTable_ = |
| 591 this.dialogDom_.querySelector('.preview-metadata-table'); | 577 this.dialogDom_.querySelector('.preview-metadata-table'); |
| 592 | 578 |
| 593 this.renameInput_ = this.document_.createElement('input'); | 579 this.renameInput_ = this.document_.createElement('input'); |
| 594 this.renameInput_.className = 'rename'; | 580 this.renameInput_.className = 'rename'; |
| 595 | 581 |
| 596 this.renameInput_.addEventListener( | 582 this.renameInput_.addEventListener( |
| 597 'keydown', this.onRenameInputKeyDown_.bind(this)); | 583 'keydown', this.onRenameInputKeyDown_.bind(this)); |
| (...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2500 this.onOk_(); | 2486 this.onOk_(); |
| 2501 | 2487 |
| 2502 }; | 2488 }; |
| 2503 | 2489 |
| 2504 /** | 2490 /** |
| 2505 * Update the UI when the current directory changes. | 2491 * Update the UI when the current directory changes. |
| 2506 * | 2492 * |
| 2507 * @param {cr.Event} event The directory-changed event. | 2493 * @param {cr.Event} event The directory-changed event. |
| 2508 */ | 2494 */ |
| 2509 FileManager.prototype.onDirectoryChanged_ = function(event) { | 2495 FileManager.prototype.onDirectoryChanged_ = function(event) { |
| 2510 if (this.dialogType_ == FileManager.DialogType.FULL_PAGE && | |
| 2511 this.currentDirEntry_.fullPath.substr(0, DOWNLOADS_DIRECTORY.length) == | |
| 2512 DOWNLOADS_DIRECTORY) { | |
| 2513 if (this.downloadsWarning_.style.height != DOWNLOADS_WARNING_HEIGHT) { | |
| 2514 // Current path starts with DOWNLOADS_DIRECTORY, show the warning. | |
| 2515 this.downloadsWarning_.style.height = DOWNLOADS_WARNING_HEIGHT; | |
| 2516 this.requestResize_(100); | |
| 2517 } | |
| 2518 } else { | |
| 2519 if (this.downloadsWarning_.style.height != '0') { | |
| 2520 this.downloadsWarning_.style.height = '0'; | |
| 2521 this.requestResize_(100); | |
| 2522 } | |
| 2523 } | |
| 2524 | |
| 2525 this.updateCommands_(); | 2496 this.updateCommands_(); |
| 2526 this.updateOkButton_(); | 2497 this.updateOkButton_(); |
| 2527 | 2498 |
| 2528 // New folder should never be enabled in the root or media/ directories. | 2499 // New folder should never be enabled in the root or media/ directories. |
| 2529 this.newFolderButton_.disabled = isSystemDirEntry(this.currentDirEntry_); | 2500 this.newFolderButton_.disabled = isSystemDirEntry(this.currentDirEntry_); |
| 2530 | 2501 |
| 2531 this.document_.title = this.currentDirEntry_.fullPath; | 2502 this.document_.title = this.currentDirEntry_.fullPath; |
| 2532 | 2503 |
| 2533 var self = this; | 2504 var self = this; |
| 2534 this.rescanDirectory_(function() { | 2505 this.rescanDirectory_(function() { |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3164 | 3135 |
| 3165 if (msg) { | 3136 if (msg) { |
| 3166 console.log('no no no'); | 3137 console.log('no no no'); |
| 3167 this.alert.show(msg, onAccept); | 3138 this.alert.show(msg, onAccept); |
| 3168 return false; | 3139 return false; |
| 3169 } | 3140 } |
| 3170 | 3141 |
| 3171 return true; | 3142 return true; |
| 3172 }; | 3143 }; |
| 3173 })(); | 3144 })(); |
| OLD | NEW |