| 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 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** @const */ var BookmarkList = bmm.BookmarkList; | 8 /** @const */ var BookmarkList = bmm.BookmarkList; |
| 9 /** @const */ var BookmarkTree = bmm.BookmarkTree; | 9 /** @const */ var BookmarkTree = bmm.BookmarkTree; |
| 10 /** @const */ var Command = cr.ui.Command; | 10 /** @const */ var Command = cr.ui.Command; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 * @param {Function=} opt_f Function to call after the state has been updated. | 428 * @param {Function=} opt_f Function to call after the state has been updated. |
| 429 */ | 429 */ |
| 430 function updatePasteCommand(opt_f) { | 430 function updatePasteCommand(opt_f) { |
| 431 function update(commandId, canPaste) { | 431 function update(commandId, canPaste) { |
| 432 $(commandId).disabled = !canPaste; | 432 $(commandId).disabled = !canPaste; |
| 433 } | 433 } |
| 434 | 434 |
| 435 var promises = []; | 435 var promises = []; |
| 436 | 436 |
| 437 // The folders menu. | 437 // The folders menu. |
| 438 if (bmm.tree.selectedItem) { | 438 // We can not paste into search item in tree. |
| 439 if (bmm.tree.selectedItem && bmm.tree.selectedItem != searchTreeItem) { |
| 439 promises.push(new Promise(function(resolve) { | 440 promises.push(new Promise(function(resolve) { |
| 440 var id = bmm.tree.selectedItem.bookmarkId; | 441 var id = bmm.tree.selectedItem.bookmarkId; |
| 441 chrome.bookmarkManagerPrivate.canPaste(id, function(canPaste) { | 442 chrome.bookmarkManagerPrivate.canPaste(id, function(canPaste) { |
| 442 update('paste-from-folders-menu-command', canPaste); | 443 update('paste-from-folders-menu-command', canPaste); |
| 443 resolve(canPaste); | 444 resolve(canPaste); |
| 444 }); | 445 }); |
| 445 })); | 446 })); |
| 446 } else { | 447 } else { |
| 447 // Tree's not loaded yet. | 448 // Tree's not loaded yet. |
| 448 update('paste-from-folders-menu-command', false); | 449 update('paste-from-folders-menu-command', false); |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 | 1522 |
| 1522 cr.ui.FocusOutlineManager.forDocument(document); | 1523 cr.ui.FocusOutlineManager.forDocument(document); |
| 1523 initializeSplitter(); | 1524 initializeSplitter(); |
| 1524 bmm.addBookmarkModelListeners(); | 1525 bmm.addBookmarkModelListeners(); |
| 1525 dnd.init(selectItemsAfterUserAction); | 1526 dnd.init(selectItemsAfterUserAction); |
| 1526 bmm.tree.reload(); | 1527 bmm.tree.reload(); |
| 1527 } | 1528 } |
| 1528 | 1529 |
| 1529 initializeBookmarkManager(); | 1530 initializeBookmarkManager(); |
| 1530 })(); | 1531 })(); |
| OLD | NEW |