monthly_use_case_impl.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2022 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_COMPONENTS_DEVICE_ACTIVITY_MONTHLY_USE_CASE_IMPL_H_
  5. #define ASH_COMPONENTS_DEVICE_ACTIVITY_MONTHLY_USE_CASE_IMPL_H_
  6. #include "ash/components/device_activity/device_active_use_case.h"
  7. #include "base/component_export.h"
  8. #include "base/time/time.h"
  9. class PrefService;
  10. namespace version_info {
  11. enum class Channel;
  12. } // namespace version_info
  13. namespace ash {
  14. namespace device_activity {
  15. // Forward declaration from fresnel_service.proto.
  16. class ImportDataRequest;
  17. // Contains the methods required to report the fixed monthly active use case.
  18. class COMPONENT_EXPORT(ASH_DEVICE_ACTIVITY) MonthlyUseCaseImpl
  19. : public DeviceActiveUseCase {
  20. public:
  21. MonthlyUseCaseImpl(
  22. const std::string& psm_device_active_secret,
  23. const ChromeDeviceMetadataParameters& chrome_passed_device_params,
  24. PrefService* local_state);
  25. MonthlyUseCaseImpl(const MonthlyUseCaseImpl&) = delete;
  26. MonthlyUseCaseImpl& operator=(const MonthlyUseCaseImpl&) = delete;
  27. ~MonthlyUseCaseImpl() override;
  28. // Generate the window identifier for the kCrosMonthly use case.
  29. // For example, the monthly use case should generate a window identifier
  30. // formatted: yyyyMM.
  31. //
  32. // It is generated on demand each time the state machine leaves the idle
  33. // state. It is reused by several states. It is reset to nullopt. This field
  34. // is used apart of PSM Import request.
  35. std::string GenerateUTCWindowIdentifier(base::Time ts) const override;
  36. // Generate Fresnel PSM import request body.
  37. // Sets the monthly device metadata dimensions sent by PSM import.
  38. //
  39. // Important: Each new dimension added to metadata will need to be approved by
  40. // privacy.
  41. ImportDataRequest GenerateImportRequestBody() override;
  42. };
  43. } // namespace device_activity
  44. } // namespace ash
  45. #endif // ASH_COMPONENTS_DEVICE_ACTIVITY_MONTHLY_USE_CASE_IMPL_H_