tizen 2.3 release
[framework/web/wearable/wrt-plugins-tizen.git] / src / Content / ContentChangeCallback.h
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #ifndef __TIZEN_CONTENT_CHANGE_CALLBACK_H__
19 #define __TIZEN_CONTENT_CHANGE_CALLBACK_H__
20
21 #include <string>
22 #include <memory>
23 #include <list>
24
25 #include <JavaScriptCore/JavaScript.h>
26 #include <MultiCallbackUserData.h>
27
28 #include "Content.h"
29 #include "ImageContent.h"
30 #include "VideoContent.h"
31 #include "AudioContent.h"
32
33 using namespace DeviceAPI::Common;
34
35 namespace DeviceAPI {
36 namespace Content {
37
38 class ContentChangeCallback
39 {
40 public:
41     ContentChangeCallback(JSContextRef globalCtx, JSObjectRef object);
42     virtual ~ContentChangeCallback();
43
44     void oncontentadded(ContentPtr content);
45     void oncontentadded(ImageContentPtr content);
46     void oncontentadded(VideoContentPtr content);
47     void oncontentadded(AudioContentPtr content);
48
49     void oncontentupdated(ContentPtr content);
50     void oncontentupdated(ImageContentPtr content);
51     void oncontentupdated(VideoContentPtr content);
52     void oncontentupdated(AudioContentPtr content);
53
54     void oncontentremoved(std::string id);
55
56     JSContextRef getContext() const;
57
58 private:
59     MultiCallbackUserData *m_callback;
60 };
61
62 typedef std::shared_ptr<ContentChangeCallback> ContentChangeCallbackPtr;
63 typedef std::list<std::shared_ptr<ContentChangeCallback>> ContentChangeCallbackPtrList;
64
65 } // Content
66 } // DeviceAPI
67
68
69
70 #endif // __TIZEN_CONTENT_CHANGE_CALLBACK_H__