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

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

Issue 13867005: Recent and Search in Bookmark manager don't allow Open operations. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 /** @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
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) ?
arv (Not doing code reviews) 2013/04/15 20:45:40 Useless parens
320 return listItems.length ? listItems : list.dataModel.slice(); 320 list.dataModel.slice() : tree.selectedFolders;
321 }
322 var items = list.selectedItems;
323 return items.length ? items : list.dataModel.slice();
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
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 })();
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