decorateCustomWallpaper_(imageElement, dataItem) {
      if (dataItem.source != Constants.WallpaperSourceEnum.Custom) {
        console.error(
            '|decorateCustomWallpaper_| is called but the wallpaper source ' +
            'is not custom.');
        return;
      }
      // Read the image data from |filePath|.
      chrome.wallpaperPrivate.getLocalImageData(
          dataItem.filePath, imageData => {
            if (chrome.runtime.lastError || !imageData) {
              // TODO(crbug.com/810892): Decide the UI: either hide the grid or
              // show an error icon.
              console.error(
                  'Initialization of custom wallpaper grid failed for path ' +
                  dataItem.filePath);
              this.callback_(
                  this.dataModelId_, null /*opt_wallpaperId=*/, imageElement);
              return;
            }

            // |opt_wallpaperId| is used as the key to cache the image data, but
            // we do not want to cache local image data since it may change
            // frequently.
            WallpaperUtil.displayImage(
                imageElement, imageData,
                this.callback_.bind(
                    this, this.dataModelId_, null /*opt_wallpaperId=*/,
                    imageElement));
          });
    }
/**
     * Initializes the grid item for custom wallpapers. Used by the new
     * wallpaper picker.
     * @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 custom wallpapers. Used by the new
wallpaper picker.
@param {Object} imageElement The image element.
Initializes the grid item for custom wallpapers . Used by the new wallpaper picker . @param { Object } imageElement The image element .
decorateCustomWallpaper_(imageElement, dataItem) {
      if (dataItem.source != Constants.WallpaperSourceEnum.Custom) {
        console.error(
            '|decorateCustomWallpaper_| is called but the wallpaper source ' +
            'is not custom.');
        return;
      }
      chrome.wallpaperPrivate.getLocalImageData(
          dataItem.filePath, imageData => {
            if (chrome.runtime.lastError || !imageData) {
              console.error(
                  'Initialization of custom wallpaper grid failed for path ' +
                  dataItem.filePath);
              this.callback_(
                  this.dataModelId_, null , imageElement);
              return;
            }
            WallpaperUtil.displayImage(
                imageElement, imageData,
                this.callback_.bind(
                    this, this.dataModelId_, null ,
                    imageElement));
          });
    }
decorateCustomWallpaper_ ( imageElement , dataItem ) { if ( dataItem . source != Constants . WallpaperSourceEnum . Custom ) { console . error ( '|decorateCustomWallpaper_| is called but the wallpaper source ' + 'is not custom.' ) ; return ; } chrome . wallpaperPrivate . getLocalImageData ( dataItem . filePath , imageData => { if ( chrome . runtime . lastError || ! imageData ) { console . error ( 'Initialization of custom wallpaper grid failed for path ' + dataItem . filePath ) ; this . callback_ ( this . dataModelId_ , null , imageElement ) ; return ; } WallpaperUtil . displayImage ( imageElement , imageData , this . callback_ . bind ( this , this . dataModelId_ , null , imageElement ) ) ; } ) ; }
Initializes the grid item for custom wallpapers.
Initializes the grid item for custom wallpapers .
// Read the image data from |filePath|. // TODO(crbug.com/810892): Decide the UI: either hide the grid or // show an error icon. /*opt_wallpaperId=*/ // |opt_wallpaperId| is used as the key to cache the image data, but // we do not want to cache local image data since it may change // frequently. /*opt_wallpaperId=*/