updateNotificationCount_(contents) {
    // Count removed items.
    const removed = this.contents_.filter((item) => {
      const isRemoved = contents.indexOf(item) === -1;
      if (isRemoved) {
        const addIdx = this.cachedAddedContent_.indexOf(item);
        if (addIdx !== -1) {
          // Ignore item removed after it was added.
          this.cachedAddedContent_.splice(addIdx, 1);
          return false;
        }
        return true;
      }
      return false;
    });
    // Count added items.
    const added = contents.filter((item) => {
      const isAdded = this.contents_.indexOf(item) === -1;
      if (isAdded) {
        const rmIdx = this.cachedRemovedContent_.indexOf(item);
        if (rmIdx !== -1) {
          // Ignore item added after it was removed.
          this.cachedRemovedContent_.splice(rmIdx, 1);
          return false;
        }
        return true;
      }
      return false;
    });
    this.cachedRemovedContent_.push(...removed);
    this.cachedAddedContent_.push(...added);
    this.notificationCount_ =
      this.cachedRemovedContent_.length + this.cachedAddedContent_.length;
  }
Updates the notification count based on the cached and new contents.
@param {!Array<string>} contents The new backpack contents.
@private