1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_DEVICE_SETTINGS_DELEGATE_H_
6 #define CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_DEVICE_SETTINGS_DELEGATE_H_
7 
8 #include <memory>
9 #include <string>
10 #include <vector>
11 
12 #include "base/component_export.h"
13 
14 namespace assistant {
15 namespace api {
16 namespace client_op {
17 class ModifySettingArgs;
18 class GetDeviceSettingsArgs;
19 }  // namespace client_op
20 }  // namespace api
21 }  // namespace assistant
22 
23 namespace chromeos {
24 namespace assistant {
25 
26 struct DeviceSetting;
27 class ServiceContext;
28 class Setting;
29 
30 // Delegate that handles Assistant actions related to retrieving/modifying
31 // the device settings, like Bluetooth or WiFi.
COMPONENT_EXPORT(ASSISTANT_SERVICE)32 class COMPONENT_EXPORT(ASSISTANT_SERVICE) AssistantDeviceSettingsDelegate {
33  public:
34   explicit AssistantDeviceSettingsDelegate(ServiceContext* context);
35   AssistantDeviceSettingsDelegate(AssistantDeviceSettingsDelegate&) = delete;
36   AssistantDeviceSettingsDelegate& operator=(AssistantDeviceSettingsDelegate&) =
37       delete;
38   ~AssistantDeviceSettingsDelegate();
39 
40   bool IsSettingSupported(const std::string& setting_id) const;
41 
42   void HandleModifyDeviceSetting(
43       const ::assistant::api::client_op::ModifySettingArgs& args);
44 
45   // Return which of the given device settings are supported or not.
46   std::vector<DeviceSetting> GetDeviceSettings(
47       const ::assistant::api::client_op::GetDeviceSettingsArgs& args) const;
48 
49  private:
50   void AddSetting(std::unique_ptr<Setting> setting);
51 
52   std::vector<std::unique_ptr<Setting>> settings_;
53 };
54 
55 }  // namespace assistant
56 }  // namespace chromeos
57 
58 #endif  // CHROMEOS_SERVICES_ASSISTANT_ASSISTANT_DEVICE_SETTINGS_DELEGATE_H_
59