user_event_service.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2017 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_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_
  5. #define COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_
  6. #include <memory>
  7. #include "base/memory/weak_ptr.h"
  8. #include "components/keyed_service/core/keyed_service.h"
  9. #include "components/sync/protocol/user_event_specifics.pb.h"
  10. namespace syncer {
  11. class ModelTypeControllerDelegate;
  12. class UserEventService : public KeyedService {
  13. public:
  14. UserEventService() = default;
  15. UserEventService(const UserEventService&) = delete;
  16. UserEventService& operator=(const UserEventService&) = delete;
  17. ~UserEventService() override = default;
  18. // Records a given event to be reported. Relevant settings will be checked to
  19. // verify user events should be emitted and this will no-op if the the
  20. // requisite permissions are not present.
  21. virtual void RecordUserEvent(
  22. std::unique_ptr<sync_pb::UserEventSpecifics> specifics) = 0;
  23. virtual void RecordUserEvent(
  24. const sync_pb::UserEventSpecifics& specifics) = 0;
  25. // Returns the underlying Sync integration point.
  26. virtual base::WeakPtr<syncer::ModelTypeControllerDelegate>
  27. GetControllerDelegate() = 0;
  28. };
  29. } // namespace syncer
  30. #endif // COMPONENTS_SYNC_USER_EVENTS_USER_EVENT_SERVICE_H_