4ddbb93d9cbf83742d7255f3c065124be5d4a7f2
[platform/framework/native/shell.git] / src / FShellLiveboxManager.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 /**
19  * @file        FShellLiveboxManager.cpp
20  * @brief       This is the implementation for the LiveboxManager class.
21  */
22
23 #include <unique_ptr.h>
24
25 #include <shortcut.h>
26 #include <livebox-service/livebox-service.h>
27
28 #include <FBaseSysLog.h>
29 #include <FBaseCol.h>
30 #include <FGraphics.h>
31 #include <FApp.h>
32 #include <FAppPkgPackageInfo.h>
33 #include <FApp_Types.h>
34 #include <FApp_AppInfo.h>
35
36
37 #include <FShellLiveboxManager.h>
38 #include <FShellLiveboxProviderInfo.h>
39 #include "FShell_LiveboxManagerImpl.h"
40
41 using namespace std;
42 using namespace Tizen::App;
43 using namespace Tizen::App::Package;
44 using namespace Tizen::Base;
45 using namespace Tizen::Base::Collection;
46 using namespace Tizen::Graphics;
47
48
49 namespace Tizen { namespace Shell
50 {
51
52 LiveboxManager::LiveboxManager()
53         :__pLiveboxManagerImpl(null)
54 {
55
56 }
57
58 LiveboxManager::~LiveboxManager()
59 {
60 }
61
62 LiveboxManager*
63 LiveboxManager::GetInstance()
64 {
65         static LiveboxManager* pLiveboxManager = null;
66         if( pLiveboxManager == null)
67         {
68                 pLiveboxManager = new (std::nothrow) LiveboxManager;
69                 SysTryReturn(NID_APP, pLiveboxManager, null, E_OUT_OF_MEMORY, "E_OUT_OF_MEMORY" );
70
71                 result r = pLiveboxManager->Construct();
72 //              SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
73                 SysAssertf(!IsFailed(r), "Failed to construct LiveboxManager!!");
74                 SysLog(NID_APP, "LiveboxManager instance is created.");
75         }
76
77         return pLiveboxManager;
78 }
79
80 result
81 LiveboxManager::Construct()
82 {
83         SysAssert(__pLiveboxManagerImpl == null);
84
85         SysLog(NID_APP, "Enter.");
86         __pLiveboxManagerImpl = _LiveboxManagerImpl::GetInstance();
87         SysAssertf(__pLiveboxManagerImpl, "Failed to construct _LiveboxManagerImpl!!");
88
89         SysLog(NID_APP, "Exit.");
90
91         return E_SUCCESS;
92 }
93
94 Tizen::Base::Collection::IList*
95 LiveboxManager::GetLiveboxProviderInfoListN()
96 {
97         return __pLiveboxManagerImpl->GetLiveboxProviderInfoListN();
98 }
99
100 LiveboxProviderInfo*
101 LiveboxManager::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
102 {
103         // TODO : set configurationAppcontrolAppId
104         return __pLiveboxManagerImpl->GetLiveboxProviderInfoN(appId, providerName);
105 }
106
107 result
108 LiveboxManager::SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener)
109 {
110         return __pLiveboxManagerImpl->SetLiveboxAddRequestListener(pListener);
111 }
112
113
114 }} // Tizen::Shell