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

ash / public / cpp / session / user_info.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_SESSION_USER_INFO_H_
#define ASH_PUBLIC_CPP_SESSION_USER_INFO_H_

#include <stdint.h>

#include <string>
#include <vector>

#include "ash/public/cpp/ash_public_export.h"
#include "base/token.h"
#include "components/account_id/account_id.h"
#include "components/user_manager/user_type.h"
#include "ui/gfx/image/image_skia.h"

namespace ash {

// Data for a user's avatar.
struct ASH_PUBLIC_EXPORT UserAvatar {
  UserAvatar();
  UserAvatar(const UserAvatar& other);
  ~UserAvatar();

  gfx::ImageSkia image;
  // The raw bytes for the avatar. Useful if the avatar is animated.
  std::vector<uint8_t> bytes;
};

ASH_PUBLIC_EXPORT bool operator==(const UserAvatar& a, const UserAvatar& b);

// Info about a user.
struct ASH_PUBLIC_EXPORT UserInfo {
  UserInfo();
  UserInfo(const UserInfo& other);
  ~UserInfo();

  user_manager::UserType type = user_manager::UserType::kRegular;
  AccountId account_id;
  std::string display_name;
  std::string display_email;
  std::string given_name;
  UserAvatar avatar;

  // True if this user has a newly created profile (first time login on the
  // device)
  bool is_new_profile = false;

  // True if the user's non-cryptohome data (wallpaper, avatar etc.) is
  // ephemeral. See |UserManager::IsUserNonCryptohomeDataEphemeral| for details.
  bool is_ephemeral = false;

  // True if the user has a gaia account.
  bool has_gaia_account = false;

  // True if should display managed ui.
  bool should_display_managed_ui = false;

  // True if the account specified by `account_id` is under policy management.
  bool is_managed = false;
};

ASH_PUBLIC_EXPORT bool operator==(const UserInfo& a, const UserInfo& b);

}  // namespace ash

#endif  // ASH_PUBLIC_CPP_SESSION_USER_INFO_H_