1 | /* |
2 | * Copyright (C) 2013 Samsung Electronics Inc. All rights reserved. |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Library General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Library General Public License |
15 | * along with this library; see the file COPYING.LIB. If not, write to |
16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 | * Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #pragma once |
21 | |
22 | #if HAVE(ACCESSIBILITY) |
23 | |
24 | #include <JavaScriptCore/JSObjectRef.h> |
25 | #include <atk/atk.h> |
26 | #include <atk/atkobject.h> |
27 | #include <wtf/RefCounted.h> |
28 | #include <wtf/glib/GRefPtr.h> |
29 | |
30 | namespace WTR { |
31 | |
32 | class AccessibilityNotificationHandler : public RefCounted<AccessibilityNotificationHandler> { |
33 | public: |
34 | static Ref<AccessibilityNotificationHandler> create() |
35 | { |
36 | return adoptRef(*new AccessibilityNotificationHandler()); |
37 | } |
38 | ~AccessibilityNotificationHandler(); |
39 | void setPlatformElement(GRefPtr<AtkObject> platformElement) { m_platformElement = platformElement; } |
40 | GRefPtr<AtkObject> platformElement() const { return m_platformElement; } |
41 | void setNotificationFunctionCallback(JSValueRef); |
42 | JSValueRef notificationFunctionCallback() const { return m_notificationFunctionCallback; } |
43 | |
44 | private: |
45 | AccessibilityNotificationHandler(); |
46 | void connectAccessibilityCallbacks(); |
47 | bool disconnectAccessibilityCallbacks(); |
48 | void removeAccessibilityNotificationHandler(); |
49 | |
50 | GRefPtr<AtkObject> m_platformElement; |
51 | JSValueRef m_notificationFunctionCallback; |
52 | }; |
53 | |
54 | } // namespace WTR |
55 | |
56 | #endif // HAVE(ACCESSIBILITY) |
57 | |