2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file AppLauncherManager.h
18 * @author Lukasz Marek (l.marek@samsung.com)
19 * @author Yujie Zeng (yj.zeng@samsung.com)
23 #ifndef _SLP20__APPLAUNCHER_MANAGER_H_
24 #define _SLP20__APPLAUNCHER_MANAGER_H_
26 #include <dpl/shared_ptr.h>
29 #include <API/AppLauncher/IAppLauncherManager.h>
30 #include <API/AppLauncher/EventGetDefaultApplication.h>
31 #include <API/AppLauncher/EventGetInstalledApplications.h>
32 #include <API/AppLauncher/EventLaunchApplication.h>
33 #include <API/AppLauncher/ApplicationTypes.h>
35 namespace WrtPlugins {
37 class AppLauncherManager : public Api::AppLauncher::IAppLauncherManager
41 virtual ~AppLauncherManager();
44 virtual void OnRequestReceived(
45 const Api::AppLauncher::EventGetDefaultApplicationPtr &event);
46 virtual void OnRequestReceived(
47 const Api::AppLauncher::EventGetInstalledApplicationsPtr &event);
48 virtual void OnRequestReceived(
49 const Api::AppLauncher::EventLaunchApplicationPtr &event);
50 virtual bool isRegisteredApplication(const std::string &name) const;
51 virtual Api::AppLauncher::ApplicationType getRegisteredApplicationType(
52 const std::string &name) const;
53 virtual std::string getRealPath(const std::string &path) const;
54 virtual bool validateHttpAddress(const std::string &value) const;
55 virtual bool validateEmailAddress(const std::string &value) const;
56 virtual bool isFilePath(const std::string &value) const;
59 bool initializeApplicationList();
60 std::string getPathFromApplicationName(const std::string &applicationName)
62 std::string getPathFromPackageName(const std::string &packageName) const;
63 std::string getPackageNameFromPath(const std::string &path) const;
64 std::string getDefaultApplicationByMimeInternal(const std::string &mime)
66 int launchApplicationInternal(
67 const Api::AppLauncher::ApplicationUriType uriType,
68 const std::string &uriParameter,
69 const std::vector<std::string> &applicationParams);
70 int launchApplicationFileInternal(
71 const std::string &uriParameter,
72 const std::vector<std::string> &
74 static std::map<Api::AppLauncher::ApplicationType,
75 std::string> m_applicationTypesByPath;
76 static std::map<Api::AppLauncher::ApplicationType,
77 std::string> m_applicationTypesByName;
78 static std::vector<std::string> m_installedApplications;
79 static std::vector<std::string> m_installedApplicationsNames;
82 typedef DPL::SharedPtr<AppLauncherManager> AppLauncherManagerPtr;
86 #endif /* _SLP20__APPLAUNCHER_MANAGER_H_ */