[Release] wrt-plugins-common_0.3.74
[platform/framework/web/wrt-plugins-common.git] / src / modules / tizen / DEPRACATED / AppLauncher / AppLauncherManager.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16 /**
17  * @file        AppLauncherManager.h
18  * @author      Lukasz Marek (l.marek@samsung.com)
19  * @author      Yujie Zeng (yj.zeng@samsung.com)
20  * @version     0.1
21  */
22
23 #ifndef _SLP20__APPLAUNCHER_MANAGER_H_
24 #define _SLP20__APPLAUNCHER_MANAGER_H_
25
26 #include <dpl/shared_ptr.h>
27 #include <string>
28 #include <vector>
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>
34
35 namespace WrtPlugins {
36 namespace Platform {
37 class AppLauncherManager : public Api::AppLauncher::IAppLauncherManager
38 {
39   public:
40     AppLauncherManager();
41     virtual ~AppLauncherManager();
42
43   protected:
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;
57
58   private:
59     bool initializeApplicationList();
60     std::string getPathFromApplicationName(const std::string &applicationName)
61     const;
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)
65     const;
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> &
73         applicationParam);
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;
80 };
81
82 typedef DPL::SharedPtr<AppLauncherManager> AppLauncherManagerPtr;
83 }
84 }
85
86 #endif /* _SLP20__APPLAUNCHER_MANAGER_H_ */