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 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 * | 1649 * |
1651 * @param {cr.Event} event The directory-changed event. | 1650 * @param {cr.Event} event The directory-changed event. |
1652 */ | 1651 */ |
1653 FileManager.prototype.onDirectoryChanged_ = function(event) { | 1652 FileManager.prototype.onDirectoryChanged_ = function(event) { |
1654 if (event.saveHistory) { | 1653 if (event.saveHistory) { |
1655 history.pushState(this.currentDirEntry_.fullPath, | 1654 history.pushState(this.currentDirEntry_.fullPath, |
1656 this.currentDirEntry_.fullPath, | 1655 this.currentDirEntry_.fullPath, |
1657 location.href); | 1656 location.href); |
1658 } | 1657 } |
1659 | 1658 |
| 1659 this.updateOkButton_(); |
1660 // New folder should never be enabled in the root or media/ directories. | 1660 // New folder should never be enabled in the root or media/ directories. |
1661 this.newFolderButton_.disabled = | 1661 this.newFolderButton_.disabled = |
1662 (this.currentDirEntry_.fullPath == '/' || | 1662 (this.currentDirEntry_.fullPath == '/' || |
1663 this.currentDirEntry_.fullPath == MEDIA_DIRECTORY); | 1663 this.currentDirEntry_.fullPath == MEDIA_DIRECTORY); |
1664 | 1664 |
1665 this.document_.title = this.currentDirEntry_.fullPath; | 1665 this.document_.title = this.currentDirEntry_.fullPath; |
1666 this.rescanDirectory_(); | 1666 this.rescanDirectory_(); |
1667 }; | 1667 }; |
1668 | 1668 |
1669 /** | 1669 /** |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { | 2117 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { |
2118 if (!this.selection.leadEntry.isFile) | 2118 if (!this.selection.leadEntry.isFile) |
2119 throw new Error('Selected entry is not a file!'); | 2119 throw new Error('Selected entry is not a file!'); |
2120 } | 2120 } |
2121 | 2121 |
2122 chrome.fileBrowserPrivate.selectFile(ary[0], 0); | 2122 chrome.fileBrowserPrivate.selectFile(ary[0], 0); |
2123 // Window closed by above call. | 2123 // Window closed by above call. |
2124 }; | 2124 }; |
2125 | 2125 |
2126 })(); | 2126 })(); |
OLD | NEW |