2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file BrowserAppControlDllEntry.cpp
20 * @brief This is the implementation for the BrowserAppControlDllEntry.cpp class.
23 #include <appsvc/appsvc.h>
24 #include <appfw/app_service.h>
26 #include <FBaseSysLog.h>
27 #include <FAppAppControl.h>
28 #include <FBaseColHashMap.h>
30 #include <FBase_StringConverter.h>
31 #include <FApp_AppControlManager.h>
32 #include <FApp_AppMessageImpl.h>
33 #include <FApp_AppArg.h>
36 using namespace Tizen::App;
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Collection;
46 result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
47 result _OSP_EXPORT_ TerminateAppControl(int req);
50 static const wchar_t __allowedAppControlTable[][2][64] =
52 {L"osp.appcontrol.BROWSER", L"osp.appcontrol.operation.DEFAULT"},
53 {L"osp.appcontrol.provider.browser", L"osp.appcontrol.operation.view"},
54 {L"http://tizen.org/appcontrol/provider/browser", L"http://tizen.org/appcontrol/operation/view"},
55 {L"tizen.internet", L"http://tizen.org/appcontrol/operation/view"},
59 StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
61 SysLog(NID_APP, "StartAppControl: Entry to Browser AppControl");
63 const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 4, aId, oId);
64 SysTryReturnResult(NID_APP, isAllowed, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
68 char* pUriLiteral = null;
75 // if there is not pUri, then search for "url" key.
76 const String* pUriData = static_cast<const String*>(pMap->GetValue(String(L"url")));
79 pUriLiteral = _StringConverter::CopyToCharArrayN(*pUriData);
84 result r = _AppControlManager::GetInstance()->LaunchPkg(msg, "org.tizen.browser", SERVICE_OPERATION_VIEW, NULL, pUriLiteral, NULL, 0);
87 r = _AppControlManager::GetInstance()->LaunchPkg(msg, "com.samsung.browser", SERVICE_OPERATION_VIEW, NULL, pUriLiteral, NULL, 0);
90 delete [] pUriLiteral;
92 SysTryLog(NID_APP, !IsFailed(r), "[%s] System error.", GetErrorMessage(r));
94 SysLog(NID_APP, "StartAppControl: Launching Browser AppControl succeeded");
100 TerminateAppControl(int req)