1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59

ash / wallpaper / wallpaper_image_downloader.h [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WALLPAPER_WALLPAPER_IMAGE_DOWNLOADER_H_
#define ASH_WALLPAPER_WALLPAPER_IMAGE_DOWNLOADER_H_

#include <optional>
#include <string>

#include "ash/public/cpp/image_downloader.h"

class AccountId;
class GURL;

namespace ash {

class WallpaperImageDownloader {
 public:
  virtual ~WallpaperImageDownloader() = default;

  virtual void DownloadGooglePhotosImage(
      const GURL& url,
      const AccountId& account_id,
      const std::optional<std::string>& access_token,
      ImageDownloader::DownloadCallback callback) const = 0;

  virtual void DownloadBackdropImage(
      const GURL& url,
      const AccountId& account_id,
      ImageDownloader::DownloadCallback callback) const = 0;
};

class WallpaperImageDownloaderImpl : public WallpaperImageDownloader {
 public:
  WallpaperImageDownloaderImpl();

  WallpaperImageDownloaderImpl(const WallpaperImageDownloaderImpl&) = delete;
  WallpaperImageDownloaderImpl& operator=(const WallpaperImageDownloaderImpl&) =
      delete;

  ~WallpaperImageDownloaderImpl() override;

  // WallpaperImageDownloader:
  void DownloadGooglePhotosImage(
      const GURL& photo,
      const AccountId& account_id,
      const std::optional<std::string>& access_token,
      ImageDownloader::DownloadCallback callback) const override;

  void DownloadBackdropImage(
      const GURL& url,
      const AccountId& account_id,
      ImageDownloader::DownloadCallback callback) const override;
};

}  // namespace ash

#endif  // ASH_WALLPAPER_WALLPAPER_IMAGE_DOWNLOADER_H_