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_POLICY_SYSTEM_FEATURES_DISABLE_LIST_POLICY_HANDLER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_FEATURES_DISABLE_LIST_POLICY_HANDLER_H_
7 
8 #include <memory>
9 
10 #include "base/values.h"
11 #include "components/policy/core/browser/configuration_policy_handler.h"
12 
13 class PrefValueMap;
14 class PrefRegistrySimple;
15 
16 namespace policy {
17 
18 // A system feature that can be disabled by SystemFeaturesDisableList policy.
19 // These values are persisted to logs. Entries should not be renumbered and
20 // numeric values should never be reused.
21 enum SystemFeature {
22   UNKNOWN_SYSTEM_FEATURE = 0,
23   CAMERA = 1,            // The camera chrome app on Chrome OS.
24   BROWSER_SETTINGS = 2,  // Browser settings.
25   OS_SETTINGS = 3,       // The settings feature on Chrome OS.
26   SCANNING = 4,          // The scan SWA on Chrome OS.
27   kMaxValue = SCANNING
28 };
29 
30 extern const char kCameraFeature[];
31 extern const char kBrowserSettingsFeature[];
32 extern const char kOsSettingsFeature[];
33 extern const char kScanningFeature[];
34 
35 extern const char kSystemFeaturesDisableListHistogram[];
36 
37 class SystemFeaturesDisableListPolicyHandler
38     : public policy::ListPolicyHandler {
39  public:
40   SystemFeaturesDisableListPolicyHandler();
41   ~SystemFeaturesDisableListPolicyHandler() override;
42 
43   static void RegisterPrefs(PrefRegistrySimple* registry);
44 
45  protected:
46   // ListPolicyHandler:
47   void ApplyList(base::Value filtered_list, PrefValueMap* prefs) override;
48 
49  private:
50   SystemFeature ConvertToEnum(const std::string& system_feature);
51 };
52 
53 }  // namespace policy
54 
55 #endif  // CHROME_BROWSER_CHROMEOS_POLICY_SYSTEM_FEATURES_DISABLE_LIST_POLICY_HANDLER_H_
56