OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_OPTIN_UMA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_OPTIN_UMA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_OPTIN_UMA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_OPTIN_UMA_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "components/arc/common/auth.mojom.h" | 10 #include "components/arc/common/auth.mojom.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class TimeDelta; | 13 class TimeDelta; |
14 } | 14 } |
15 | 15 |
16 namespace arc { | 16 namespace arc { |
17 | 17 |
18 // These enums are used to define the buckets for an enumerated UMA histogram | 18 // These enums are used to define the buckets for an enumerated UMA histogram |
19 // and need to be synced with histograms.xml | 19 // and need to be synced with histograms.xml |
20 enum class OptInActionType : int { | 20 enum class OptInActionType : int { |
21 OPTED_OUT = 0, // ARC was opted out by user. | 21 // ARC was opted out by user. |
22 OPTED_IN = 1, // ARC was opted in by user. | 22 OPTED_OUT = 0, |
23 NOTIFICATION_ACCEPTED = 2, // ARC OptIn notification was accepted. | 23 |
24 NOTIFICATION_DECLINED = 3, // ARC OptIn notification was declined. | 24 // ARC was opted in by user. |
25 NOTIFICATION_TIMED_OUT = 4, // ARC OptIn notification was timed out. | 25 OPTED_IN = 1, |
26 RETRY = 5, // User asked to retry OptIn. | 26 |
27 SIZE, // The size of this enum; keep last. | 27 // ARC OptIn notification was accepted. |
| 28 NOTIFICATION_ACCEPTED = 2, |
| 29 |
| 30 // ARC OptIn notification was declined. |
| 31 NOTIFICATION_DECLINED = 3, |
| 32 |
| 33 // ARC OptIn notification was timed out. |
| 34 NOTIFICATION_TIMED_OUT = 4, |
| 35 |
| 36 // User asked to retry OptIn. |
| 37 RETRY = 5, |
| 38 |
| 39 // The size of this enum; keep last. |
| 40 SIZE, |
28 }; | 41 }; |
29 | 42 |
30 enum class OptInCancelReason { | 43 enum class OptInCancelReason { |
31 USER_CANCEL = 0, // Canceled by user. | 44 // Canceled by user. |
32 UNKNOWN_ERROR = 1, // Unclassified failure. | 45 USER_CANCEL = 0, |
33 NETWORK_ERROR = 2, // Network failure. | 46 |
34 SERVICE_UNAVAILABLE = 3, // GMS Services are not available. | 47 // Unclassified failure. |
| 48 UNKNOWN_ERROR = 1, |
| 49 |
| 50 // Network failure. |
| 51 NETWORK_ERROR = 2, |
| 52 |
| 53 DEPRECATED_SERVICE_UNAVAILABLE = 3, |
35 DEPRECATED_BAD_AUTHENTICATION = 4, | 54 DEPRECATED_BAD_AUTHENTICATION = 4, |
36 DEPRECATED_GMS_CORE_NOT_AVAILABLE = 5, | 55 DEPRECATED_GMS_CORE_NOT_AVAILABLE = 5, |
37 CLOUD_PROVISION_FLOW_FAIL = 6, // Cloud provision flow failed. | 56 |
38 ANDROID_MANAGEMENT_REQUIRED = 7, // Android management is required for user. | 57 // Cloud provision flow failed. |
39 SIZE, // The size of this enum; keep last. | 58 CLOUD_PROVISION_FLOW_FAIL = 6, |
| 59 |
| 60 // Android management is required for user. |
| 61 ANDROID_MANAGEMENT_REQUIRED = 7, |
| 62 |
| 63 // Cannot start ARC because it is busy. |
| 64 SESSION_BUSY = 8, |
| 65 |
| 66 // The size of this enum; keep last. |
| 67 SIZE, |
40 }; | 68 }; |
41 | 69 |
42 enum class OptInSilentAuthCode { | 70 enum class OptInSilentAuthCode { |
43 // Silent auth code feature is disabled. | 71 // Silent auth code feature is disabled. |
44 DISABLED = 0, | 72 DISABLED = 0, |
| 73 |
45 // Silent auth code fetched normally. | 74 // Silent auth code fetched normally. |
46 SUCCESS = 1, | 75 SUCCESS = 1, |
| 76 |
47 // HTTP Context cannot be prepared. | 77 // HTTP Context cannot be prepared. |
48 CONTEXT_NOT_READY = 2, | 78 CONTEXT_NOT_READY = 2, |
| 79 |
49 // No LST token is available. | 80 // No LST token is available. |
50 NO_LST_TOKEN = 3, | 81 NO_LST_TOKEN = 3, |
| 82 |
51 // Silent auth code failed due sever HTTP error 5XX. | 83 // Silent auth code failed due sever HTTP error 5XX. |
52 HTTP_SERVER_FAILURE = 4, | 84 HTTP_SERVER_FAILURE = 4, |
| 85 |
53 // Silent auth code failed due client HTTP error 4XX. | 86 // Silent auth code failed due client HTTP error 4XX. |
54 HTTP_CLIENT_FAILURE = 5, | 87 HTTP_CLIENT_FAILURE = 5, |
| 88 |
55 // Silent auth code failed due unknown HTTP error. | 89 // Silent auth code failed due unknown HTTP error. |
56 HTTP_UNKNOWN_FAILURE = 6, | 90 HTTP_UNKNOWN_FAILURE = 6, |
| 91 |
57 // Cannot parse HTTP response. | 92 // Cannot parse HTTP response. |
58 RESPONSE_PARSE_FAILURE = 7, | 93 RESPONSE_PARSE_FAILURE = 7, |
| 94 |
59 // No Auth code in response. | 95 // No Auth code in response. |
60 NO_AUTH_CODE_IN_RESPONSE = 8, | 96 NO_AUTH_CODE_IN_RESPONSE = 8, |
| 97 |
61 // The size of this enum, keep last. | 98 // The size of this enum, keep last. |
62 SIZE, | 99 SIZE, |
63 }; | 100 }; |
64 | 101 |
65 // The values should be listed in ascending order for SIZE a last, for safety. | 102 // The values should be listed in ascending order for SIZE a last, for safety. |
66 // For detailed meaning, please see also to auth.mojom. | 103 // For detailed meaning, please see also to auth.mojom. |
67 enum class ProvisioningResult : int { | 104 enum class ProvisioningResult : int { |
68 // Provisioning was successful. | 105 // Provisioning was successful. |
69 SUCCESS = 0, | 106 SUCCESS = 0, |
70 | 107 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Network connection is unavailable in ARC. | 151 // Network connection is unavailable in ARC. |
115 NO_NETWORK_CONNECTION = 19, | 152 NO_NETWORK_CONNECTION = 19, |
116 | 153 |
117 // ARC is not enabled. | 154 // ARC is not enabled. |
118 ARC_DISABLED = 20, | 155 ARC_DISABLED = 20, |
119 | 156 |
120 // The size of this enum; keep last. | 157 // The size of this enum; keep last. |
121 SIZE, | 158 SIZE, |
122 }; | 159 }; |
123 | 160 |
| 161 enum class OptInFlowResult : int { |
| 162 // OptIn has started. |
| 163 STARTED = 0, |
| 164 |
| 165 // OptIn has been succeeded, this also includes succeeded with error cases. |
| 166 SUCCEEDED = 1, |
| 167 |
| 168 // OptIn has been succeeded but with retry after an error. |
| 169 SUCCEEDED_AFTER_RETRY = 2, |
| 170 |
| 171 // OptIn has been canceled, this also includes canceled after error cases. |
| 172 CANCELED = 3, |
| 173 |
| 174 // OptIn has been canceled after an error was reported. |
| 175 CANCELED_AFTER_ERROR = 4, |
| 176 |
| 177 // The size of this enum; keep last. |
| 178 SIZE, |
| 179 }; |
| 180 |
124 void UpdateOptInActionUMA(OptInActionType type); | 181 void UpdateOptInActionUMA(OptInActionType type); |
125 void UpdateOptInCancelUMA(OptInCancelReason reason); | 182 void UpdateOptInCancelUMA(OptInCancelReason reason); |
| 183 void UpdateOptInFlowResultUMA(OptInFlowResult result); |
126 void UpdateEnabledStateUMA(bool enabled); | 184 void UpdateEnabledStateUMA(bool enabled); |
127 void UpdateProvisioningResultUMA(ProvisioningResult result, bool managed); | 185 void UpdateProvisioningResultUMA(ProvisioningResult result, bool managed); |
128 void UpdateProvisioningTiming(const base::TimeDelta& elapsed_time, | 186 void UpdateProvisioningTiming(const base::TimeDelta& elapsed_time, |
129 bool success, | 187 bool success, |
130 bool managed); | 188 bool managed); |
131 void UpdateSilentAuthCodeUMA(OptInSilentAuthCode state); | 189 void UpdateSilentAuthCodeUMA(OptInSilentAuthCode state); |
132 void UpdateAuthTiming(const char* histogram_name, base::TimeDelta elapsed_time); | 190 void UpdateAuthTiming(const char* histogram_name, base::TimeDelta elapsed_time); |
133 void UpdateAuthCheckinAttempts(int32_t num_attempts); | 191 void UpdateAuthCheckinAttempts(int32_t num_attempts); |
134 void UpdateAuthAccountCheckStatus(mojom::AccountCheckStatus status); | 192 void UpdateAuthAccountCheckStatus(mojom::AccountCheckStatus status); |
135 | 193 |
136 // Outputs the stringified |result| to |os|. This is only for logging purposes. | 194 // Outputs the stringified |result| to |os|. This is only for logging purposes. |
137 std::ostream& operator<<(std::ostream& os, const ProvisioningResult& result); | 195 std::ostream& operator<<(std::ostream& os, const ProvisioningResult& result); |
138 | 196 |
139 } // namespace arc | 197 } // namespace arc |
140 | 198 |
141 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_OPTIN_UMA_H_ | 199 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_OPTIN_UMA_H_ |
OLD | NEW |