date_changed_helper.h 997 B

1234567891011121314151617181920212223242526272829
  1. // Copyright 2020 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 COMPONENTS_METRICS_DATE_CHANGED_HELPER_H_
  5. #define COMPONENTS_METRICS_DATE_CHANGED_HELPER_H_
  6. class PrefRegistrySimple;
  7. class PrefService;
  8. namespace metrics {
  9. namespace date_changed_helper {
  10. // Returns whether the local date has changed since last time this was called
  11. // for the given |pref_name|. Simple alternative to |DailyEvent|.
  12. // TODO: Consider adding an enum param to distinguish has-date-changed from
  13. // has-day-elapsed if needed by consumers of this API.
  14. bool HasDateChangedSinceLastCall(PrefService* pref_service,
  15. const char* pref_name);
  16. // Registers the preference used by this helper.
  17. void RegisterPref(PrefRegistrySimple* registry, const char* pref_name);
  18. } // namespace date_changed_helper
  19. } // namespace metrics
  20. #endif // COMPONENTS_METRICS_DATE_CHANGED_HELPER_H_