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 (function() { | 5 (function() { |
6 /** @const */ var BookmarkList = bmm.BookmarkList; | 6 /** @const */ var BookmarkList = bmm.BookmarkList; |
7 /** @const */ var BookmarkTree = bmm.BookmarkTree; | 7 /** @const */ var BookmarkTree = bmm.BookmarkTree; |
8 /** @const */ var Command = cr.ui.Command; | 8 /** @const */ var Command = cr.ui.Command; |
9 /** @const */ var CommandBinding = cr.ui.CommandBinding; | 9 /** @const */ var CommandBinding = cr.ui.CommandBinding; |
10 /** @const */ var LinkKind = cr.LinkKind; | 10 /** @const */ var LinkKind = cr.LinkKind; |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 processHash(); | 307 processHash(); |
308 } | 308 } |
309 | 309 |
310 /** | 310 /** |
311 * Returns the bookmark nodes that should be opened through the open context | 311 * Returns the bookmark nodes that should be opened through the open context |
312 * menu commands. | 312 * menu commands. |
313 * @param {HTMLElement} target The target list or tree. | 313 * @param {HTMLElement} target The target list or tree. |
314 * @return {!Array.<!BookmarkTreeNode>} . | 314 * @return {!Array.<!BookmarkTreeNode>} . |
315 */ | 315 */ |
316 function getBookmarkNodesForOpenCommands(target) { | 316 function getBookmarkNodesForOpenCommands(target) { |
317 if (target == tree) | 317 if (target == tree) { |
318 return tree.selectedFolders; | 318 var folderItem = tree.selectedItem; |
319 var listItems = list.selectedItems; | 319 return (folderItem == recentTreeItem || folderItem == searchTreeItem) ? |
320 return listItems.length ? listItems : list.dataModel.slice(); | 320 list.dataModel.slice() : tree.selectedFolders; |
321 } | |
322 var items = list.selectedItems; | |
323 return items.length == 0 ? list.dataModel.slice() : items; | |
yosin_UTC9
2013/04/15 01:28:26
nit: return items.length ? items : list.dataModel.
Tom Cassiotis
2013/04/15 01:40:33
Done.
| |
321 } | 324 } |
322 | 325 |
323 /** | 326 /** |
324 * Helper function that updates the canExecute and labels for the open-like | 327 * Helper function that updates the canExecute and labels for the open-like |
325 * commands. | 328 * commands. |
326 * @param {!cr.ui.CanExecuteEvent} e The event fired by the command system. | 329 * @param {!cr.ui.CanExecuteEvent} e The event fired by the command system. |
327 * @param {!cr.ui.Command} command The command we are currently processing. | 330 * @param {!cr.ui.Command} command The command we are currently processing. |
328 */ | 331 */ |
329 function updateOpenCommands(e, command) { | 332 function updateOpenCommands(e, command) { |
330 var selectedItems = getBookmarkNodesForOpenCommands(e.target); | 333 var selectedItems = getBookmarkNodesForOpenCommands(e.target); |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1277 }); | 1280 }); |
1278 | 1281 |
1279 initializeSplitter(); | 1282 initializeSplitter(); |
1280 bmm.addBookmarkModelListeners(); | 1283 bmm.addBookmarkModelListeners(); |
1281 dnd.init(selectItemsAfterUserAction); | 1284 dnd.init(selectItemsAfterUserAction); |
1282 tree.reload(); | 1285 tree.reload(); |
1283 } | 1286 } |
1284 | 1287 |
1285 initializeBookmarkManager(); | 1288 initializeBookmarkManager(); |
1286 })(); | 1289 })(); |
OLD | NEW |