OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 document.addEventListener('DOMContentLoaded', function() { | 5 document.addEventListener('DOMContentLoaded', function() { |
6 if (document.location.hash) // File path passed after the #. | 6 if (document.location.hash) // File path passed after the #. |
7 Gallery.openStandalone(decodeURI(document.location.hash.substr(1))); | 7 Gallery.openStandalone(decodeURI(document.location.hash.substr(1))); |
8 }); | 8 }); |
9 | 9 |
10 /** | 10 /** |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 var task_parts = task.taskId.split('|'); | 547 var task_parts = task.taskId.split('|'); |
548 return task_parts[0] != internalId; | 548 return task_parts[0] != internalId; |
549 } | 549 } |
550 | 550 |
551 var items = this.menu_.querySelectorAll('.item'); | 551 var items = this.menu_.querySelectorAll('.item'); |
552 for (var i = 0; i != items.length; i++) { | 552 for (var i = 0; i != items.length; i++) { |
553 items[i].parentNode.removeChild(items[i]); | 553 items[i].parentNode.removeChild(items[i]); |
554 } | 554 } |
555 | 555 |
556 var api = Gallery.getFileBrowserPrivate(); | 556 var api = Gallery.getFileBrowserPrivate(); |
557 api.getFileTasks(urls, function(tasks) { | 557 var mimeTypes = []; // TODO(kaznacheev) Collect mime types properly. |
| 558 api.getFileTasks(urls, mimeTypes, function(tasks) { |
558 for (var i = 0; i != tasks.length; i++) { | 559 for (var i = 0; i != tasks.length; i++) { |
559 var task = tasks[i]; | 560 var task = tasks[i]; |
560 if (!isShareAction(task)) continue; | 561 if (!isShareAction(task)) continue; |
561 | 562 |
562 var item = document.createElement('div'); | 563 var item = document.createElement('div'); |
563 item.className = 'item'; | 564 item.className = 'item'; |
564 this.menu_.appendChild(item); | 565 this.menu_.appendChild(item); |
565 | 566 |
566 item.textContent = task.title; | 567 item.textContent = task.title; |
567 item.style.backgroundImage = 'url(' + task.iconUrl + ')'; | 568 item.style.backgroundImage = 'url(' + task.iconUrl + ')'; |
568 item.addEventListener('click', this.actionCallback_.bind(null, | 569 item.addEventListener('click', this.actionCallback_.bind(null, |
569 api.executeTask.bind(api, task.taskId, urls))); | 570 api.executeTask.bind(api, task.taskId, urls))); |
570 } | 571 } |
571 | 572 |
572 if (this.menu_.firstChild) | 573 if (this.menu_.firstChild) |
573 this.button_.removeAttribute('disabled'); | 574 this.button_.removeAttribute('disabled'); |
574 else | 575 else |
575 this.button_.setAttribute('disabled', 'true'); | 576 this.button_.setAttribute('disabled', 'true'); |
576 }.bind(this)); | 577 }.bind(this)); |
577 }; | 578 }; |
OLD | NEW |