b4e69b509fa75e6f120515b7a1c924459f45c7e3
[platform/framework/web/crosswalk-tizen.git] /
1 // Copyright 2017 Samsung Electronics. 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 BASE_EXTERNAL_DEVICE_EXTERNAL_INPUT_DEVICE_CONTROLLER_TIZEN_H_
6 #define BASE_EXTERNAL_DEVICE_EXTERNAL_INPUT_DEVICE_CONTROLLER_TIZEN_H_
7
8 #include <Ecore_Input.h>
9 #include <Ecore_Wayland.h>
10
11 #include "base/callback.h"
12 #include "base/memory/singleton.h"
13
14 namespace content {
15 class RenderFrameHost;
16 }
17
18 namespace base {
19
20 extern std::string voiceKey;
21 extern std::string voiceKey_BTPlay;
22 extern std::string voiceKey_BTPause;
23
24 typedef Callback<void(int, const char*)> OnKeyDown;
25
26 class ExternalInputDeviceController {
27  public:
28   static ExternalInputDeviceController* GetInstance();
29   ~ExternalInputDeviceController();
30
31   void SetCallback(const OnKeyDown& callback) { callback_ = callback; };
32
33   void GrabMediaKey(int player_id, Ecore_Wl_Window* evas);
34   void UnGrabMediaKey(Ecore_Wl_Window* evas);
35
36  private:
37   friend struct base::DefaultSingletonTraits<ExternalInputDeviceController>;
38
39   ExternalInputDeviceController();
40   // Media button press event callback
41   static Eina_Bool MediaToggleCallback(void* data, int type, void* event);
42
43   int player_id_;
44   OnKeyDown callback_;
45   Ecore_Event_Handler* handler_;
46   Ecore_Wl_Window* wayland_window_;
47 };
48
49 }  // namespace base
50
51 #endif