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 
5 #ifndef CHROME_BROWSER_CHROMEOS_CHILD_ACCOUNTS_TIME_LIMITS_APP_ACTIVITY_REPORT_INTERFACE_H_
6 #define CHROME_BROWSER_CHROMEOS_CHILD_ACCOUNTS_TIME_LIMITS_APP_ACTIVITY_REPORT_INTERFACE_H_
7 
8 #include "base/time/time.h"
9 
10 class Profile;
11 
12 namespace enterprise_management {
13 class ChildStatusReportRequest;
14 }  // namespace enterprise_management
15 
16 namespace chromeos {
17 namespace app_time {
18 
19 // Interface of the object generating app activity for child user.
20 class AppActivityReportInterface {
21  public:
22   // Parameters of the generated report.
23   struct ReportParams {
24     // Time the report was generated.
25     base::Time generation_time;
26 
27     // Whether any data were added to the report.
28     bool anything_reported = false;
29   };
30 
31   // Factory method that returns object generating app activity for child user.
32   // feature. Provided to reduce the dependencies between API consumer and child
33   // user related code. AppActivityReportInterface object has a lifetime of a
34   // KeyedService.
35   static AppActivityReportInterface* Get(Profile* profile);
36 
37   static bool ShouldReportAppActivity();
38 
39   virtual ~AppActivityReportInterface();
40 
41   // Populates child status |report| with collected app activity.
42   // Returns whether any data were populated.
43   virtual ReportParams GenerateAppActivityReport(
44       enterprise_management::ChildStatusReportRequest* report) = 0;
45 
46   // Clears the stored app activity older than |report_generation_timestamp|.
47   // Should be called when child status report was successfully submitted.
48   virtual void AppActivityReportSubmitted(
49       base::Time report_generation_timestamp) = 0;
50 };
51 
52 }  // namespace app_time
53 }  // namespace chromeos
54 
55 #endif  // CHROME_BROWSER_CHROMEOS_CHILD_ACCOUNTS_TIME_LIMITS_APP_ACTIVITY_REPORT_INTERFACE_H_
56