Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: chrome/browser/resources/bookmark_manager/main.html

Issue 6801017: Changes 'Open all' bookmarks to not recurse through nested folders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update hasBookmarks Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 for (var i = 0; i < node.children.length; ++i) {
arv (Not doing code reviews) 2011/04/06 21:34:24 i++ in js
1075 while (it.moveNext()) { 1075 if (!bmm.isFolder(node.children[i]))
1076 if (!bmm.isFolder(it.current))
1077 return true; 1076 return true;
1078 } 1077 }
1079 return false; 1078 return false;
1080 } 1079 }
1081 1080
1082 switch (command.id) { 1081 switch (command.id) {
1083 case 'open-in-new-tab-command': 1082 case 'open-in-new-tab-command':
1084 command.label = localStrings.getString(multiple ? 1083 command.label = localStrings.getString(multiple ?
1085 'open_all' : 'open_in_new_tab'); 1084 'open_all' : 'open_in_new_tab');
1086 break; 1085 break;
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 * Opens the selected bookmarks. 1440 * Opens the selected bookmarks.
1442 * @param {LinkKind} kind The kind of link we want to open. 1441 * @param {LinkKind} kind The kind of link we want to open.
1443 */ 1442 */
1444 function openBookmarks(kind) { 1443 function openBookmarks(kind) {
1445 // If we have selected any folders we need to find all items recursively. 1444 // 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 1445 // 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. 1446 // tree since we would like to minimize the amount of data sent.
1448 1447
1449 var urls = []; 1448 var urls = [];
1450 1449
1451 // Adds the node and all the descendants 1450 // Adds the node and all its children.
1452 function addNodes(node) { 1451 function addNodes(node) {
1453 var it = new bmm.TreeIterator(node); 1452 if (node.children) {
1454 while (it.moveNext()) { 1453 node.children.forEach(function(child) {
1455 var n = it.current; 1454 if (!bmm.isFolder(child))
1456 if (!bmm.isFolder(n)) 1455 urls.push(child.url);
1457 urls.push(n.url); 1456 });
1457 } else {
1458 urls.push(node.url);
1458 } 1459 }
1459 } 1460 }
1460 1461
1461 var nodes = getSelectedBookmarkNodes(); 1462 var nodes = getSelectedBookmarkNodes();
1462 1463
1463 // Get a future promise for every selected item. 1464 // Get a future promise for every selected item.
1464 var promises = nodes.map(function(node) { 1465 var promises = nodes.map(function(node) {
1465 if (bmm.isFolder(node)) 1466 if (bmm.isFolder(node))
1466 return bmm.loadSubtree(node.id); 1467 return bmm.loadSubtree(node.id);
1467 // Not a folder so we already have all the data we need. 1468 // Not a folder so we already have all the data we need.
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 // Paste is a bit special since we need to do an async call to see if we can 1726 // 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. 1727 // paste because the paste command might not be up to date.
1727 updatePasteCommand(pasteHandler); 1728 updatePasteCommand(pasteHandler);
1728 }); 1729 });
1729 })(); 1730 })();
1730 1731
1731 </script> 1732 </script>
1732 1733
1733 </body> 1734 </body>
1734 </html> 1735 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698