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

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

Issue 1130143002: Paste can not happen when search item is selected in tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« 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 // 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
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
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 })();
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