Update wrt-plugins-common_0.3.53
[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   protected:
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;
56
57   private:
58     bool initializeApplicationList();
59     std::string getPathFromApplicationName(const std::string &applicationName)
60     const;
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)
64     const;
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;
77 };
78
79 typedef DPL::SharedPtr<AppLauncherManager> AppLauncherManagerPtr;
80 }
81 }
82
83 #endif /* _SLP20__APPLAUNCHER_MANAGER_H_ */