File: chrome_browser_cloud_management_controller_desktop.h

package info (click to toggle)
chromium 140.0.7339.127-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,192,880 kB
  • sloc: cpp: 35,093,808; ansic: 7,161,670; javascript: 4,199,694; python: 1,441,797; asm: 949,904; xml: 747,503; pascal: 187,748; perl: 88,691; sh: 88,248; objc: 79,953; sql: 52,714; cs: 44,599; fortran: 24,137; makefile: 22,114; tcl: 15,277; php: 13,980; yacc: 9,000; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (118 lines) | stat: -rw-r--r-- 5,136 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
112
113
114
115
116
117
118
// 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_CHROME_BROWSER_CLOUD_MANAGEMENT_CONTROLLER_DESKTOP_H_
#define CHROME_BROWSER_POLICY_CHROME_BROWSER_CLOUD_MANAGEMENT_CONTROLLER_DESKTOP_H_

#include <stdint.h>

#include <map>
#include <vector>

#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/policy/cbcm_invalidations_initializer.h"
#include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h"
#include "components/enterprise/client_certificates/core/prefs_certificate_store.h"

namespace instance_id {
class InstanceIDDriver;
}

namespace invalidation {
class InvalidationListener;
class LegacyTopicsCleaner;
}  // namespace invalidation

namespace policy {
class ChromeBrowserCloudManagementRegisterWatcher;
class CloudPolicyInvalidator;
class FmRegistrationTokenUploader;
class RemoteCommandsInvalidator;

// Desktop implementation of the platform-specific operations of CBCMController.
class ChromeBrowserCloudManagementControllerDesktop
    : public ChromeBrowserCloudManagementController::Delegate,
      public CBCMInvalidationsInitializer::Delegate {
 public:
  ChromeBrowserCloudManagementControllerDesktop();
  ChromeBrowserCloudManagementControllerDesktop(
      const ChromeBrowserCloudManagementControllerDesktop&) = delete;
  ChromeBrowserCloudManagementControllerDesktop& operator=(
      const ChromeBrowserCloudManagementControllerDesktop&) = delete;

  ~ChromeBrowserCloudManagementControllerDesktop() override;

  // ChromeBrowserCloudManagementController::Delegate implementation.
  void SetDMTokenStorageDelegate() override;
  int GetUserDataDirKey() override;
  base::FilePath GetExternalPolicyDir() override;
  NetworkConnectionTrackerGetter CreateNetworkConnectionTrackerGetter()
      override;
  // TODO(crbug.com/341377023): `InvalidationListener` does not use
  // `DeviceIdentityProvider` and does not need
  // `DeviceOAuth2TokenServiceFactory`. Check if any other service needs the
  // factory inialialized.
  void InitializeOAuthTokenFactory(
      scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
      PrefService* local_state) override;
  void StartWatchingRegistration(
      ChromeBrowserCloudManagementController* controller) override;
  bool WaitUntilPolicyEnrollmentFinished() override;
  bool IsEnterpriseStartupDialogShowing() override;
  void OnServiceAccountSet(CloudPolicyClient* client,
                           const std::string& account_email) override;
  void ShutDown() override;
  MachineLevelUserCloudPolicyManager* GetMachineLevelUserCloudPolicyManager()
      override;
  DeviceManagementService* GetDeviceManagementService() override;
  scoped_refptr<network::SharedURLLoaderFactory> GetSharedURLLoaderFactory()
      override;
  scoped_refptr<base::SingleThreadTaskRunner> GetBestEffortTaskRunner()
      override;
  std::unique_ptr<enterprise_reporting::ReportingDelegateFactory>
  GetReportingDelegateFactory() override;
  void SetGaiaURLLoaderFactory(scoped_refptr<network::SharedURLLoaderFactory>
                                   url_loader_factory) override;
  bool ReadyToCreatePolicyManager() override;
  bool ReadyToInit() override;
  std::unique_ptr<ClientDataDelegate> CreateClientDataDelegate() override;
  std::unique_ptr<enterprise_connectors::DeviceTrustKeyManager>
  CreateDeviceTrustKeyManager() override;
  std::unique_ptr<client_certificates::CertificateProvisioningService>
  CreateCertificateProvisioningService() override;

  // CBCMInvalidationsInitializer::Delegate:
  // Starts the services required for Policy Invalidations over FCM to be
  // enabled.
  void StartInvalidations() override;
  scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
  bool IsInvalidationsServiceStarted() const override;

 private:
  std::unique_ptr<ChromeBrowserCloudManagementRegisterWatcher>
      cloud_management_register_watcher_;

  // These objects are all involved in Policy Invalidations.
  CBCMInvalidationsInitializer invalidations_initializer_;
  scoped_refptr<network::SharedURLLoaderFactory> gaia_url_loader_factory_;
  std::unique_ptr<instance_id::InstanceIDDriver> device_instance_id_driver_;
  std::map<int64_t, std::unique_ptr<invalidation::InvalidationListener>>
      invalidation_listener_per_project_;
  std::unique_ptr<CloudPolicyInvalidator> policy_invalidator_;
  std::vector<std::unique_ptr<FmRegistrationTokenUploader>>
      fm_registration_token_uploaders_;

  // This invalidator is responsible for receiving remote commands invalidations
  std::unique_ptr<RemoteCommandsInvalidator> commands_invalidator_;

  // Responsible for storing and retrieving browser-level managed identities.
  std::unique_ptr<client_certificates::CertificateStore> certificate_store_;

  // Unsubscribes any remaining invalidation topics.
  std::unique_ptr<invalidation::LegacyTopicsCleaner> legacy_topics_cleaner_;
};

}  // namespace policy

#endif  // CHROME_BROWSER_POLICY_CHROME_BROWSER_CLOUD_MANAGEMENT_CONTROLLER_DESKTOP_H_