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
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72

ash / public / cpp / wallpaper / wallpaper_controller_client.h [blame]

// Copyright 2019 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_PUBLIC_CPP_WALLPAPER_WALLPAPER_CONTROLLER_CLIENT_H_
#define ASH_PUBLIC_CPP_WALLPAPER_WALLPAPER_CONTROLLER_CLIENT_H_

#include <optional>
#include <string>

#include "ash/public/cpp/ash_public_export.h"
#include "ash/webui/personalization_app/proto/backdrop_wallpaper.pb.h"
#include "base/functional/callback.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"

class AccountId;

namespace ash {

namespace personalization_app::mojom {
class GooglePhotosPhoto;
}

// Used by ash to control a Chrome client of the WallpaperController.
class ASH_PUBLIC_EXPORT WallpaperControllerClient {
 public:
  // Opens the wallpaper picker window.
  virtual void OpenWallpaperPicker() = 0;

  // Downloads and sets a new random wallpaper from the collection of the
  // specified collection_id.
  using DailyWallpaperUrlFetchedCallback =
      base::OnceCallback<void(bool success, const backdrop::Image& image)>;
  virtual void FetchDailyRefreshWallpaper(
      const std::string& collection_id,
      DailyWallpaperUrlFetchedCallback callback) = 0;

  virtual void GetFilesId(
      const AccountId& account_id,
      base::OnceCallback<void(const std::string&)> files_id_callback) const = 0;

  virtual bool IsWallpaperSyncEnabled(const AccountId& account_id) const = 0;

  using FetchImagesForCollectionCallback =
      base::OnceCallback<void(bool success,
                              const std::vector<backdrop::Image>& images)>;
  virtual void FetchImagesForCollection(
      const std::string& collection_id,
      FetchImagesForCollectionCallback callback) = 0;

  using FetchGooglePhotosPhotoCallback = base::OnceCallback<void(
      mojo::StructPtr<ash::personalization_app::mojom::GooglePhotosPhoto>,
      bool success)>;
  virtual void FetchGooglePhotosPhoto(
      const AccountId& account_id,
      const std::string& id,
      FetchGooglePhotosPhotoCallback callback) = 0;
  virtual void FetchDailyGooglePhotosPhoto(
      const AccountId& account_id,
      const std::string& album_id,
      FetchGooglePhotosPhotoCallback callback) = 0;

  using FetchGooglePhotosAccessTokenCallback =
      base::OnceCallback<void(const std::optional<std::string>& token)>;
  virtual void FetchGooglePhotosAccessToken(
      const AccountId& account_id,
      FetchGooglePhotosAccessTokenCallback callback) = 0;
};

}  // namespace ash

#endif  // ASH_PUBLIC_CPP_WALLPAPER_WALLPAPER_CONTROLLER_CLIENT_H_