1 // Copyright 2014 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.
5 #ifndef CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_BASE_H_
6 #define CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_BASE_H_
8 #include "components/metrics/metrics_provider.h"
10 // The base class for collecting login status of all opened profiles during one
11 // UMA session and recording the value into a histogram before UMA log is
12 // uploaded. Overriding class SigninStatusMetricsProvider supports platform
13 // Window, Linux, Macintosh and Android, and overriding class
14 // SigninStatusMetricsProviderChromeOS supports ChromeOS. It is currently not
16 class SigninStatusMetricsProviderBase
: public metrics::MetricsProvider
{
18 SigninStatusMetricsProviderBase();
19 ~SigninStatusMetricsProviderBase() override
;
21 // Possible sign-in status of all opened profiles during one UMA session. For
22 // MIXED_SIGNIN_STATUS, at least one signed-in profile and at least one
23 // unsigned-in profile were opened between two UMA log uploads. Not every
24 // possibilities can be applied to each platform.
26 ALL_PROFILES_SIGNED_IN
,
27 ALL_PROFILES_NOT_SIGNED_IN
,
29 UNKNOWN_SIGNIN_STATUS
,
30 ERROR_GETTING_SIGNIN_STATUS
,
35 // Record the sign in status into the proper histogram bucket. This should be
36 // called exactly once for each UMA session.
37 void RecordSigninStatusHistogram(SigninStatus signin_status
);
39 // Sets the value of |signin_status_|. It ensures that |signin_status_| will
40 // not be changed if its value is already ERROR_GETTING_SIGNIN_STATUS.
41 void SetSigninStatus(SigninStatus new_status
);
43 // Resets the value of |signin_status_| to be UNKNOWN_SIGNIN_STATUS regardless
44 // of its current value;
45 void ResetSigninStatus();
47 SigninStatus
signin_status() const { return signin_status_
; }
50 // Sign-in status of all profiles seen so far.
51 SigninStatus signin_status_
;
53 DISALLOW_COPY_AND_ASSIGN(SigninStatusMetricsProviderBase
);
56 #endif // CHROME_BROWSER_METRICS_SIGNIN_STATUS_METRICS_PROVIDER_BASE_H_