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

ash / public / cpp / default_user_image.h [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.

#ifndef ASH_PUBLIC_CPP_DEFAULT_USER_IMAGE_H_
#define ASH_PUBLIC_CPP_DEFAULT_USER_IMAGE_H_

#include <optional>
#include <string>

#include "ash/public/cpp/ash_public_export.h"
#include "url/gurl.h"

namespace ash::default_user_image {

// Only relevant for a few deprecated avatar images that users can no longer
// select.
struct ASH_PUBLIC_EXPORT DeprecatedSourceInfo {
 public:
  DeprecatedSourceInfo();
  DeprecatedSourceInfo(std::u16string author, GURL website);

  DeprecatedSourceInfo(DeprecatedSourceInfo&&);
  DeprecatedSourceInfo& operator=(DeprecatedSourceInfo&&);

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

  ~DeprecatedSourceInfo();

  std::u16string author;
  GURL website;
};

struct ASH_PUBLIC_EXPORT DefaultUserImage {
 public:
  DefaultUserImage();
  DefaultUserImage(int index,
                   std::u16string title,
                   GURL url,
                   std::optional<DeprecatedSourceInfo> source_info);

  DefaultUserImage(DefaultUserImage&&);
  DefaultUserImage& operator=(DefaultUserImage&&);

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

  ~DefaultUserImage();

  int index;
  std::u16string title;
  // The gstatic URL of the avatar image.
  GURL url;
  // Deprecated. Only used for older avatar images that users can no longer
  // select.
  std::optional<DeprecatedSourceInfo> source_info;
};

}  // namespace ash::default_user_image

#endif  // ASH_PUBLIC_CPP_DEFAULT_USER_IMAGE_H_