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

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

Issue 472933004: Change bookmark manager header to look more like settings/extensions/history. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: shave Created 6 years, 4 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
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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 tree.selectedItem = searchTreeItem; 277 tree.selectedItem = searchTreeItem;
278 } else { 278 } else {
279 // Go "home". 279 // Go "home".
280 tree.selectedItem = tree.items[0]; 280 tree.selectedItem = tree.items[0];
281 id = tree.selectedItem.bookmarkId; 281 id = tree.selectedItem.bookmarkId;
282 } 282 }
283 283
284 navigateTo(id); 284 navigateTo(id);
285 } 285 }
286 286
287 // Handle the logo button UI.
288 // When the user clicks the button we should navigate "home" and focus the list.
289 function handleClickOnLogoButton(e) {
290 setSearch('');
291 $('list').focus();
292 }
293
294 /** 287 /**
295 * This returns the user visible path to the folder where the bookmark is 288 * This returns the user visible path to the folder where the bookmark is
296 * located. 289 * located.
297 * @param {number} parentId The ID of the parent folder. 290 * @param {number} parentId The ID of the parent folder.
298 * @return {string} The path to the the bookmark, 291 * @return {string} The path to the the bookmark,
299 */ 292 */
300 function getFolder(parentId) { 293 function getFolder(parentId) {
301 var parentNode = tree.getBookmarkNodeById(parentId); 294 var parentNode = tree.getBookmarkNodeById(parentId);
302 if (parentNode) { 295 if (parentNode) {
303 var s = parentNode.title; 296 var s = parentNode.title;
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 tree.addEventListener('load', handleLoadForTree); 1314 tree.addEventListener('load', handleLoadForTree);
1322 1315
1323 cr.ui.contextMenuHandler.addContextMenuProperty(tree); 1316 cr.ui.contextMenuHandler.addContextMenuProperty(tree);
1324 list.contextMenu = $('context-menu'); 1317 list.contextMenu = $('context-menu');
1325 tree.contextMenu = $('context-menu'); 1318 tree.contextMenu = $('context-menu');
1326 1319
1327 // We listen to hashchange so that we can update the currently shown folder 1320 // We listen to hashchange so that we can update the currently shown folder
1328 // when // the user goes back and forward in the history. 1321 // when // the user goes back and forward in the history.
1329 window.addEventListener('hashchange', processHash); 1322 window.addEventListener('hashchange', processHash);
1330 1323
1331 document.querySelector('.header form').onsubmit = function(e) { 1324 document.querySelector('header form').onsubmit = function(e) {
1332 setSearch($('term').value); 1325 setSearch($('term').value);
1333 e.preventDefault(); 1326 e.preventDefault();
1334 }; 1327 };
1335 1328
1336 $('term').addEventListener('search', handleSearch); 1329 $('term').addEventListener('search', handleSearch);
1337 1330
1338 document.querySelector('.summary > button').addEventListener( 1331 document.querySelector('.summary > button').addEventListener(
1339 'click', handleOrganizeButtonClick); 1332 'click', handleOrganizeButtonClick);
1340 1333
1341 document.querySelector('button.logo').addEventListener(
1342 'click', handleClickOnLogoButton);
1343
1344 document.addEventListener('canExecute', handleCanExecuteForDocument); 1334 document.addEventListener('canExecute', handleCanExecuteForDocument);
1345 document.addEventListener('command', handleCommand); 1335 document.addEventListener('command', handleCommand);
1346 1336
1347 // Listen to copy, cut and paste events and execute the associated commands. 1337 // Listen to copy, cut and paste events and execute the associated commands.
1348 installEventHandlerForCommand('copy', 'copy-command'); 1338 installEventHandlerForCommand('copy', 'copy-command');
1349 installEventHandlerForCommand('cut', 'cut-command'); 1339 installEventHandlerForCommand('cut', 'cut-command');
1350 installEventHandlerForCommand('paste', 'paste-from-organize-menu-command'); 1340 installEventHandlerForCommand('paste', 'paste-from-organize-menu-command');
1351 1341
1352 // Install shortcuts 1342 // Install shortcuts
1353 for (var name in commandShortcutMap) { 1343 for (var name in commandShortcutMap) {
(...skipping 25 matching lines...) Expand all
1379 1369
1380 cr.ui.FocusOutlineManager.forDocument(document); 1370 cr.ui.FocusOutlineManager.forDocument(document);
1381 initializeSplitter(); 1371 initializeSplitter();
1382 bmm.addBookmarkModelListeners(); 1372 bmm.addBookmarkModelListeners();
1383 dnd.init(selectItemsAfterUserAction); 1373 dnd.init(selectItemsAfterUserAction);
1384 tree.reload(); 1374 tree.reload();
1385 } 1375 }
1386 1376
1387 initializeBookmarkManager(); 1377 initializeBookmarkManager();
1388 })(); 1378 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/bookmark_manager/css/bmm.css ('k') | chrome/browser/resources/bookmark_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698