decorateOnlineOrOEMWallpaper_(imageElement, dataItem) {
      if (dataItem.source != Constants.WallpaperSourceEnum.Online &&
          dataItem.source != Constants.WallpaperSourceEnum.OEM) {
        console.error(
            '|decorateOnlineOrOEMWallpaper_| is called but the wallpaper ' +
            'source is not online or OEM.');
        return;
      }
      chrome.wallpaperPrivate
          .getThumbnail(
              dataItem.baseURL, dataItem.source, data => {
                if (data) {
                  WallpaperUtil.displayImage(
                      imageElement, data,
                      this.callback_.bind(
                          this, this.dataModelId_, dataItem.wallpaperId,
                          imageElement));
                } else if (
                    dataItem.source == Constants.WallpaperSourceEnum.Online) {
                  var xhr = new XMLHttpRequest();
                  xhr.open(
                      'GET',
                      dataItem.baseURL +
                          WallpaperUtil.getOnlineWallpaperThumbnailSuffix(),
                      true);
                  xhr.responseType = 'arraybuffer';
                  xhr.send(null);
                  xhr.addEventListener('load', e => {
                    if (xhr.status === 200) {
                      chrome.wallpaperPrivate.saveThumbnail(
                          dataItem.baseURL, xhr.response);
                      WallpaperUtil.displayImage(
                          imageElement, xhr.response,
                          this.callback_.bind(
                              this, this.dataModelId_, dataItem.wallpaperId,
                              imageElement));
                    } else {
                      this.callback_(this.dataModelId_);
                    }
                  });
                }
              });
    }
/**
     * Initializes the grid item for online or OEM wallpapers.
     * @param {Object} imageElement The image element.
     * @param {{filePath: string, baseURL: string, layout: string,
     *          source: string, availableOffline: boolean}
     *     dataItem The info related to the wallpaper image.
     * @private
     */
Initializes the grid item for online or OEM wallpapers.
@param {Object} imageElement The image element.
Initializes the grid item for online or OEM wallpapers . @param { Object } imageElement The image element .
decorateOnlineOrOEMWallpaper_(imageElement, dataItem) {
      if (dataItem.source != Constants.WallpaperSourceEnum.Online &&
          dataItem.source != Constants.WallpaperSourceEnum.OEM) {
        console.error(
            '|decorateOnlineOrOEMWallpaper_| is called but the wallpaper ' +
            'source is not online or OEM.');
        return;
      }
      chrome.wallpaperPrivate
          .getThumbnail(
              dataItem.baseURL, dataItem.source, data => {
                if (data) {
                  WallpaperUtil.displayImage(
                      imageElement, data,
                      this.callback_.bind(
                          this, this.dataModelId_, dataItem.wallpaperId,
                          imageElement));
                } else if (
                    dataItem.source == Constants.WallpaperSourceEnum.Online) {
                  var xhr = new XMLHttpRequest();
                  xhr.open(
                      'GET',
                      dataItem.baseURL +
                          WallpaperUtil.getOnlineWallpaperThumbnailSuffix(),
                      true);
                  xhr.responseType = 'arraybuffer';
                  xhr.send(null);
                  xhr.addEventListener('load', e => {
                    if (xhr.status === 200) {
                      chrome.wallpaperPrivate.saveThumbnail(
                          dataItem.baseURL, xhr.response);
                      WallpaperUtil.displayImage(
                          imageElement, xhr.response,
                          this.callback_.bind(
                              this, this.dataModelId_, dataItem.wallpaperId,
                              imageElement));
                    } else {
                      this.callback_(this.dataModelId_);
                    }
                  });
                }
              });
    }
decorateOnlineOrOEMWallpaper_ ( imageElement , dataItem ) { if ( dataItem . source != Constants . WallpaperSourceEnum . Online && dataItem . source != Constants . WallpaperSourceEnum . OEM ) { console . error ( '|decorateOnlineOrOEMWallpaper_| is called but the wallpaper ' + 'source is not online or OEM.' ) ; return ; } chrome . wallpaperPrivate . getThumbnail ( dataItem . baseURL , dataItem . source , data => { if ( data ) { WallpaperUtil . displayImage ( imageElement , data , this . callback_ . bind ( this , this . dataModelId_ , dataItem . wallpaperId , imageElement ) ) ; } else if ( dataItem . source == Constants . WallpaperSourceEnum . Online ) { var xhr = new XMLHttpRequest ( ) ; xhr . open ( 'GET' , dataItem . baseURL + WallpaperUtil . getOnlineWallpaperThumbnailSuffix ( ) , true ) ; xhr . responseType = 'arraybuffer' ; xhr . send ( null ) ; xhr . addEventListener ( 'load' , e => { if ( xhr . status === 200 ) { chrome . wallpaperPrivate . saveThumbnail ( dataItem . baseURL , xhr . response ) ; WallpaperUtil . displayImage ( imageElement , xhr . response , this . callback_ . bind ( this , this . dataModelId_ , dataItem . wallpaperId , imageElement ) ) ; } else { this . callback_ ( this . dataModelId_ ) ; } } ) ; } } ) ; }
Initializes the grid item for online or OEM wallpapers.
Initializes the grid item for online or OEM wallpapers .