host_device_timestamp_manager.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2018 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. #ifndef ASH_SERVICES_MULTIDEVICE_SETUP_HOST_DEVICE_TIMESTAMP_MANAGER_H_
  5. #define ASH_SERVICES_MULTIDEVICE_SETUP_HOST_DEVICE_TIMESTAMP_MANAGER_H_
  6. #include "base/time/time.h"
  7. #include "third_party/abseil-cpp/absl/types/optional.h"
  8. namespace ash {
  9. namespace multidevice_setup {
  10. // Records time at which the logged in user completed the MultiDevice setup flow
  11. // on this device.
  12. class HostDeviceTimestampManager {
  13. public:
  14. HostDeviceTimestampManager(const HostDeviceTimestampManager&) = delete;
  15. HostDeviceTimestampManager& operator=(const HostDeviceTimestampManager&) =
  16. delete;
  17. virtual ~HostDeviceTimestampManager() = default;
  18. // Returns true when there is a host set (not necessarily verified) for the
  19. // logged in GAIA account and that host was set from this Chromebook.
  20. virtual bool WasHostSetFromThisChromebook() = 0;
  21. // If the logged in GAIA account has completed the MultiDevice setup flow on
  22. // this device, this returns the time at which the flow was completed. If the
  23. // flow was completed more than once, it records the most recent time of
  24. // completion. Otherwise it returns absl::nullopt.
  25. virtual absl::optional<base::Time>
  26. GetLatestSetupFlowCompletionTimestamp() = 0;
  27. // If the logged in GAIA account has ever received a host status update that
  28. // a host was verified, this returns the time at which the last such update
  29. // was received. Otherwise it returns absl::nullopt.
  30. virtual absl::optional<base::Time> GetLatestVerificationTimestamp() = 0;
  31. protected:
  32. HostDeviceTimestampManager() = default;
  33. };
  34. } // namespace multidevice_setup
  35. } // namespace ash
  36. #endif // ASH_SERVICES_MULTIDEVICE_SETUP_HOST_DEVICE_TIMESTAMP_MANAGER_H_