File: crosapi_ash.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 (285 lines) | stat: -rw-r--r-- 11,178 bytes parent folder | download | duplicates (2)
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
// 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_ASH_CROSAPI_CROSAPI_ASH_H_
#define CHROME_BROWSER_ASH_CROSAPI_CROSAPI_ASH_H_

#include <map>
#include <memory>

#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/ash/crosapi/crosapi_id.h"
#include "chromeos/crosapi/mojom/cros_display_config.mojom.h"
#include "chromeos/crosapi/mojom/crosapi.mojom.h"
#include "chromeos/crosapi/mojom/magic_boost.mojom-forward.h"
#include "chromeos/crosapi/mojom/mahi.mojom-forward.h"
#include "chromeos/crosapi/mojom/print_preview_cros.mojom-forward.h"
#include "chromeos/crosapi/mojom/telemetry_diagnostic_routine_service.mojom.h"
#include "media/gpu/buildflags.h"
#include "mojo/public/cpp/bindings/generic_pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "printing/buildflags/buildflags.h"

namespace ash {
class DiagnosticsServiceAsh;
class ProbeServiceAsh;
class TelemetryDiagnosticsRoutineServiceAsh;
class TelemetryEventServiceAsh;
class TelemetryManagementServiceAsh;
class VideoConferenceManagerAsh;

namespace auth {
class InSessionAuth;
}  // namespace auth

namespace printing {
class PrintPreviewWebcontentsAdapterAsh;
}  // namespace printing

}  // namespace ash

namespace crosapi {

class CertProvisioningAsh;
class ChapsServiceAsh;
class DeviceAttributesAsh;
class DeviceOAuth2TokenServiceAsh;
class DocumentScanAsh;
class FileSystemAccessCloudIdentifierProviderAsh;
class FileSystemProviderServiceAsh;
class FullscreenControllerAsh;
class KeystoreServiceAsh;
class KioskSessionServiceAsh;
class LocalPrinterAsh;
class LoginAsh;
class LoginStateAsh;
class MediaUIAsh;
class MultiCaptureServiceAsh;
class NetworkingAttributesAsh;
class ParentAccessAsh;
class StructuredMetricsServiceAsh;
class VpnServiceAsh;

// Implementation of Crosapi in Ash. It provides a set of APIs that
// crosapi clients, such as lacros-chrome, can call into.
class CrosapiAsh : public mojom::Crosapi {
 public:
  CrosapiAsh();
  ~CrosapiAsh() override;

  // Binds the given receiver to this instance.
  // |disconnected_handler| is called on the connection lost.
  void BindReceiver(mojo::PendingReceiver<mojom::Crosapi> pending_receiver,
                    CrosapiId crosapi_id,
                    base::OnceClosure disconnect_handler);

