fetchPreselectedDestination_(
        origin, id, account, name, capabilities, extensionId, extensionName) {
      this.autoSelectMatchingDestination_ =
          this.createExactDestinationMatch_(origin, id);

      const type = print_preview.originToType(origin);
      if (type == print_preview.PrinterType.LOCAL_PRINTER) {
        this.nativeLayer_.getPrinterCapabilities(id, type).then(
            this.onCapabilitiesSet_.bind(this, origin, id),
            this.onGetCapabilitiesFail_.bind(this, origin, id));
        return true;
      }

      if (this.cloudPrintInterface_ &&
          (origin == print_preview.DestinationOrigin.COOKIES ||
           origin == print_preview.DestinationOrigin.DEVICE)) {
        this.cloudPrintInterface_.printer(id, origin, account);
        return true;
      }

      if (origin == print_preview.DestinationOrigin.PRIVET ||
          origin == print_preview.DestinationOrigin.EXTENSION) {
        // TODO(noamsml): Resolve a specific printer instead of listing all
        // privet or extension printers in this case.
        this.startLoadDestinations(type);

        // Create a fake selectedDestination_ that is not actually in the
        // destination store. When the real destination is created, this
        // destination will be overwritten.
        const params =
            (origin === print_preview.DestinationOrigin.PRIVET) ? {} : {
              description: '',
              extensionId: extensionId,
              extensionName: extensionName,
              provisionalType: print_preview.DestinationProvisionalType.NONE
            };
        this.selectedDestination_ = new print_preview.Destination(
            id, print_preview.DestinationType.LOCAL, origin, name,
            false /*isRecent*/,
            print_preview.DestinationConnectionStatus.ONLINE, params);

        if (capabilities) {
          this.selectedDestination_.capabilities = capabilities;

          cr.dispatchSimpleEvent(
              this,
              DestinationStore.EventType
                  .CACHED_SELECTED_DESTINATION_INFO_READY);
        }
        return true;
      }
      return false;
    }
/**
     * Attempts to fetch capabilities of the destination identified by the
     * provided origin, id and account.
     * @param {print_preview.DestinationOrigin} origin Destination
     *     origin.
     * @param {string} id Destination id.
     * @param {string} account User account destination is registered for.
     * @param {string} name Destination display name.
     * @param {?print_preview.Cdd} capabilities Destination capabilities.
     * @param {string} extensionId Extension ID associated with this
     *     destination.
     * @param {string} extensionName Extension name associated with this
     *     destination.
     * @return {boolean} Whether capabilities fetch was successfully started.
     * @private
     */
Attempts to fetch capabilities of the destination identified by the
provided origin, id and account.
Attempts to fetch capabilities of the destination identified by the provided origin id and account .
fetchPreselectedDestination_(
        origin, id, account, name, capabilities, extensionId, extensionName) {
      this.autoSelectMatchingDestination_ =
          this.createExactDestinationMatch_(origin, id);
      const type = print_preview.originToType(origin);
      if (type == print_preview.PrinterType.LOCAL_PRINTER) {
        this.nativeLayer_.getPrinterCapabilities(id, type).then(
            this.onCapabilitiesSet_.bind(this, origin, id),
            this.onGetCapabilitiesFail_.bind(this, origin, id));
        return true;
      }
      if (this.cloudPrintInterface_ &&
          (origin == print_preview.DestinationOrigin.COOKIES ||
           origin == print_preview.DestinationOrigin.DEVICE)) {
        this.cloudPrintInterface_.printer(id, origin, account);
        return true;
      }
      if (origin == print_preview.DestinationOrigin.PRIVET ||
          origin == print_preview.DestinationOrigin.EXTENSION) {
        this.startLoadDestinations(type);
        const params =
            (origin === print_preview.DestinationOrigin.PRIVET) ? {} : {
              description: '',
              extensionId: extensionId,
              extensionName: extensionName,
              provisionalType: print_preview.DestinationProvisionalType.NONE
            };
        this.selectedDestination_ = new print_preview.Destination(
            id, print_preview.DestinationType.LOCAL, origin, name,
            false ,
            print_preview.DestinationConnectionStatus.ONLINE, params);
        if (capabilities) {
          this.selectedDestination_.capabilities = capabilities;
          cr.dispatchSimpleEvent(
              this,
              DestinationStore.EventType
                  .CACHED_SELECTED_DESTINATION_INFO_READY);
        }
        return true;
      }
      return false;
    }
fetchPreselectedDestination_ ( origin , id , account , name , capabilities , extensionId , extensionName ) { this . autoSelectMatchingDestination_ = this . createExactDestinationMatch_ ( origin , id ) ; const type = print_preview . originToType ( origin ) ; if ( type == print_preview . PrinterType . LOCAL_PRINTER ) { this . nativeLayer_ . getPrinterCapabilities ( id , type ) . then ( this . onCapabilitiesSet_ . bind ( this , origin , id ) , this . onGetCapabilitiesFail_ . bind ( this , origin , id ) ) ; return true ; } if ( this . cloudPrintInterface_ && ( origin == print_preview . DestinationOrigin . COOKIES || origin == print_preview . DestinationOrigin . DEVICE ) ) { this . cloudPrintInterface_ . printer ( id , origin , account ) ; return true ; } if ( origin == print_preview . DestinationOrigin . PRIVET || origin == print_preview . DestinationOrigin . EXTENSION ) { this . startLoadDestinations ( type ) ; const params = ( origin === print_preview . DestinationOrigin . PRIVET ) ? { } : { description : '' , extensionId : extensionId , extensionName : extensionName , provisionalType : print_preview . DestinationProvisionalType . NONE } ; this . selectedDestination_ = new print_preview . Destination ( id , print_preview . DestinationType . LOCAL , origin , name , false , print_preview . DestinationConnectionStatus . ONLINE , params ) ; if ( capabilities ) { this . selectedDestination_ . capabilities = capabilities ; cr . dispatchSimpleEvent ( this , DestinationStore . EventType . CACHED_SELECTED_DESTINATION_INFO_READY ) ; } return true ; } return false ; }
Attempts to fetch capabilities of the destination identified by the
 provided origin, id and account.
Attempts to fetch capabilities of the destination identified by the provided origin id and account .
// TODO(noamsml): Resolve a specific printer instead of listing all // privet or extension printers in this case. // Create a fake selectedDestination_ that is not actually in the // destination store. When the real destination is created, this // destination will be overwritten. /*isRecent*/