OLD | NEW |
(Empty) | |
| 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 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_USER_SESSION_METRICS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_USER_SESSION_METRICS_H_ |
| 7 |
| 8 #include "base/time/time.h" |
| 9 #include "components/user_manager/user_type.h" |
| 10 |
| 11 class PrefRegistrySimple; |
| 12 |
| 13 namespace chromeos { |
| 14 |
| 15 class UserContext; |
| 16 |
| 17 namespace enterprise_user_session_metrics { |
| 18 |
| 19 // Enum for logins metrics on an enrolled device. |
| 20 enum class SignInEventType { |
| 21 // A regular user login. |
| 22 REGULAR_USER = 0, |
| 23 // Manually started public session. |
| 24 MANUAL_PUBLIC_SESSION = 1, |
| 25 // Automatically started public session. |
| 26 AUTOMATIC_PUBLIC_SESSSION = 2, |
| 27 // Manually started kiosk session. |
| 28 MANUAL_KIOSK = 3, |
| 29 // Automatically started kiosk session. |
| 30 AUTOMATIC_KIOSK = 4, |
| 31 // Count of sign-in event types. Must be the last one. |
| 32 SIGN_IN_EVENT_COUNT, |
| 33 }; |
| 34 |
| 35 // Register local state preferences. |
| 36 void RegisterPrefs(PrefRegistrySimple* registry); |
| 37 |
| 38 // Records a sign-in event for an enrolled device. |
| 39 void RecordSignInEvent(SignInEventType sign_in_event_type); |
| 40 |
| 41 // Records a sign-in event by UserContext for an enrolled device. |
| 42 // |is_auto_login| indicates whether the sign-in is a policy configured |
| 43 // automatic login or a manual login in response to user action. |
| 44 void RecordSignInEvent(const UserContext& user_context, bool is_auto_login); |
| 45 |
| 46 // Stores session length for regular user, public session user for enrolled |
| 47 // device to be reported on the next run. It stores the duration in a local |
| 48 // state pref instead of sending it to metrics code directly because it is |
| 49 // called on shutdown path and metrics are likely to be lost. The stored value |
| 50 // would be reported on the next run. |
| 51 void StoreSessionLength(user_manager::UserType session_type, |
| 52 const base::TimeDelta& session_length); |
| 53 |
| 54 // Records the stored session length and clears it. |
| 55 void RecordStoredSessionLength(); |
| 56 |
| 57 } // namespace enterprise_user_session_metrics |
| 58 } // namespace chromeos |
| 59 |
| 60 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENTERPRISE_USER_SESSION_METRICS_H_ |
OLD | NEW |