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 // WK Bug 55728 is fixed on the chrome 12 branch but not on the trunk. | 5 // WK Bug 55728 is fixed on the chrome 12 branch but not on the trunk. |
6 // TODO(rginda): Enable this everywhere once we have a trunk-worthy fix. | 6 // TODO(rginda): Enable this everywhere once we have a trunk-worthy fix. |
7 const ENABLE_EXIF_READER = navigator.userAgent.match(/chrome\/12\.0/i); | 7 const ENABLE_EXIF_READER = navigator.userAgent.match(/chrome\/12\.0/i); |
8 | 8 |
9 // Thumbnail view is painful without the exif reader. | 9 // Thumbnail view is painful without the exif reader. |
10 const ENABLE_THUMBNAIL_VIEW = ENABLE_EXIF_READER; | 10 const ENABLE_THUMBNAIL_VIEW = ENABLE_EXIF_READER; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 this.addEventListener('directory-changed', | 65 this.addEventListener('directory-changed', |
66 this.onDirectoryChanged_.bind(this)); | 66 this.onDirectoryChanged_.bind(this)); |
67 this.addEventListener('selection-summarized', | 67 this.addEventListener('selection-summarized', |
68 this.onSelectionSummarized_.bind(this)); | 68 this.onSelectionSummarized_.bind(this)); |
69 | 69 |
70 this.initCommands_(); | 70 this.initCommands_(); |
71 this.initDom_(); | 71 this.initDom_(); |
72 this.initDialogType_(); | 72 this.initDialogType_(); |
73 | 73 |
74 this.summarizeSelection_(); | 74 this.summarizeSelection_(); |
75 this.updateOkButton_(); | |
76 this.updatePreview_(); | 75 this.updatePreview_(); |
77 | 76 |
78 chrome.fileBrowserPrivate.onDiskChanged.addListener( | 77 chrome.fileBrowserPrivate.onDiskChanged.addListener( |
79 this.onDiskChanged_.bind(this)); | 78 this.onDiskChanged_.bind(this)); |
80 | 79 |
81 this.table_.list_.focus(); | 80 this.table_.list_.focus(); |
82 | 81 |
83 if (ENABLE_EXIF_READER) { | 82 if (ENABLE_EXIF_READER) { |
84 this.exifReader = new Worker('js/exif_reader.js'); | 83 this.exifReader = new Worker('js/exif_reader.js'); |
85 this.exifReader.onmessage = this.onExifReaderMessage_.bind(this); | 84 this.exifReader.onmessage = this.onExifReaderMessage_.bind(this); |
(...skipping 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 * | 1640 * |
1642 * @param {cr.Event} event The directory-changed event. | 1641 * @param {cr.Event} event The directory-changed event. |
1643 */ | 1642 */ |
1644 FileManager.prototype.onDirectoryChanged_ = function(event) { | 1643 FileManager.prototype.onDirectoryChanged_ = function(event) { |
1645 if (event.saveHistory) { | 1644 if (event.saveHistory) { |
1646 history.pushState(this.currentDirEntry_.fullPath, | 1645 history.pushState(this.currentDirEntry_.fullPath, |
1647 this.currentDirEntry_.fullPath, | 1646 this.currentDirEntry_.fullPath, |
1648 location.href); | 1647 location.href); |
1649 } | 1648 } |
1650 | 1649 |
| 1650 this.updateOkButton_(); |
1651 // New folder should never be enabled in the root or media/ directories. | 1651 // New folder should never be enabled in the root or media/ directories. |
1652 this.newFolderButton_.disabled = | 1652 this.newFolderButton_.disabled = |
1653 (this.currentDirEntry_.fullPath == '/' || | 1653 (this.currentDirEntry_.fullPath == '/' || |
1654 this.currentDirEntry_.fullPath == MEDIA_DIRECTORY); | 1654 this.currentDirEntry_.fullPath == MEDIA_DIRECTORY); |
1655 | 1655 |
1656 this.document_.title = this.currentDirEntry_.fullPath; | 1656 this.document_.title = this.currentDirEntry_.fullPath; |
1657 this.rescanDirectory_(); | 1657 this.rescanDirectory_(); |
1658 }; | 1658 }; |
1659 | 1659 |
1660 /** | 1660 /** |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2110 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { | 2110 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { |
2111 if (!this.selection.leadEntry.isFile) | 2111 if (!this.selection.leadEntry.isFile) |
2112 throw new Error('Selected entry is not a file!'); | 2112 throw new Error('Selected entry is not a file!'); |
2113 } | 2113 } |
2114 | 2114 |
2115 chrome.fileBrowserPrivate.selectFile(ary[0], 0); | 2115 chrome.fileBrowserPrivate.selectFile(ary[0], 0); |
2116 window.close(); | 2116 window.close(); |
2117 }; | 2117 }; |
2118 | 2118 |
2119 })(); | 2119 })(); |
OLD | NEW |