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

ash / public / cpp / wallpaper / google_photos_wallpaper_params.cc [blame]

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

#include "ash/public/cpp/wallpaper/google_photos_wallpaper_params.h"

#include "base/check.h"

namespace ash {

GooglePhotosWallpaperParams::GooglePhotosWallpaperParams(
    const AccountId& account_id,
    const std::string& id,
    bool daily_refresh_enabled,
    WallpaperLayout layout,
    bool preview_mode,
    std::optional<std::string> dedup_key)
    : account_id(account_id),
      id(id),
      daily_refresh_enabled(daily_refresh_enabled),
      layout(layout),
      preview_mode(preview_mode),
      dedup_key(std::move(dedup_key)) {
  // The `dedup_key` is only used to differentiate between photos (not albums)
  // and so is not applicable when daily refresh is enabled.
  if (daily_refresh_enabled)
    DCHECK(!this->dedup_key.has_value());
}

GooglePhotosWallpaperParams::GooglePhotosWallpaperParams(
    const GooglePhotosWallpaperParams& other) = default;

GooglePhotosWallpaperParams& GooglePhotosWallpaperParams::operator=(
    const GooglePhotosWallpaperParams& other) = default;

GooglePhotosWallpaperParams::~GooglePhotosWallpaperParams() = default;

std::ostream& operator<<(std::ostream& os,
                         const GooglePhotosWallpaperParams& params) {
  os << "GooglePhotosWallPaperParams:" << std::endl;
  os << "  Account Id: " << params.account_id << std::endl;
  os << "  Id: " << params.id << std::endl;
  os << "  Daily Refresh: " << params.daily_refresh_enabled << std::endl;
  os << "  Layout: " << params.layout << std::endl;
  os << "  Preview Mode: " << params.preview_mode << std::endl;
  os << "  Dedup Key: " << params.dedup_key.value_or("") << std::endl;
  return os;
}

}  // namespace ash