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

Side by Side Diff: chrome/browser/resources/bookmark_manager/js/bmm/bookmark_list.js

Issue 2350473003: Bookmark manager folder icon cleanups for list pane. (Closed)
Patch Set: Created 4 years, 3 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
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 // TODO(arv): Now that this is driven by a data model, implement a data model 5 // TODO(arv): Now that this is driven by a data model, implement a data model
6 // that handles the loading and the events from the bookmark backend. 6 // that handles the loading and the events from the bookmark backend.
7 7
8 /** 8 /**
9 * @typedef {{childIds: Array<string>}} 9 * @typedef {{childIds: Array<string>}}
10 * 10 *
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 /** @override */ 416 /** @override */
417 decorate: function() { 417 decorate: function() {
418 ListItem.prototype.decorate.call(this); 418 ListItem.prototype.decorate.call(this);
419 419
420 var bookmarkNode = this.bookmarkNode; 420 var bookmarkNode = this.bookmarkNode;
421 421
422 this.draggable = true; 422 this.draggable = true;
423 423
424 var labelEl = this.ownerDocument.createElement('div'); 424 var labelEl = this.ownerDocument.createElement('div');
425 labelEl.className = 'label'; 425 labelEl.className = 'label';
426 labelEl.textContent = bookmarkNode.title; 426 var labelImgWrapper = this.ownerDocument.createElement('div');
427 labelImgWrapper.className = 'label-img-wrapper';
428 var labelImg = this.ownerDocument.createElement('div');
429 var labelText = this.ownerDocument.createElement('div');
430 labelText.className = 'label-text';
431 labelText.textContent = bookmarkNode.title;
427 432
428 var urlEl = this.ownerDocument.createElement('div'); 433 var urlEl = this.ownerDocument.createElement('div');
429 urlEl.className = 'url'; 434 urlEl.className = 'url';
430 435
431 if (bmm.isFolder(bookmarkNode)) { 436 if (bmm.isFolder(bookmarkNode)) {
432 this.className = 'folder'; 437 this.className = 'folder';
438 labelImg.style.content =
439 /* TODO(pkasting): Condense folder icon resources together. */
440 <if expr="is_macosx">
Dan Beam 2016/09/21 03:14:23 doing this at compile time is arguably better, but
Peter Kasting 2016/09/21 04:52:35 I didn't know! I'd actually prefer that, since it
441 cr.icon.getImage('chrome://theme/IDR_BOOKMARK_BAR_FOLDER');
442 </if>
443 <if expr="not is_macosx">
444 cr.icon.getImage('chrome://theme/IDR_FOLDER_CLOSED');
445 </if>
433 } else { 446 } else {
434 labelEl.style.backgroundImage = cr.icon.getFavicon(bookmarkNode.url); 447 labelImg.style.content = cr.icon.getFavicon(bookmarkNode.url);
435 labelEl.style.backgroundSize = '16px';
436 urlEl.textContent = bookmarkNode.url; 448 urlEl.textContent = bookmarkNode.url;
437 } 449 }
438 450
451 labelImgWrapper.appendChild(labelImg);
452 labelEl.appendChild(labelImgWrapper);
453 labelEl.appendChild(labelText);
439 this.appendChild(labelEl); 454 this.appendChild(labelEl);
440 this.appendChild(urlEl); 455 this.appendChild(urlEl);
441 456
442 // Initially the ContextMenuButton was added here but it slowed down 457 // Initially the ContextMenuButton was added here but it slowed down
443 // rendering a lot so it is now added using mouseover. 458 // rendering a lot so it is now added using mouseover.
444 }, 459 },
445 460
446 /** 461 /**
447 * The ID of the bookmark folder we are currently showing or loading. 462 * The ID of the bookmark folder we are currently showing or loading.
448 * @type {string} 463 * @type {string}
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 } 643 }
629 } 644 }
630 } 645 }
631 }; 646 };
632 647
633 return { 648 return {
634 BookmarkList: BookmarkList, 649 BookmarkList: BookmarkList,
635 list: /** @type {Element} */(null), // Set when decorated. 650 list: /** @type {Element} */(null), // Set when decorated.
636 }; 651 };
637 }); 652 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698