#ifndef ASH_PUBLIC_CPP_AMBIENT_AMBIENT_BACKEND_CONTROLLER_H_
#define ASH_PUBLIC_CPP_AMBIENT_AMBIENT_BACKEND_CONTROLLER_H_
#include <array>
#include <optional>
#include <string>
#include <vector>
#include "ash/constants/ambient_video.h"
#include "ash/public/cpp/ambient/common/ambient_settings.h"
#include "ash/public/cpp/ambient/proto/photo_cache_entry.pb.h"
#include "ash/public/cpp/ambient/weather_info.h"
#include "ash/public/cpp/ash_public_export.h"
#include "base/functional/callback_forward.h"
#include "ui/gfx/geometry/size.h"
#include "url/gurl.h"
namespace ash {
struct ASH_PUBLIC_EXPORT AmbientModeTopic {
AmbientModeTopic();
AmbientModeTopic(const AmbientModeTopic&);
AmbientModeTopic& operator=(const AmbientModeTopic&);
AmbientModeTopic(AmbientModeTopic&&);
AmbientModeTopic& operator=(AmbientModeTopic&&);
~AmbientModeTopic();
std::string details;
std::string url;
std::string related_image_url;
std::string related_details;
::ambient::TopicType topic_type = ::ambient::TopicType::kOther;
bool is_portrait = false;
};
struct ASH_PUBLIC_EXPORT ScreenUpdate {
ScreenUpdate();
ScreenUpdate(const ScreenUpdate&);
ScreenUpdate& operator=(const ScreenUpdate&);
~ScreenUpdate();
std::vector<AmbientModeTopic> next_topics;
std::optional<WeatherInfo> weather_info;
};
class ASH_PUBLIC_EXPORT AmbientBackendController {
public:
using OnScreenUpdateInfoFetchedCallback =
base::OnceCallback<void(const ScreenUpdate&)>;
using OnPreviewImagesFetchedCallback =
base::OnceCallback<void(const std::vector<GURL>& preview_urls)>;
using UpdateSettingsCallback =
base::OnceCallback<void(bool success, const AmbientSettings& settings)>;
using OnSettingsAndAlbumsFetchedCallback =
base::OnceCallback<void(const std::optional<AmbientSettings>& settings,
PersonalAlbums personal_albums)>;
using FetchWeatherCallback =
base::OnceCallback<void(const std::optional<WeatherInfo>& weather_info)>;
static AmbientBackendController* Get();
AmbientBackendController();
AmbientBackendController(const AmbientBackendController&) = delete;
AmbientBackendController& operator=(const AmbientBackendController&) = delete;
virtual ~AmbientBackendController();
virtual void FetchScreenUpdateInfo(
int num_topics,
bool show_pair_personal_portraits,
const gfx::Size& screen_size,
OnScreenUpdateInfoFetchedCallback callback) = 0;
virtual void FetchPreviewImages(const gfx::Size& preview_size,
OnPreviewImagesFetchedCallback callback) = 0;
virtual void UpdateSettings(const AmbientSettings settings,
UpdateSettingsCallback callback) = 0;
virtual void FetchSettingsAndAlbums(int banner_width,
int banner_height,
int num_albums,
OnSettingsAndAlbumsFetchedCallback) = 0;
virtual void FetchWeather(std::optional<std::string> weather_client_id,
FetchWeatherCallback callback) = 0;
virtual const std::array<const char*, 2>& GetBackupPhotoUrls() const = 0;
virtual std::array<const char*, 2> GetTimeOfDayVideoPreviewImageUrls(
AmbientVideo video) const = 0;
virtual const char* GetPromoBannerUrl() const = 0;
virtual const char* GetTimeOfDayProductName() const = 0;
};
}
#endif