  // crosapi::mojom::Crosapi:
  void BindAccountManager(
      mojo::PendingReceiver<mojom::AccountManager> receiver) override;
  void BindBrowserCdmFactory(mojo::GenericPendingReceiver receiver) override;
  void BindCertProvisioning(
      mojo::PendingReceiver<mojom::CertProvisioning> receiver) override;
  void BindCfmServiceContext(
      mojo::PendingReceiver<chromeos::cfm::mojom::CfmServiceContext> receiver)
      override;
  void BindChapsService(
      mojo::PendingReceiver<mojom::ChapsService> receiver) override;
  void BindCrosDisplayConfigController(
      mojo::PendingReceiver<mojom::CrosDisplayConfigController> receiver)
      override;
  void BindDeviceAttributes(
      mojo::PendingReceiver<mojom::DeviceAttributes> receiver) override;
  void BindDeviceOAuth2TokenService(
      mojo::PendingReceiver<mojom::DeviceOAuth2TokenService> receiver) override;
  void BindDiagnosticsService(
      mojo::PendingReceiver<mojom::DiagnosticsService> receiver) override;
  void BindDocumentScan(
      mojo::PendingReceiver<mojom::DocumentScan> receiver) override;
  void BindFileSystemAccessCloudIdentifierProvider(
      mojo::PendingReceiver<mojom::FileSystemAccessCloudIdentifierProvider>
          receiver) override;
  void BindFullscreenController(
      mojo::PendingReceiver<mojom::FullscreenController> receiver) override;
  void BindHidManager(
      mojo::PendingReceiver<device::mojom::HidManager> receiver) override;
  void BindInSessionAuth(
      mojo::PendingReceiver<chromeos::auth::mojom::InSessionAuth> receiver)
      override;
  void BindKeystoreService(
      mojo::PendingReceiver<mojom::KeystoreService> receiver) override;
  void BindKioskSessionService(
      mojo::PendingReceiver<mojom::KioskSessionService> receiver) override;
  void BindLocalPrinter(
      mojo::PendingReceiver<mojom::LocalPrinter> receiver) override;
  void BindLogin(mojo::PendingReceiver<mojom::Login> receiver) override;
  void BindLoginState(
      mojo::PendingReceiver<mojom::LoginState> receiver) override;
  void BindMachineLearningService(
      mojo::PendingReceiver<
          chromeos::machine_learning::mojom::MachineLearningService> receiver)
      override;
  void BindMediaUI(mojo::PendingReceiver<mojom::MediaUI> receiver) override;
  void BindMediaSessionAudioFocus(
      mojo::PendingReceiver<media_session::mojom::AudioFocusManager> receiver)
      override;
  void BindMediaSessionAudioFocusDebug(
      mojo::PendingReceiver<media_session::mojom::AudioFocusManagerDebug>
          receiver) override;
  void BindMediaSessionController(
      mojo::PendingReceiver<media_session::mojom::MediaControllerManager>
          receiver) override;
  void BindMultiCaptureService(
      mojo::PendingReceiver<mojom::MultiCaptureService> receiver) override;
  void BindNetworkChange(
      mojo::PendingReceiver<mojom::NetworkChange> receiver) override;
  void BindNetworkingAttributes(
      mojo::PendingReceiver<mojom::NetworkingAttributes> receiver) override;
  void BindParentAccess(
      mojo::PendingReceiver<mojom::ParentAccess> receiver) override;
  void BindPrintPreviewCrosDelegate(
      mojo::PendingReceiver<mojom::PrintPreviewCrosDelegate> receiver) override;
  void BindRemoteAppsLacrosBridge(
      mojo::PendingReceiver<
          chromeos::remote_apps::mojom::RemoteAppsLacrosBridge> receiver)
      override;
  void BindSensorHalClient(
      mojo::PendingRemote<chromeos::sensors::mojom::SensorHalClient> remote)
      override;
  void BindStructuredMetricsService(
      ::mojo::PendingReceiver<::crosapi::mojom::StructuredMetricsService>
          receiver) override;
  void BindTelemetryDiagnosticRoutinesService(
      mojo::PendingReceiver<mojom::TelemetryDiagnosticRoutinesService> receiver)
      override;
  void BindTelemetryEventService(
      mojo::PendingReceiver<mojom::TelemetryEventService> receiver) override;
  void BindTelemetryManagementService(
      mojo::PendingReceiver<mojom::TelemetryManagementService> receiver)
      override;
  void BindTelemetryProbeService(
      mojo::PendingReceiver<mojom::TelemetryProbeService> receiver) override;
  void BindVideoCaptureDeviceFactory(
      mojo::PendingReceiver<mojom::VideoCaptureDeviceFactory> receiver)
      override;
  void BindVpnService(
      mojo::PendingReceiver<mojom::VpnService> receiver) override;
  void BindGuestOsSkForwarderFactory(
      mojo::PendingReceiver<mojom::GuestOsSkForwarderFactory> receiver)
      override;

  CertProvisioningAsh* cert_provisioning_ash() {
    return cert_provisioning_ash_.get();
  }

  ChapsServiceAsh* chaps_service_ash() { return chaps_service_ash_.get(); }

  DeviceAttributesAsh* device_attributes_ash() {
    return device_attributes_ash_.get();
  }

  DocumentScanAsh* document_scan_ash() { return document_scan_ash_.get(); }

  FileSystemAccessCloudIdentifierProviderAsh*
  file_system_access_cloud_identifier_provider_ash() {
    return file_system_access_cloud_identifier_provider_ash_.get();
  }

  FileSystemProviderServiceAsh* file_system_provider_service_ash() {
    return file_system_provider_service_ash_.get();
  }

  FullscreenControllerAsh* fullscreen_controller_ash() {
    return fullscreen_controller_ash_.get();
  }

  KeystoreServiceAsh* keystore_service_ash() {
    return keystore_service_ash_.get();
  }

