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();
43 virtual void OnRequestReceived(
44 const Api::AppLauncher::EventGetDefaultApplicationPtr &event);
45 virtual void OnRequestReceived(
46 const Api::AppLauncher::EventGetInstalledApplicationsPtr &event);
47 virtual void OnRequestReceived(
48 const Api::AppLauncher::EventLaunchApplicationPtr &event);
49 virtual bool isRegisteredApplication(const std::string &name) const;
50 virtual Api::AppLauncher::ApplicationType getRegisteredApplicationType(
51 const std::string &name) const;
52 virtual std::string getRealPath(const std::string &path) const;
53 virtual bool validateHttpAddress(const std::string &value) const;
54 virtual bool validateEmailAddress(const std::string &value) const;
55 virtual bool isFilePath(const std::string &value) const;
58 bool initializeApplicationList();
59 std::string getPathFromApplicationName(const std::string &applicationName)
61 std::string getPathFromPackageName(const std::string &packageName) const;
62 std::string getPackageNameFromPath(const std::string &path) const;
63 std::string getDefaultApplicationByMimeInternal(const std::string &mime)
65 int launchApplicationInternal(
66 const Api::AppLauncher::ApplicationUriType uriType,
67 const std::string &uriParameter,
68 const std::vector<std::string> &applicationParams);
69 int launchApplicationFileInternal(const std::string &uriParameter,
70 const std::vector<std::string> &applicationParam);
71 static std::map<Api::AppLauncher::ApplicationType,
72 std::string> m_applicationTypesByPath;
73 static std::map<Api::AppLauncher::ApplicationType,
74 std::string> m_applicationTypesByName;
75 static std::vector<std::string> m_installedApplications;
76 static std::vector<std::string> m_installedApplicationsNames;
79 typedef DPL::SharedPtr<AppLauncherManager> AppLauncherManagerPtr;
83 #endif /* _SLP20__APPLAUNCHER_MANAGER_H_ */