| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 this.currentButter_ = null; | 51 this.currentButter_ = null; |
| 52 | 52 |
| 53 // True if we should filter out files that start with a dot. | 53 // True if we should filter out files that start with a dot. |
| 54 this.filterFiles_ = true; | 54 this.filterFiles_ = true; |
| 55 | 55 |
| 56 this.commands_ = {}; | 56 this.commands_ = {}; |
| 57 | 57 |
| 58 this.document_ = dialogDom.ownerDocument; | 58 this.document_ = dialogDom.ownerDocument; |
| 59 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE; | 59 this.dialogType_ = this.params_.type || FileManager.DialogType.FULL_PAGE; |
| 60 | 60 |
| 61 this.alert = new cr.ui.dialogs.AlertDialog(this.dialogDom_); | 61 this.initDialogs_(); |
| 62 this.confirm = new cr.ui.dialogs.ConfirmDialog(this.dialogDom_); | |
| 63 this.prompt = new cr.ui.dialogs.PromptDialog(this.dialogDom_); | |
| 64 | 62 |
| 65 // TODO(dgozman): This will be changed to LocaleInfo. | 63 // TODO(dgozman): This will be changed to LocaleInfo. |
| 66 this.locale_ = new v8Locale(navigator.language); | 64 this.locale_ = new v8Locale(navigator.language); |
| 67 | 65 |
| 68 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is | 66 // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is |
| 69 // available in all chrome trunk builds. | 67 // available in all chrome trunk builds. |
| 70 if ('createDateTimeFormat' in this.locale_) { | 68 if ('createDateTimeFormat' in this.locale_) { |
| 71 this.shortDateFormatter_ = | 69 this.shortDateFormatter_ = |
| 72 this.locale_.createDateTimeFormat({'dateType': 'medium'}); | 70 this.locale_.createDateTimeFormat({'dateType': 'medium'}); |
| 73 } else { | 71 } else { |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 540 |
| 543 this.fileContextMenu_ = this.dialogDom_.querySelector('.file-context-menu'); | 541 this.fileContextMenu_ = this.dialogDom_.querySelector('.file-context-menu'); |
| 544 cr.ui.Menu.decorate(this.fileContextMenu_); | 542 cr.ui.Menu.decorate(this.fileContextMenu_); |
| 545 | 543 |
| 546 this.document_.addEventListener('canExecute', | 544 this.document_.addEventListener('canExecute', |
| 547 this.onCanExecute_.bind(this)); | 545 this.onCanExecute_.bind(this)); |
| 548 this.document_.addEventListener('command', this.onCommand_.bind(this)); | 546 this.document_.addEventListener('command', this.onCommand_.bind(this)); |
| 549 } | 547 } |
| 550 | 548 |
| 551 /** | 549 /** |
| 550 * One-time initialization of dialogs. |
| 551 */ |
| 552 FileManager.prototype.initDialogs_ = function() { |
| 553 cr.ui.dialogs.BaseDialog.OK_LABEL = str('OK_LABEL'); |
| 554 cr.ui.dialogs.BaseDialog.CANCEL_LABEL = str('CANCEL_LABEL'); |
| 555 this.alert = new cr.ui.dialogs.AlertDialog(this.dialogDom_); |
| 556 this.confirm = new cr.ui.dialogs.ConfirmDialog(this.dialogDom_); |
| 557 this.prompt = new cr.ui.dialogs.PromptDialog(this.dialogDom_); |
| 558 }; |
| 559 |
| 560 /** |
| 552 * One-time initialization of various DOM nodes. | 561 * One-time initialization of various DOM nodes. |
| 553 */ | 562 */ |
| 554 FileManager.prototype.initDom_ = function() { | 563 FileManager.prototype.initDom_ = function() { |
| 555 // Cache nodes we'll be manipulating. | 564 // Cache nodes we'll be manipulating. |
| 556 this.previewThumbnails_ = | 565 this.previewThumbnails_ = |
| 557 this.dialogDom_.querySelector('.preview-thumbnails'); | 566 this.dialogDom_.querySelector('.preview-thumbnails'); |
| 558 this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel'); | 567 this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel'); |
| 559 this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename'); | 568 this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename'); |
| 560 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); | 569 this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); |
| 561 this.previewMetadata_ = this.dialogDom_.querySelector('.preview-metadata'); | 570 this.previewMetadata_ = this.dialogDom_.querySelector('.preview-metadata'); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 /** | 664 /** |
| 656 * Get the icon type for a given Entry. | 665 * Get the icon type for a given Entry. |
| 657 * | 666 * |
| 658 * @param {Entry} entry An Entry subclass (FileEntry or DirectoryEntry). | 667 * @param {Entry} entry An Entry subclass (FileEntry or DirectoryEntry). |
| 659 * @return {string} | 668 * @return {string} |
| 660 */ | 669 */ |
| 661 FileManager.prototype.getIconType = function(entry) { | 670 FileManager.prototype.getIconType = function(entry) { |
| 662 if (!('cachedIconType_' in entry)) | 671 if (!('cachedIconType_' in entry)) |
| 663 entry.cachedIconType_ = this.computeIconType_(entry); | 672 entry.cachedIconType_ = this.computeIconType_(entry); |
| 664 return entry.cachedIconType_; | 673 return entry.cachedIconType_; |
| 665 } | 674 }; |
| 666 | 675 |
| 667 /** | 676 /** |
| 668 * Extract extension from the file name and cat it to to lower case. | 677 * Extract extension from the file name and cat it to to lower case. |
| 669 * | 678 * |
| 670 * @param {string} name. | 679 * @param {string} name. |
| 671 * @return {strin} | 680 * @return {strin} |
| 672 */ | 681 */ |
| 673 function getFileExtension(name) { | 682 function getFileExtension(name) { |
| 674 var extIndex = name.lastIndexOf('.'); | 683 var extIndex = name.lastIndexOf('.'); |
| 675 if (extIndex < 0) | 684 if (extIndex < 0) |
| (...skipping 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3575 | 3584 |
| 3576 if (msg) { | 3585 if (msg) { |
| 3577 console.log('no no no'); | 3586 console.log('no no no'); |
| 3578 this.alert.show(msg, onAccept); | 3587 this.alert.show(msg, onAccept); |
| 3579 return false; | 3588 return false; |
| 3580 } | 3589 } |
| 3581 | 3590 |
| 3582 return true; | 3591 return true; |
| 3583 }; | 3592 }; |
| 3584 })(); | 3593 })(); |
| OLD | NEW |