Chromium Code Reviews| Index: chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h |
| diff --git a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h |
| index e56c87f54c0badf71ff5923c89ae0b1fec90ef51..e5cc97b05be3d01086fd3c90e426fc895512abe8 100644 |
| --- a/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h |
| +++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h |
| @@ -5,6 +5,7 @@ |
| #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_EMULATOR_DEVICE_EMULATOR_MESSAGE_HANDLER_H_ |
| #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_EMULATOR_DEVICE_EMULATOR_MESSAGE_HANDLER_H_ |
| +#include "chromeos/dbus/fake_bluetooth_device_client.h" |
| #include "chromeos/dbus/fake_power_manager_client.h" |
| #include "chromeos/dbus/power_manager/power_supply_properties.pb.h" |
| #include "content/public/browser/web_ui_message_handler.h" |
| @@ -15,15 +16,18 @@ class ListValue; |
| // Handler class for the Device Emulator page operations. |
| class DeviceEmulatorMessageHandler |
| - : public content::WebUIMessageHandler, |
| - public chromeos::PowerManagerClient::Observer { |
| + : public chromeos::BluetoothDeviceClient::Observer, |
| + public chromeos::PowerManagerClient::Observer, |
|
stevenjb
2015/07/30 18:28:51
We should put this entire class in namespace chrom
rfrappier
2015/07/30 22:21:39
Done.
|
| + public content::WebUIMessageHandler { |
| public: |
| DeviceEmulatorMessageHandler(); |
| ~DeviceEmulatorMessageHandler() override; |
| - // Callbacks for JS request methods. All these methods work |
| - // asynchronously. |
| - void RequestPowerInfo(const base::ListValue* args); |
| + // chromeos::FakeBluetoothDeviceClient::BluetoothDeviceClient. |
|
xiyuan
2015/07/30 17:21:22
chromeos::BluetoothDeviceClient::Observer?
rfrappier
2015/07/30 22:21:39
Whoops, don't know where that came from! Fixed.
|
| + void DeviceAdded(const dbus::ObjectPath& object_path) override; |
|
stevenjb
2015/07/30 18:28:51
What about DeviceRemoved?
Also, FWIW, rather than
rfrappier
2015/07/30 22:21:39
Done.
|
| + |
| + // Adds |this| as an observer to all necessary objects. |
| + void Init(); |
| // Callback for the "requestBluetoothDiscover" message. This asynchronously |
| // requests for the system to discover a certain device. The device's data |
| @@ -31,6 +35,10 @@ class DeviceEmulatorMessageHandler |
| // already exist, then it will be created and attached to the main adapter. |
| void HandleRequestBluetoothDiscover(const base::ListValue* args); |
| + // Callback for the "requestBluetoothInfo" message. This asynchronously |
| + // requests for the devices which are already paired with the device. |
| + void HandleRequestBluetoothInfo(const base::ListValue* args); |
| + |
| // Callback for the "requestBluetoothPair" message. This asynchronously |
| // requests for the system to pair a certain device. The device's data should |
| // be passed into |args| as a dictionary. If the device does not already |
| @@ -44,18 +52,30 @@ class DeviceEmulatorMessageHandler |
| void UpdateTimeToEmpty(const base::ListValue* args); |
| void UpdateTimeToFull(const base::ListValue* args); |
| - // Adds |this| as an observer to all necessary objects. |
| - void Init(); |
| - |
| // chromeos::PowerManagerClient::Observer: |
| void PowerChanged(const power_manager::PowerSupplyProperties& proto) override; |
| // content::WebUIMessageHandler: |
| void RegisterMessages() override; |
| + // Callbacks for JS request methods. All these methods work |
| + // asynchronously. |
| + void RequestPowerInfo(const base::ListValue* args); |
| + |
| private: |
| + chromeos::FakeBluetoothDeviceClient* fake_bluetooth_device_client_; |
| chromeos::FakePowerManagerClient* fake_power_manager_client_; |
| + // Creates a bluetooth device with the properties given in |args|. |args| |
| + // should contain a dictionary so that each dictionary value can be mapped |
| + // to its respective property upon creating the device. |
| + std::string CreateBluetoothDeviceFromListValue(const base::ListValue* args); |
|
xiyuan
2015/07/30 17:21:22
nit: document what's is returned.
rfrappier
2015/07/30 22:21:39
Done.
|
| + |
| + // Builds a dictionary with each key representing a property of the device |
| + // with path |object_path|. |
| + scoped_ptr<base::DictionaryValue> GetDeviceInfo( |
| + const dbus::ObjectPath& object_path); |
| + |
| DISALLOW_COPY_AND_ASSIGN(DeviceEmulatorMessageHandler); |
| }; |