File: system_features_disable_list_policy_handler.h

package info (click to toggle)
chromium 138.0.7204.157-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,864 kB
  • sloc: cpp: 34,936,859; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,967; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (112 lines) | stat: -rw-r--r-- 4,662 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_POLICY_SYSTEM_FEATURES_DISABLE_LIST_POLICY_HANDLER_H_
#define CHROME_BROWSER_POLICY_SYSTEM_FEATURES_DISABLE_LIST_POLICY_HANDLER_H_

#include <memory>

#include "base/values.h"
#include "components/policy/core/browser/configuration_policy_handler.h"
#include "components/prefs/pref_service.h"

class PrefValueMap;

namespace policy {

// A system feature that can be disabled by SystemFeaturesDisableList policy.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class SystemFeature : int {
  kUnknownSystemFeature = 0,
  kCamera = 1,                // The camera chrome app on ChromeOS.
  kBrowserSettings = 2,       // Browser settings.
  kOsSettings = 3,            // The settings feature on ChromeOS.
  kScanning = 4,              // The scan SWA on ChromeOS.
  kWebStore = 5,              // The web store chrome app on ChromeOS.
  kCanvas = 6,                // The canvas web app on ChromeOS.
  kGoogleNewsDeprecated = 7,  // The Google news app is no longer supported.
  kExplore = 8,               // The explore web app on ChromeOS.
  kCrosh = 9,                 // The ChromeOS shell.
  kTerminal = 10,             // The terminal client web app on ChromeOS.
  kGallery = 11,              // The gallery web app on ChromeOS.
  kPrintJobs = 12,            // The print jobs app on ChromeOS.
  kKeyShortcuts = 13,         // The Key Shortcuts app on ChromeOS.
  kRecorder = 14,             // The recorder app on ChromeOS.
  kGmail = 15,                // The Google Gmail app on ChromeOS.
  kGoogleDocs = 16,           // The Google Docs app on ChromeOS.
  kGoogleSlides = 17,         // The Google Slides app on ChromeOS.
  kGoogleSheets = 18,         // The Google Sheets app on ChromeOS.
  kGoogleDrive = 19,          // The Google Drive app on ChromeOS.
  kGoogleKeep = 20,           // The Google Keep app on ChromeOS.
  kGoogleCalendar = 21,       // The Google Calendar app on ChromeOS.
  kGoogleChat = 22,           // The Google Chat app on ChromeOS.
  kYoutube = 23,              // The Youtube app on ChromeOS.
  kGoogleMaps = 24,           // The Google Maps app on ChromeOS.
  kCalculator = 25,           // The Calculator app on ChromeOS.
  kTextEditor = 26,           // The Text Editor app on ChromeOS.
  kMaxValue = kTextEditor,
};

// A disabling mode that decides the user experience when a system feature is
// added into SystemFeaturesDisableList policy.
enum class SystemFeatureDisableMode {
  kUnknownDisableMode = 0,
  kBlocked = 1,  // The disabled feature is blocked.
  kHidden = 2,   // The disabled feature is blocked and hidden.
  kMaxValue = kHidden
};

extern const char kCameraFeature[];
extern const char kBrowserSettingsFeature[];
extern const char kOsSettingsFeature[];
extern const char kScanningFeature[];
extern const char kWebStoreFeature[];
extern const char kCanvasFeature[];
extern const char kExploreFeature[];
extern const char kCroshFeature[];
extern const char kTerminalFeature[];
extern const char kGalleryFeature[];
extern const char kPrintJobsFeature[];
extern const char kKeyShortcutsFeature[];
extern const char kRecorderFeature[];
extern const char kGmailFeature[];
extern const char kGoogleDocsFeature[];
extern const char kGoogleSlidesFeature[];
extern const char kGoogleSheetsFeature[];
extern const char kGoogleDriveFeature[];
extern const char kGoogleKeepFeature[];
extern const char kGoogleCalendarFeature[];
extern const char kGoogleChatFeature[];
extern const char kYoutubeFeature[];
extern const char kGoogleMapsFeature[];
extern const char kCalculatorFeature[];
extern const char kTextEditorFeature[];

extern const char kBlockedDisableMode[];
extern const char kHiddenDisableMode[];

extern const char kSystemFeaturesDisableListHistogram[];

class SystemFeaturesDisableListPolicyHandler
    : public policy::ListPolicyHandler {
 public:
  SystemFeaturesDisableListPolicyHandler();
  ~SystemFeaturesDisableListPolicyHandler() override;

  static SystemFeature GetSystemFeatureFromAppId(const std::string& app_id);
  static bool IsSystemFeatureDisabled(SystemFeature feature,
                                      PrefService* const pref_service);

 protected:
  // ListPolicyHandler:
  void ApplyList(base::Value::List filtered_list, PrefValueMap* prefs) override;

 private:
  SystemFeature ConvertToEnum(const std::string& system_feature);
};

}  // namespace policy

#endif  // CHROME_BROWSER_POLICY_SYSTEM_FEATURES_DISABLE_LIST_POLICY_HANDLER_H_