Commit 5c44bb70 authored by Andrei-Laurențiu Olteanu's avatar Andrei-Laurențiu Olteanu Committed by Commit Bot

[Telemetry SWX] Change events to const

Change SystemEventsProxy events property to const events.

Bug: b:167523716
Change-Id: I93d8068eee97aad9c9681140bd28d998b2089f7f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2450318
Commit-Queue: Laurențiu Olteanu <lolteanu@google.com>
Reviewed-by: default avatarMahmoud Gawad <mgawad@google.com>
Reviewed-by: default avatarOleh Lamzin <lamzin@google.com>
Cr-Commit-Position: refs/heads/master@{#814233}
parent 105f6744
......@@ -879,38 +879,41 @@ class SystemEventsProxy {
this.messagePipe = messagePipe;
this.iframeReady = iframeReady;
this.events = {
ON_BLUETOOTH_ADAPTER_ADDED: 'bluetooth-adapter-added',
ON_BLUETOOTH_ADAPTER_REMOVED: 'bluetooth-adapter-removed',
ON_BLUETOOTH_ADAPTER_PROPERTY_CHANGED:
'bluetooth-adapter-property-changed',
ON_BLUETOOTH_DEVICE_ADDED: 'bluetooth-device-added',
ON_BLUETOOTH_DEVICE_REMOVED: 'bluetooth-device-removed',
ON_BLUETOOTH_DEVICE_PROPERTY_CHANGED: 'bluetooth-device-property-changed',
ON_LID_CLOSED: 'lid-closed',
ON_LID_OPENED: 'lid-opened',
ON_AC_INSERTED: 'ac-inserted',
ON_AC_REMOVED: 'ac-removed',
ON_OS_SUSPEND: 'os-suspend',
ON_OS_RESUME: 'os-resume',
const events = {
// Bluetooth events
BLUETOOTH_ADAPTER_ADDED: 'bluetooth-adapter-added',
BLUETOOTH_ADAPTER_REMOVED: 'bluetooth-adapter-removed',
BLUETOOTH_ADAPTER_PROPERTY_CHANGED: 'bluetooth-adapter-property-changed',
BLUETOOTH_DEVICE_ADDED: 'bluetooth-device-added',
BLUETOOTH_DEVICE_REMOVED: 'bluetooth-device-removed',
BLUETOOTH_DEVICE_PROPERTY_CHANGED: 'bluetooth-device-property-changed',
// Lid events
LID_CLOSED: 'lid-closed',
LID_OPENED: 'lid-opened',
// Power events
AC_INSERTED: 'ac-inserted',
AC_REMOVED: 'ac-removed',
OS_SUSPEND: 'os-suspend',
OS_RESUME: 'os-resume',
};
this.bluetoothObserverCallbackRouter_ =
new chromeos.health.mojom.BluetoothObserverCallbackRouter();
this.bluetoothObserverCallbackRouter_.onAdapterAdded.addListener(
() => this.sendEvent(this.events.ON_BLUETOOTH_ADAPTER_ADDED));
() => this.sendEvent(events.BLUETOOTH_ADAPTER_ADDED));
this.bluetoothObserverCallbackRouter_.onAdapterRemoved.addListener(
() => this.sendEvent(this.events.ON_BLUETOOTH_ADAPTER_REMOVED));
() => this.sendEvent(events.BLUETOOTH_ADAPTER_REMOVED));
this.bluetoothObserverCallbackRouter_.onAdapterPropertyChanged.addListener(
() =>
this.sendEvent(this.events.ON_BLUETOOTH_ADAPTER_PROPERTY_CHANGED));
() => this.sendEvent(events.BLUETOOTH_ADAPTER_PROPERTY_CHANGED));
this.bluetoothObserverCallbackRouter_.onDeviceAdded.addListener(
() => this.sendEvent(this.events.ON_BLUETOOTH_DEVICE_ADDED));
() => this.sendEvent(events.BLUETOOTH_DEVICE_ADDED));
this.bluetoothObserverCallbackRouter_.onDeviceRemoved.addListener(
() => this.sendEvent(this.events.ON_BLUETOOTH_DEVICE_REMOVED));
() => this.sendEvent(events.BLUETOOTH_DEVICE_REMOVED));
this.bluetoothObserverCallbackRouter_.onDevicePropertyChanged.addListener(
() => this.sendEvent(this.events.ON_BLUETOOTH_DEVICE_PROPERTY_CHANGED));
() => this.sendEvent(events.BLUETOOTH_DEVICE_PROPERTY_CHANGED));
getOrCreateSystemEventsService().addBluetoothObserver(
this.bluetoothObserverCallbackRouter_.$.bindNewPipeAndPassRemote());
......@@ -919,9 +922,9 @@ class SystemEventsProxy {
new chromeos.health.mojom.LidObserverCallbackRouter();
this.lidObserverCallbackRouter_.onLidClosed.addListener(
() => this.sendEvent(this.events.ON_LID_CLOSED));
() => this.sendEvent(events.LID_CLOSED));
this.lidObserverCallbackRouter_.onLidOpened.addListener(
() => this.sendEvent(this.events.ON_LID_OPENED));
() => this.sendEvent(events.LID_OPENED));
getOrCreateSystemEventsService().addLidObserver(
this.lidObserverCallbackRouter_.$.bindNewPipeAndPassRemote());
......@@ -930,13 +933,13 @@ class SystemEventsProxy {
new chromeos.health.mojom.PowerObserverCallbackRouter();
this.powerObserverCallbackRouter_.onAcInserted.addListener(
() => this.sendEvent(this.events.ON_AC_INSERTED));
() => this.sendEvent(events.AC_INSERTED));
this.powerObserverCallbackRouter_.onAcRemoved.addListener(
() => this.sendEvent(this.events.ON_AC_REMOVED));
() => this.sendEvent(events.AC_REMOVED));
this.powerObserverCallbackRouter_.onOsSuspend.addListener(
() => this.sendEvent(this.events.ON_OS_SUSPEND));
() => this.sendEvent(events.OS_SUSPEND));
this.powerObserverCallbackRouter_.onOsResume.addListener(
() => this.sendEvent(this.events.ON_OS_RESUME));
() => this.sendEvent(events.OS_RESUME));
getOrCreateSystemEventsService().addPowerObserver(
this.powerObserverCallbackRouter_.$.bindNewPipeAndPassRemote());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment