910e62b5创建于 1月15日历史提交
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef DEVICE_VR_CREATE_ANCHOR_REQUEST_H_
#define DEVICE_VR_CREATE_ANCHOR_REQUEST_H_

#include "base/component_export.h"
#include "base/functional/callback.h"
#include "base/time/time.h"
#include "device/vr/public/mojom/anchor_id.h"
#include "device/vr/public/mojom/plane_id.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "ui/gfx/geometry/transform.h"

namespace device {

using CreateAnchorCallback =
    base::OnceCallback<void(const std::optional<device::AnchorId>&)>;

class COMPONENT_EXPORT(DEVICE_VR_BASE) CreateAnchorRequest {
 public:
  const mojom::XRNativeOriginInformation& GetNativeOriginInformation() const;
  const gfx::Transform& GetNativeOriginFromAnchor() const;
  const base::TimeTicks& GetRequestStartTime() const;
  std::optional<PlaneId> GetPlaneId() const;

  CreateAnchorCallback TakeCallback();

  CreateAnchorRequest(
      const mojom::XRNativeOriginInformation& native_origin_information,
      const gfx::Transform& native_origin_from_anchor,
      std::optional<PlaneId> plane_id,
      CreateAnchorCallback callback);
  CreateAnchorRequest(CreateAnchorRequest&& other);
  ~CreateAnchorRequest();

 private:
  mojom::XRNativeOriginInformationPtr native_origin_information_;
  const gfx::Transform native_origin_from_anchor_;
  const base::TimeTicks request_start_time_;
  std::optional<PlaneId> plane_id_;

  CreateAnchorCallback callback_;
};

}  // namespace device

#endif  // DEVICE_VR_CREATE_ANCHOR_REQUEST_H_