Commit 429d31c5 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[directory tree] Make AndroidAppItem derive from TreeItem

TreeItem handles the item content creation, label, tree parent_ etc so
remove local AndfroidAppItem code related to that.

Bug: 992819
Change-Id: Idc618323fdfae016c2e8788f3d54148ae33f38b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1868352
Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707264}
parent 71b3152a
......@@ -1656,38 +1656,30 @@ class ShortcutItem extends cr.ui.TreeItem {
* A TreeItem representing an Android picker app. These Android app items are
* shown as top-level volume entries of the DirectoryTree.
*/
class AndroidAppItem extends cr.ui.TreeItem {
class AndroidAppItem extends TreeItem {
/**
* @param {!NavigationModelAndroidAppItem} modelItem NavigationModelItem
* associated with this volume.
* @param {!DirectoryTree} tree Directory tree.
*/
constructor(modelItem, tree) {
super();
// Get the original label id defined by TreeItem, before overwriting
// prototype.
const labelId = this.labelElement.id;
super(modelItem.androidApp.name, tree);
this.__proto__ = AndroidAppItem.prototype;
/** @private {!DirectoryTree} */
this.parentTree_ = tree;
if (window.IN_TEST) {
this.setAttribute('dir-type', 'AndroidAppItem');
}
/** @private {!NavigationModelAndroidAppItem} */
this.modelItem_ = modelItem;
this.innerHTML = TREE_ITEM_INNER_HTML;
this.labelElement.id = labelId;
/** @public {string} */
this.label = modelItem.androidApp.name;
const icon = this.querySelector('.icon');
icon.classList.add('item-icon');
const appIcon = this.querySelector('.icon');
appIcon.classList.add('item-icon');
if (modelItem.androidApp.iconSet) {
const backgroundImage =
util.iconSetToCSSBackgroundImageValue(modelItem.androidApp.iconSet);
if (backgroundImage !== 'none') {
appIcon.setAttribute('style', 'background-image: ' + backgroundImage);
icon.setAttribute('style', 'background-image: ' + backgroundImage);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment