File: management_ui_handler_chromeos.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; 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 (111 lines) | stat: -rw-r--r-- 4,398 bytes parent folder | download | duplicates (4)
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
// Copyright 2019 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_UI_WEBUI_MANAGEMENT_MANAGEMENT_UI_HANDLER_CHROMEOS_H_
#define CHROME_BROWSER_UI_WEBUI_MANAGEMENT_MANAGEMENT_UI_HANDLER_CHROMEOS_H_

#include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
#include "chrome/browser/ui/webui/management/management_ui_handler.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "url/gurl.h"

namespace policy {
class DeviceCloudPolicyManagerAsh;
class StatusCollector;
class SystemLogUploader;
}  // namespace policy

namespace ash {
class SecureDnsManager;
}

class ManagementUIHandlerChromeOS : public BitmapFetcherDelegate,
                                    public ManagementUIHandler {
 public:
  explicit ManagementUIHandlerChromeOS(Profile* profile);
  ManagementUIHandlerChromeOS(const ManagementUIHandlerChromeOS&) = delete;
  ManagementUIHandlerChromeOS& operator=(const ManagementUIHandlerChromeOS&) =
      delete;
  ~ManagementUIHandlerChromeOS() override;

  // ManagementUIHandler
  void RegisterMessages() override;

  // Returns the list of device reporting items for a given profile.
  static base::Value::List GetDeviceReportingInfo(
      const policy::DeviceCloudPolicyManagerAsh* manager,
      Profile* profile);
  static void AddDlpDeviceReportingElementForTesting(
      base::Value::List* report_sources,
      const std::string& message_id);
  static void AddDeviceReportingInfoForTesting(
      base::Value::List* report_sources,
      const policy::StatusCollector* collector,
      const policy::SystemLogUploader* uploader,
      Profile* profile);

  void SetDeviceManagedForTesting(bool managed) { device_managed_ = managed; }

 protected:
  virtual const policy::DeviceCloudPolicyManagerAsh*
  GetDeviceCloudPolicyManager() const;
  // Virtual for testing
  virtual const std::string GetDeviceManager() const;
  virtual bool IsUpdateRequiredEol() const;
  // Adds device return instructions for a managed user as an update is required
  // as per device policy but the device cannot be updated due to End of Life
  // (Auto Update Expiration).
  void AddUpdateRequiredEolInfo(base::Value::Dict* response) const;
  // Adds a boolean which indicates if the network traffic can be monitored by
  // the admin via policy configurations, either via a proxy server, via
  // secure DNS templates with identifiers, or via XDR monitoring. If true, a
  // warning will be added to the transparency panel to inform the user that the
  // admin may be able to see their network traffic.
  void AddMonitoredNetworkPrivacyDisclosure(base::Value::Dict* response);
  // Adds flags indicating whether Desk Sync feature is active for windows
  // and/or cookies. If at least one of them is true, a dedicated section will
  // be added to inform the user that their data is being synced across their
  // ChromeOS devices.
  void AddDeskSyncNotice(Profile* profile, base::Value::Dict* response);

  // ManagementUIHandler
  void RegisterPrefChange(PrefChangeRegistrar& pref_registrar) override;

  std::u16string GetFilesUploadToCloudInfo(Profile* profile);

  virtual const ash::SecureDnsManager* GetSecureDnsManager() const;

  base::Value::Dict GetContextualManagedData(Profile* profile) override;

  // ManagementUIHandler
  bool managed() const override;
  void UpdateManagedState() override;
  bool UpdateDeviceManagedState();

 private:
  void AsyncUpdateLogo();

  // BitmapFetcherDelegate
  void OnFetchComplete(const GURL& url, const SkBitmap* bitmap) override;

  void NotifyPluginVmDataCollectionUpdated();

  void GetManagementStatus(Profile* profile, base::Value::Dict* status) const;

  void HandleGetLocalTrustRootsInfo(const base::Value::List& args);
  void HandleGetFilesUploadToCloudInfo(const base::Value::List& args);
  void HandleGetDeviceReportingInfo(const base::Value::List& args);
  void HandleGetPluginVmDataCollectionStatus(const base::Value::List& args);

  void CheckGetAllScreensMediaAllowedForAnyOriginResultReceived(
      bool is_allowed);
  bool device_managed_ = false;

  GURL logo_url_;
  std::string fetched_image_;
  std::unique_ptr<BitmapFetcher> icon_fetcher_;

  base::WeakPtrFactory<ManagementUIHandlerChromeOS> weak_factory_{this};
};
#endif  // CHROME_BROWSER_UI_WEBUI_MANAGEMENT_MANAGEMENT_UI_HANDLER_CHROMEOS_H_