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 // TODO(rginda): Remove this and related code after zel's file scheme fix lands. | 5 // TODO(rginda): Remove this and related code after zel's file scheme fix lands. |
6 const ENABLE_EXIF_READER = false; | 6 const ENABLE_EXIF_READER = false; |
7 | 7 |
8 // TODO(rginda): Remove this when the thumbnail view is less janky. | 8 // TODO(rginda): Remove this when the thumbnail view is less janky. |
9 const ENABLE_THUMBNAIL_VIEW = false; | 9 const ENABLE_THUMBNAIL_VIEW = false; |
10 | 10 |
11 var g_slideshow_data = null; | |
12 | |
11 /** | 13 /** |
12 * FileManager constructor. | 14 * FileManager constructor. |
13 * | 15 * |
14 * FileManager objects encapsulate the functionality of the file selector | 16 * FileManager objects encapsulate the functionality of the file selector |
15 * dialogs, as well as the full screen file manager application (though the | 17 * dialogs, as well as the full screen file manager application (though the |
16 * latter is not yet implemented). | 18 * latter is not yet implemented). |
17 * | 19 * |
18 * @param {HTMLElement} dialogDom The DOM node containing the prototypical | 20 * @param {HTMLElement} dialogDom The DOM node containing the prototypical |
19 * dialog UI. | 21 * dialog UI. |
20 * @param {DOMFileSystem} filesystem The HTML5 filesystem object representing | 22 * @param {DOMFileSystem} filesystem The HTML5 filesystem object representing |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
966 var img = this.document_.createElement('img'); | 968 var img = this.document_.createElement('img'); |
967 img.src = task.iconUrl; | 969 img.src = task.iconUrl; |
968 | 970 |
969 button.appendChild(img); | 971 button.appendChild(img); |
970 button.appendChild(this.document_.createTextNode(task.title)); | 972 button.appendChild(this.document_.createTextNode(task.title)); |
971 | 973 |
972 this.taskButtons_.appendChild(button); | 974 this.taskButtons_.appendChild(button); |
973 } | 975 } |
974 }; | 976 }; |
975 | 977 |
978 FileManager.prototype.getExtensionId_ = function() { | |
979 return chrome.extension.getURL('').split('/')[2]; | |
980 }; | |
981 | |
976 FileManager.prototype.onTaskButtonClicked_ = function(event) { | 982 FileManager.prototype.onTaskButtonClicked_ = function(event) { |
983 // TODO(serya): This API assumes having a background page. | |
984 // Adding it crushes a few of browser tests (they wonder | |
zel
2011/04/23 07:42:46
typo: "crashes"
also, the tests are not angry any
serya%chromium.org
2011/04/23 08:34:13
Done.
| |
985 // to see a new renderer process in a fresh profile). | |
986 if (event.srcElement.task.taskId == this.getExtensionId_() + '|preview') { | |
987 g_slideshow_data = this.selection.urls; | |
988 alert("create tab"); | |
989 chrome.tabs.create({url: "slideshow.html"}); | |
990 return; | |
991 } | |
977 chrome.fileBrowserPrivate.executeTask(event.srcElement.task.taskId, | 992 chrome.fileBrowserPrivate.executeTask(event.srcElement.task.taskId, |
978 this.selection.urls); | 993 this.selection.urls); |
979 } | 994 } |
980 | 995 |
981 /** | 996 /** |
982 * Update the breadcrumb display to reflect the current directory. | 997 * Update the breadcrumb display to reflect the current directory. |
983 */ | 998 */ |
984 FileManager.prototype.updateBreadcrumbs_ = function() { | 999 FileManager.prototype.updateBreadcrumbs_ = function() { |
985 var bc = this.dialogDom_.querySelector('.breadcrumbs'); | 1000 var bc = this.dialogDom_.querySelector('.breadcrumbs'); |
986 bc.innerHTML = ''; | 1001 bc.innerHTML = ''; |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1518 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { | 1533 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { |
1519 if (!this.selection.leadEntry.isFile) | 1534 if (!this.selection.leadEntry.isFile) |
1520 throw new Error('Selected entry is not a file!'); | 1535 throw new Error('Selected entry is not a file!'); |
1521 } | 1536 } |
1522 | 1537 |
1523 chrome.fileBrowserPrivate.selectFile(ary[0], 0); | 1538 chrome.fileBrowserPrivate.selectFile(ary[0], 0); |
1524 window.close(); | 1539 window.close(); |
1525 }; | 1540 }; |
1526 | 1541 |
1527 })(); | 1542 })(); |
OLD | NEW |