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

ash / public / cpp / holding_space / holding_space_item_updated_fields.h [blame]

// Copyright 2024 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_HOLDING_SPACE_HOLDING_SPACE_ITEM_UPDATED_FIELDS_H_
#define ASH_PUBLIC_CPP_HOLDING_SPACE_HOLDING_SPACE_ITEM_UPDATED_FIELDS_H_

#include <optional>
#include <vector>

#include "ash/public/cpp/ash_public_export.h"
#include "ash/public/cpp/holding_space/holding_space_colors.h"
#include "ash/public/cpp/holding_space/holding_space_file.h"
#include "ash/public/cpp/holding_space/holding_space_item.h"
#include "ash/public/cpp/holding_space/holding_space_progress.h"
#include "ui/color/color_id.h"

namespace ash {

// Indicates which fields of a holding space item were changed during an update
// operation. See `HoldingSpaceModelObserver::OnHoldingSpaceItemUpdated()`.
struct ASH_PUBLIC_EXPORT HoldingSpaceItemUpdatedFields {
  HoldingSpaceItemUpdatedFields();
  HoldingSpaceItemUpdatedFields(const HoldingSpaceItemUpdatedFields&);
  HoldingSpaceItemUpdatedFields& operator=(
      const HoldingSpaceItemUpdatedFields&);
  HoldingSpaceItemUpdatedFields(HoldingSpaceItemUpdatedFields&&);
  HoldingSpaceItemUpdatedFields& operator=(HoldingSpaceItemUpdatedFields&&);
  ~HoldingSpaceItemUpdatedFields();

  bool operator==(const HoldingSpaceItemUpdatedFields&) const;
  bool operator!=(const HoldingSpaceItemUpdatedFields&) const;

  // Returns whether any fields were updated as indicated by the presence
  // of previous values.
  bool IsEmpty() const;

  // Contains the previous accessible name iff the field was updated.
  std::optional<std::u16string> previous_accessible_name;

  // Contains the previous backing file iff the field was updated.
  std::optional<HoldingSpaceFile> previous_backing_file;

  // Contains the previous in-progress commands iff the field was updated.
  std::optional<std::vector<HoldingSpaceItem::InProgressCommand>>
      previous_in_progress_commands;

  // Contains the previous progress iff the field was updated.
  std::optional<HoldingSpaceProgress> previous_progress;

  // Contains the previous secondary text iff the field was updated.
  std::optional<std::optional<std::u16string>> previous_secondary_text;

  // Contains the previous secondary text color variant iff the field was
  // updated.
  std::optional<std::optional<HoldingSpaceColorVariant>>
      previous_secondary_text_color_variant;

  // Contains the previous text iff the field was updated.
  std::optional<std::optional<std::u16string>> previous_text;
};

}  // namespace ash

#endif  // ASH_PUBLIC_CPP_HOLDING_SPACE_HOLDING_SPACE_ITEM_UPDATED_FIELDS_H_