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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..119564591c4b14ca81172f7c083dd77c8ca0092a |
| --- /dev/null |
| +++ b/chrome/browser/ui/webui/chromeos/emulator/device_emulator_message_handler.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#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 "content/public/browser/web_ui_message_handler.h" |
| + |
| +extern const char kBatteryPercentFunction[]; |
| +extern const char kUpdateBatteryPercentFunction[]; |
| +extern const char kUpdatePowerModeFunction[]; |
| +extern const char kBatteryPercentFunctionJSCallback[]; |
|
oshima
2015/06/25 20:02:15
do you need to expose these constants? Or can they
rfrappier
2015/06/25 21:43:24
They can be in the .cc file. I should probably put
rfrappier
2015/06/25 23:31:07
Done.
|
| + |
| +namespace base { |
| +class ListValue; |
| +} |
| + |
| +// Handler class for the Device Emulator page operations. |
| +class DeviceEmulatorMessageHandler : public content::WebUIMessageHandler { |
| + public: |
| + DeviceEmulatorMessageHandler(); |
| + ~DeviceEmulatorMessageHandler() override; |
| + |
| + // content::WebUIMessageHandler: |
| + void RegisterMessages() override; |
| + |
| + // Callback for the "requestBatteryInfo" message. This asynchronously |
| + // requests the emulator's battery percentage. |
| + void HandleRequestBatteryInfo(const base::ListValue* args); |
| + |
| + // Callback for the "updateBatteryInfo" message. This asynchronously |
| + // updates the emulator's battery percentage to a given percentage |
| + // contained in args. |
| + void HandleUpdateBatteryInfo(const base::ListValue* args); |
| + |
| + // Callback for the "updatePowerSource" message. This asynchronously |
| + // updates the emulator's power source based on the given parameter |
| + // in args. |
| + void HandleUpdatePowerSource(const base::ListValue* args); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(DeviceEmulatorMessageHandler); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_EMULATOR_DEVICE_EMULATOR_MESSAGE_HANDLER_H_ |