#ifndef ASH_SYSTEM_BLUETOOTH_BLUETOOTH_STATE_CACHE_H_
#define ASH_SYSTEM_BLUETOOTH_BLUETOOTH_STATE_CACHE_H_
#include "ash/ash_export.h"
#include "chromeos/ash/services/bluetooth_config/public/mojom/cros_bluetooth_config.mojom.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace ash {
class ASH_EXPORT BluetoothStateCache
: public bluetooth_config::mojom::SystemPropertiesObserver {
public:
BluetoothStateCache();
BluetoothStateCache(const BluetoothStateCache&) = delete;
BluetoothStateCache& operator=(const BluetoothStateCache&) = delete;
~BluetoothStateCache() override;
bluetooth_config::mojom::BluetoothSystemState system_state() {
return system_state_;
}
private:
void BindToCrosBluetoothConfig();
void OnPropertiesUpdated(bluetooth_config::mojom::BluetoothSystemPropertiesPtr
properties) override;
mojo::Remote<bluetooth_config::mojom::CrosBluetoothConfig>
remote_cros_bluetooth_config_;
mojo::Receiver<bluetooth_config::mojom::SystemPropertiesObserver>
system_properties_observer_receiver_{this};
bluetooth_config::mojom::BluetoothSystemState system_state_ =
bluetooth_config::mojom::BluetoothSystemState::kEnabled;
base::WeakPtrFactory<BluetoothStateCache> weak_ptr_factory_{this};
};
}
#endif