user_action_recorder_impl.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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 ASH_COMPONENTS_PHONEHUB_USER_ACTION_RECORDER_IMPL_H_
  5. #define ASH_COMPONENTS_PHONEHUB_USER_ACTION_RECORDER_IMPL_H_
  6. #include "ash/components/phonehub/user_action_recorder.h"
  7. #include "base/gtest_prod_util.h"
  8. namespace ash {
  9. namespace phonehub {
  10. class FeatureStatusProvider;
  11. // UserActionRecorder implementation which generates engagement metrics for
  12. // Phone Hub.
  13. class UserActionRecorderImpl : public UserActionRecorder {
  14. public:
  15. explicit UserActionRecorderImpl(
  16. FeatureStatusProvider* feature_status_provider);
  17. ~UserActionRecorderImpl() override;
  18. private:
  19. friend class UserActionRecorderImplTest;
  20. FRIEND_TEST_ALL_PREFIXES(UserActionRecorderImplTest, RecordActions);
  21. // Types of user actions; numerical value should not be reused or reordered
  22. // since this enum is used in metrics.
  23. enum class UserAction {
  24. kUiOpened = 0,
  25. kTether = 1,
  26. kDnd = 2,
  27. kFindMyDevice = 3,
  28. kBrowserTab = 4,
  29. kNotificationDismissal = 5,
  30. kNotificationReply = 6,
  31. kCameraRollDownload = 7,
  32. kMaxValue = kCameraRollDownload,
  33. };
  34. // UserActionRecorder:
  35. void RecordUiOpened() override;
  36. void RecordTetherConnectionAttempt() override;
  37. void RecordDndAttempt() override;
  38. void RecordFindMyDeviceAttempt() override;
  39. void RecordBrowserTabOpened() override;
  40. void RecordNotificationDismissAttempt() override;
  41. void RecordNotificationReplyAttempt() override;
  42. void RecordCameraRollDownloadAttempt() override;
  43. void HandleUserAction(UserAction action);
  44. FeatureStatusProvider* feature_status_provider_;
  45. };
  46. } // namespace phonehub
  47. } // namespace ash
  48. #endif // ASH_COMPONENTS_PHONEHUB_USER_ACTION_RECORDER_IMPL_H_