Merge "Fix memory leak on imei" into tizen_2.2
[platform/framework/native/appfw.git] / src / app / FApp_AppLifecycleEvent.cpp
1 //\r
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.\r
3 //\r
4 // Licensed under the Apache License, Version 2.0 (the License);\r
5 // you may not use this file except in compliance with the License.\r
6 // You may obtain a copy of the License at\r
7 //\r
8 //     http://www.apache.org/licenses/LICENSE-2.0\r
9 //\r
10 // Unless required by applicable law or agreed to in writing, software\r
11 // distributed under the License is distributed on an "AS IS" BASIS,\r
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13 // See the License for the specific language governing permissions and\r
14 // limitations under the License.\r
15 //\r
16 \r
17 /**\r
18  * @file         FApp_AppLifecycleEvent.cpp\r
19  * @brief       This is the implementation for the _AppLifecycleEvent.cpp class.\r
20  */\r
21 \r
22 #include <FBaseSysLog.h>\r
23 \r
24 #include "FApp_Types.h"\r
25 #include "FApp_AppLifecycleEvent.h"\r
26 #include "FApp_AppLifecycleEventArg.h"\r
27 #include "FApp_IAppLifecycleEventListener.h"\r
28 \r
29 using namespace Tizen::Base;\r
30 using namespace Tizen::Base::Runtime;\r
31 \r
32 \r
33 namespace Tizen { namespace App\r
34 {\r
35 \r
36 _AppLifecycleEventArg::_AppLifecycleEventArg(void)\r
37 {\r
38 }\r
39 \r
40 _AppLifecycleEventArg::_AppLifecycleEventArg(const AppId& appId, _AppLifecycleEventType appLifecycleEventType)\r
41         : __appId(appId)\r
42         , __appLifecycleEventType(appLifecycleEventType)\r
43 {\r
44 }\r
45 \r
46 _AppLifecycleEventArg::~_AppLifecycleEventArg(void)\r
47 {\r
48 }\r
49 \r
50 const AppId\r
51 _AppLifecycleEventArg::GetAppId(void) const\r
52 {\r
53         return __appId;\r
54 }\r
55 \r
56 _AppLifecycleEventType\r
57 \r
58 _AppLifecycleEventArg::GetAppLifecycleEventType(void) const\r
59 {\r
60         return __appLifecycleEventType;\r
61 }\r
62 \r
63 ///////////////////////////////////////////////////////\r
64 //_AppLifecycleEvent\r
65 ///////////////////////////////////////////////////////\r
66 result\r
67 _AppLifecycleEvent::Construct(void)\r
68 {\r
69         return _Event::Initialize();\r
70 }\r
71 \r
72 void\r
73 _AppLifecycleEvent::FireImpl(IEventListener& listener, const IEventArg& arg)\r
74 {\r
75         _IAppLifecycleEventListener* pListener = dynamic_cast<_IAppLifecycleEventListener*>(&listener);\r
76         SysTryReturnVoidResult(NID_APP, pListener != null, E_INVALID_STATE, "Invalid listener : listener(0x%x), arg(0x%x)", &listener, &arg);\r
77 \r
78         const _AppLifecycleEventArg* pEventArg = dynamic_cast<const _AppLifecycleEventArg*>(&arg);\r
79         SysTryReturnVoidResult(NID_APP, pEventArg != null, E_INVALID_STATE, "Invalid arg : listener(0x%x), arg(0x%x)", &listener, &arg);\r
80 \r
81         pListener->OnAppLifecycleEventReceived(pEventArg->GetAppId(), pEventArg->GetAppLifecycleEventType());\r
82 }\r
83 \r
84 } } // Tizen::App\r
85 \r