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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 // Not available withn incognito is disabled. | 359 // Not available withn incognito is disabled. |
360 commandDisabled = incognitoModeAvailability == 'disabled'; | 360 commandDisabled = incognitoModeAvailability == 'disabled'; |
361 break; | 361 break; |
362 } | 362 } |
363 e.canExecute = selectedItems.length > 0 && !commandDisabled; | 363 e.canExecute = selectedItems.length > 0 && !commandDisabled; |
364 if (isFolder && e.canExecute) { | 364 if (isFolder && e.canExecute) { |
365 // We need to get all the bookmark items in this tree. If the tree does not | 365 // We need to get all the bookmark items in this tree. If the tree does not |
366 // contain any non-folders, we need to disable the command. | 366 // contain any non-folders, we need to disable the command. |
367 var p = bmm.loadSubtree(selectedItems[0].id); | 367 var p = bmm.loadSubtree(selectedItems[0].id); |
368 p.addListener(function(node) { | 368 p.addListener(function(node) { |
| 369 var selectedItems = getBookmarkNodesForOpenCommands(e.target); |
| 370 if (node.id != selectedItems[0].id) |
| 371 return; |
369 command.disabled = !node || !hasBookmarks(node); | 372 command.disabled = !node || !hasBookmarks(node); |
370 }); | 373 }); |
371 } | 374 } |
372 } | 375 } |
373 | 376 |
374 /** | 377 /** |
375 * Calls the backend to figure out if we can paste the clipboard into the active | 378 * Calls the backend to figure out if we can paste the clipboard into the active |
376 * folder. | 379 * folder. |
377 * @param {Function=} opt_f Function to call after the state has been updated. | 380 * @param {Function=} opt_f Function to call after the state has been updated. |
378 */ | 381 */ |
(...skipping 898 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 |