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

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

Issue 134073005: Revert "Rate limit tree selection change side effects" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | « chrome/browser/resources/bookmark_manager/js/bmm/bookmark_tree.js ('k') | 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 /** @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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 chrome.bookmarkManagerPrivate.canEdit(function(result) { 661 chrome.bookmarkManagerPrivate.canEdit(function(result) {
662 if (result != canEdit) { 662 if (result != canEdit) {
663 canEdit = result; 663 canEdit = result;
664 editingCommands.forEach(function(baseId) { 664 editingCommands.forEach(function(baseId) {
665 $(baseId + '-command').canExecuteChange(); 665 $(baseId + '-command').canExecuteChange();
666 }); 666 });
667 } 667 }
668 }); 668 });
669 } 669 }
670 670
671 function rateLimit(func, ms) { 671 function handleChangeForTree(e) {
672 if (func.rateLimitId_) {
673 clearTimeout(func.rateLimitId_);
674 delete func.rateLimitId_;
675 }
676 func.rateLimitId_ = setTimeout(func, ms);
677 }
678
679 function handleChangeForTree() {
680 // This should be rate limited based on the keyboard repeat rate.
681 rateLimit(handleChangeForTreeHelper, 50);
682 }
683
684 function handleChangeForTreeHelper() {
685 updateAllCommands(); 672 updateAllCommands();
686 navigateTo(tree.selectedItem.bookmarkId, updateHash); 673 navigateTo(tree.selectedItem.bookmarkId, updateHash);
687 } 674 }
688 675
689 function handleOrganizeButtonClick(e) { 676 function handleOrganizeButtonClick(e) {
690 updateEditingCommands(); 677 updateEditingCommands();
691 $('add-new-bookmark-command').canExecuteChange(); 678 $('add-new-bookmark-command').canExecuteChange();
692 $('new-folder-command').canExecuteChange(); 679 $('new-folder-command').canExecuteChange();
693 $('sort-command').canExecuteChange(); 680 $('sort-command').canExecuteChange();
694 } 681 }
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 1358
1372 cr.ui.FocusOutlineManager.forDocument(document); 1359 cr.ui.FocusOutlineManager.forDocument(document);
1373 initializeSplitter(); 1360 initializeSplitter();
1374 bmm.addBookmarkModelListeners(); 1361 bmm.addBookmarkModelListeners();
1375 dnd.init(selectItemsAfterUserAction); 1362 dnd.init(selectItemsAfterUserAction);
1376 tree.reload(); 1363 tree.reload();
1377 } 1364 }
1378 1365
1379 initializeBookmarkManager(); 1366 initializeBookmarkManager();
1380 })(); 1367 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/bookmark_manager/js/bmm/bookmark_tree.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698