camera_roll_item.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/components/phonehub/camera_roll_item.h"
  5. #include "ash/components/phonehub/proto/phonehub_api.pb.h"
  6. #include "base/strings/utf_string_conversions.h"
  7. #include "ui/gfx/image/image.h"
  8. namespace ash {
  9. namespace phonehub {
  10. CameraRollItem::CameraRollItem(const proto::CameraRollItemMetadata& metadata,
  11. const gfx::Image& thumbnail)
  12. : metadata_(metadata), thumbnail_(thumbnail) {}
  13. CameraRollItem::CameraRollItem(const CameraRollItem&) = default;
  14. CameraRollItem& CameraRollItem::operator=(const CameraRollItem&) = default;
  15. CameraRollItem::~CameraRollItem() = default;
  16. bool CameraRollItem::operator==(const CameraRollItem& other) const {
  17. return metadata_.key() == other.metadata().key() &&
  18. metadata_.mime_type() == other.metadata().mime_type() &&
  19. metadata_.last_modified_millis() ==
  20. other.metadata().last_modified_millis() &&
  21. metadata_.file_size_bytes() == other.metadata().file_size_bytes() &&
  22. metadata_.file_name() == other.metadata().file_name();
  23. }
  24. bool CameraRollItem::operator!=(const CameraRollItem& other) const {
  25. return !operator==(other);
  26. }
  27. } // namespace phonehub
  28. } // namespace ash