  KioskSessionServiceAsh* kiosk_session_service() {
    return kiosk_session_service_ash_.get();
  }

  LocalPrinterAsh* local_printer_ash() { return local_printer_ash_.get(); }

  LoginAsh* login_ash() { return login_ash_.get(); }

  LoginStateAsh* login_state_ash() { return login_state_ash_.get(); }

  MediaUIAsh* media_ui_ash() { return media_ui_ash_.get(); }

  MultiCaptureServiceAsh* multi_capture_service_ash() {
    return multi_capture_service_ash_.get();
  }

  NetworkingAttributesAsh* networking_attributes_ash() {
    return networking_attributes_ash_.get();
  }

  ParentAccessAsh* parent_access_ash() { return parent_access_ash_.get(); }

  ash::printing::PrintPreviewWebcontentsAdapterAsh*
  print_preview_webcontents_adapter_ash() {
    return print_preview_webcontents_adapter_ash_.get();
  }

  ash::ProbeServiceAsh* probe_service_ash() { return probe_service_ash_.get(); }

  StructuredMetricsServiceAsh* structured_metrics_service_ash() {
    return structured_metrics_service_ash_.get();
  }

  ash::VideoConferenceManagerAsh* video_conference_manager_ash() {
    return video_conference_manager_ash_.get();
  }

  VpnServiceAsh* vpn_service_ash() { return vpn_service_ash_.get(); }

 private:
  // Called when a connection is lost.
  void OnDisconnected();

  std::unique_ptr<CertProvisioningAsh> cert_provisioning_ash_;
  std::unique_ptr<ChapsServiceAsh> chaps_service_ash_;
  std::unique_ptr<DeviceAttributesAsh> device_attributes_ash_;
  std::unique_ptr<DeviceOAuth2TokenServiceAsh> device_oauth2_token_service_ash_;
  std::unique_ptr<ash::DiagnosticsServiceAsh> diagnostics_service_ash_;
  std::unique_ptr<DocumentScanAsh> document_scan_ash_;
  std::unique_ptr<FileSystemAccessCloudIdentifierProviderAsh>
      file_system_access_cloud_identifier_provider_ash_;
  std::unique_ptr<FileSystemProviderServiceAsh>
      file_system_provider_service_ash_;
  std::unique_ptr<FullscreenControllerAsh> fullscreen_controller_ash_;
  std::unique_ptr<KeystoreServiceAsh> keystore_service_ash_;
  std::unique_ptr<KioskSessionServiceAsh> kiosk_session_service_ash_;
  std::unique_ptr<LocalPrinterAsh> local_printer_ash_;
  std::unique_ptr<LoginAsh> login_ash_;
  std::unique_ptr<LoginStateAsh> login_state_ash_;
  std::unique_ptr<MediaUIAsh> media_ui_ash_;
  std::unique_ptr<MultiCaptureServiceAsh> multi_capture_service_ash_;
  std::unique_ptr<NetworkingAttributesAsh> networking_attributes_ash_;
  std::unique_ptr<ParentAccessAsh> parent_access_ash_;
  std::unique_ptr<ash::TelemetryDiagnosticsRoutineServiceAsh>
      telemetry_diagnostic_routine_service_ash_;
  std::unique_ptr<ash::TelemetryEventServiceAsh> telemetry_event_service_ash_;
  std::unique_ptr<ash::TelemetryManagementServiceAsh>
      telemetry_management_service_ash_;
  std::unique_ptr<ash::ProbeServiceAsh> probe_service_ash_;
  std::unique_ptr<ash::printing::PrintPreviewWebcontentsAdapterAsh>
      print_preview_webcontents_adapter_ash_;
  std::unique_ptr<StructuredMetricsServiceAsh> structured_metrics_service_ash_;
  std::unique_ptr<ash::VideoConferenceManagerAsh> video_conference_manager_ash_;
  std::unique_ptr<VpnServiceAsh> vpn_service_ash_;

  mojo::ReceiverSet<mojom::Crosapi, CrosapiId> receiver_set_;
  std::map<mojo::ReceiverId, base::OnceClosure> disconnect_handler_map_;

  base::WeakPtrFactory<CrosapiAsh> weak_factory_{this};
};

}  // namespace crosapi

#endif  // CHROME_BROWSER_ASH_CROSAPI_CROSAPI_ASH_H_