Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html i18n-values="dir:textdirection"> | 2 <html i18n-values="dir:textdirection"> |
| 3 <!-- | 3 <!-- |
| 4 | 4 |
| 5 Copyright (c) 2010 The Chromium Authors. All rights reserved. | 5 Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
| 7 found in the LICENSE file. | 7 found in the LICENSE file. |
| 8 | 8 |
| 9 --> | 9 --> |
| 10 <head> | 10 <head> |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1064 } else { | 1064 } else { |
| 1065 selectionCount = e.target.selectedItems.length; | 1065 selectionCount = e.target.selectedItems.length; |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 var isFolder = selectionCount == 1 && | 1068 var isFolder = selectionCount == 1 && |
| 1069 selectedItem && | 1069 selectedItem && |
| 1070 bmm.isFolder(selectedItem); | 1070 bmm.isFolder(selectedItem); |
| 1071 var multiple = selectionCount != 1 || isFolder; | 1071 var multiple = selectionCount != 1 || isFolder; |
| 1072 | 1072 |
| 1073 function hasBookmarks(node) { | 1073 function hasBookmarks(node) { |
| 1074 var it = new bmm.TreeIterator(node); | 1074 var it = new bmm.TreeIterator(node); |
|
arv (Not doing code reviews)
2011/04/06 19:22:38
This one needs to be updated too. Otherwise the en
| |
| 1075 while (it.moveNext()) { | 1075 while (it.moveNext()) { |
| 1076 if (!bmm.isFolder(it.current)) | 1076 if (!bmm.isFolder(it.current)) |
| 1077 return true; | 1077 return true; |
| 1078 } | 1078 } |
| 1079 return false; | 1079 return false; |
| 1080 } | 1080 } |
| 1081 | 1081 |
| 1082 switch (command.id) { | 1082 switch (command.id) { |
| 1083 case 'open-in-new-tab-command': | 1083 case 'open-in-new-tab-command': |
| 1084 command.label = localStrings.getString(multiple ? | 1084 command.label = localStrings.getString(multiple ? |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1441 * Opens the selected bookmarks. | 1441 * Opens the selected bookmarks. |
| 1442 * @param {LinkKind} kind The kind of link we want to open. | 1442 * @param {LinkKind} kind The kind of link we want to open. |
| 1443 */ | 1443 */ |
| 1444 function openBookmarks(kind) { | 1444 function openBookmarks(kind) { |
| 1445 // If we have selected any folders we need to find all items recursively. | 1445 // If we have selected any folders we need to find all items recursively. |
| 1446 // We use multiple async calls to getSubtree instead of getting the whole | 1446 // We use multiple async calls to getSubtree instead of getting the whole |
| 1447 // tree since we would like to minimize the amount of data sent. | 1447 // tree since we would like to minimize the amount of data sent. |
| 1448 | 1448 |
| 1449 var urls = []; | 1449 var urls = []; |
| 1450 | 1450 |
| 1451 // Adds the node and all the descendants | 1451 // Adds the node and all its children. |
| 1452 function addNodes(node) { | 1452 function addNodes(node) { |
| 1453 var it = new bmm.TreeIterator(node); | 1453 if (node.children) { |
| 1454 while (it.moveNext()) { | 1454 node.children.forEach(function(child) { |
| 1455 var n = it.current; | 1455 if (!bmm.isFolder(child)) |
| 1456 if (!bmm.isFolder(n)) | 1456 urls.push(child.url); |
| 1457 urls.push(n.url); | 1457 }); |
| 1458 } else { | |
| 1459 urls.push(node.url); | |
| 1458 } | 1460 } |
| 1459 } | 1461 } |
| 1460 | 1462 |
| 1461 var nodes = getSelectedBookmarkNodes(); | 1463 var nodes = getSelectedBookmarkNodes(); |
| 1462 | 1464 |
| 1463 // Get a future promise for every selected item. | 1465 // Get a future promise for every selected item. |
| 1464 var promises = nodes.map(function(node) { | 1466 var promises = nodes.map(function(node) { |
| 1465 if (bmm.isFolder(node)) | 1467 if (bmm.isFolder(node)) |
| 1466 return bmm.loadSubtree(node.id); | 1468 return bmm.loadSubtree(node.id); |
| 1467 // Not a folder so we already have all the data we need. | 1469 // Not a folder so we already have all the data we need. |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1725 // Paste is a bit special since we need to do an async call to see if we can | 1727 // Paste is a bit special since we need to do an async call to see if we can |
| 1726 // paste because the paste command might not be up to date. | 1728 // paste because the paste command might not be up to date. |
| 1727 updatePasteCommand(pasteHandler); | 1729 updatePasteCommand(pasteHandler); |
| 1728 }); | 1730 }); |
| 1729 })(); | 1731 })(); |
| 1730 | 1732 |
| 1731 </script> | 1733 </script> |
| 1732 | 1734 |
| 1733 </body> | 1735 </body> |
| 1734 </html> | 1736 </html> |
| OLD | NEW |