convertToDestinationMatch_(serializedDefaultDestinationSelectionRulesStr) {
      let matchRules = null;
      try {
        if (serializedDefaultDestinationSelectionRulesStr) {
          matchRules =
              JSON.parse(serializedDefaultDestinationSelectionRulesStr);
        }
      } catch (e) {
        console.error('Failed to parse defaultDestinationSelectionRules: ' + e);
      }
      if (!matchRules)
        return null;

      const isLocal = !matchRules.kind || matchRules.kind == 'local';
      const isCloud = !matchRules.kind || matchRules.kind == 'cloud';
      if (!isLocal && !isCloud) {
        console.error('Unsupported type: "' + matchRules.kind + '"');
        return null;
      }

      const origins = [];
      if (isLocal) {
        origins.push(print_preview.DestinationOrigin.LOCAL);
        origins.push(print_preview.DestinationOrigin.PRIVET);
        origins.push(print_preview.DestinationOrigin.EXTENSION);
        origins.push(print_preview.DestinationOrigin.CROS);
      }
      if (isCloud) {
        origins.push(print_preview.DestinationOrigin.COOKIES);
        origins.push(print_preview.DestinationOrigin.DEVICE);
      }

      let idRegExp = null;
      try {
        if (matchRules.idPattern) {
          idRegExp = new RegExp(matchRules.idPattern || '.*');
        }
      } catch (e) {
        console.error('Failed to parse regexp for "id": ' + e);
      }

      let displayNameRegExp = null;
      try {
        if (matchRules.namePattern) {
          displayNameRegExp = new RegExp(matchRules.namePattern || '.*');
        }
      } catch (e) {
        console.error('Failed to parse regexp for "name": ' + e);
      }

      return new print_preview.DestinationMatch(
          origins, idRegExp, displayNameRegExp,
          true /*skipVirtualDestinations*/);
    }
/**
     * @param {?string} serializedDefaultDestinationSelectionRulesStr Serialized
     *     default destination selection rules.
     * @return {?print_preview.DestinationMatch} Creates rules matching
     *     previously selected destination.
     * @private
     */
@param {?string} serializedDefaultDestinationSelectionRulesStr Serialized
default destination selection rules.
@return {?print_preview.DestinationMatch} Creates rules matching
previously selected destination.
@private
@param { ?string } serializedDefaultDestinationSelectionRulesStr Serialized default destination selection rules . @return { ?print_preview . DestinationMatch } Creates rules matching previously selected destination . @private
convertToDestinationMatch_(serializedDefaultDestinationSelectionRulesStr) {
      let matchRules = null;
      try {
        if (serializedDefaultDestinationSelectionRulesStr) {
          matchRules =
              JSON.parse(serializedDefaultDestinationSelectionRulesStr);
        }
      } catch (e) {
        console.error('Failed to parse defaultDestinationSelectionRules: ' + e);
      }
      if (!matchRules)
        return null;
      const isLocal = !matchRules.kind || matchRules.kind == 'local';
      const isCloud = !matchRules.kind || matchRules.kind == 'cloud';
      if (!isLocal && !isCloud) {
        console.error('Unsupported type: "' + matchRules.kind + '"');
        return null;
      }
      const origins = [];
      if (isLocal) {
        origins.push(print_preview.DestinationOrigin.LOCAL);
        origins.push(print_preview.DestinationOrigin.PRIVET);
        origins.push(print_preview.DestinationOrigin.EXTENSION);
        origins.push(print_preview.DestinationOrigin.CROS);
      }
      if (isCloud) {
        origins.push(print_preview.DestinationOrigin.COOKIES);
        origins.push(print_preview.DestinationOrigin.DEVICE);
      }
      let idRegExp = null;
      try {
        if (matchRules.idPattern) {
          idRegExp = new RegExp(matchRules.idPattern || '.*');
        }
      } catch (e) {
        console.error('Failed to parse regexp for "id": ' + e);
      }
      let displayNameRegExp = null;
      try {
        if (matchRules.namePattern) {
          displayNameRegExp = new RegExp(matchRules.namePattern || '.*');
        }
      } catch (e) {
        console.error('Failed to parse regexp for "name": ' + e);
      }
      return new print_preview.DestinationMatch(
          origins, idRegExp, displayNameRegExp,
          true );
    }
convertToDestinationMatch_ ( serializedDefaultDestinationSelectionRulesStr ) { let matchRules = null ; try { if ( serializedDefaultDestinationSelectionRulesStr ) { matchRules = JSON . parse ( serializedDefaultDestinationSelectionRulesStr ) ; } } catch ( e ) { console . error ( 'Failed to parse defaultDestinationSelectionRules: ' + e ) ; } if ( ! matchRules ) return null ; const isLocal = ! matchRules . kind || matchRules . kind == 'local' ; const isCloud = ! matchRules . kind || matchRules . kind == 'cloud' ; if ( ! isLocal && ! isCloud ) { console . error ( 'Unsupported type: "' + matchRules . kind + '"' ) ; return null ; } const origins = [ ] ; if ( isLocal ) { origins . push ( print_preview . DestinationOrigin . LOCAL ) ; origins . push ( print_preview . DestinationOrigin . PRIVET ) ; origins . push ( print_preview . DestinationOrigin . EXTENSION ) ; origins . push ( print_preview . DestinationOrigin . CROS ) ; } if ( isCloud ) { origins . push ( print_preview . DestinationOrigin . COOKIES ) ; origins . push ( print_preview . DestinationOrigin . DEVICE ) ; } let idRegExp = null ; try { if ( matchRules . idPattern ) { idRegExp = new RegExp ( matchRules . idPattern || '.*' ) ; } } catch ( e ) { console . error ( 'Failed to parse regexp for "id": ' + e ) ; } let displayNameRegExp = null ; try { if ( matchRules . namePattern ) { displayNameRegExp = new RegExp ( matchRules . namePattern || '.*' ) ; } } catch ( e ) { console . error ( 'Failed to parse regexp for "name": ' + e ) ; } return new print_preview . DestinationMatch ( origins , idRegExp , displayNameRegExp , true ) ; }
@param {?string} serializedDefaultDestinationSelectionRulesStr Serialized
     default destination selection rules.
@param { ?string } serializedDefaultDestinationSelectionRulesStr Serialized default destination selection rules .
/*skipVirtualDestinations*/