d33c5e74490f39f8a1bb7cff7a13cab67b961ce9
[platform/framework/web/wrt.git] / src / view / common / application_launcher.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    application_launcher.h
18  * @author  Lukasz Wrzosek (l.wrzosek@samsung.com)
19  * @version 1.0
20  * @brief   Header file for application launcher
21  */
22
23 #ifndef APPLICATION_LAUNCHER_H
24 #define APPLICATION_LAUNCHER_H
25
26 #include <string>
27 #include <dpl/event/controller.h>
28 #include <dpl/generic_event.h>
29 #include <dpl/singleton.h>
30 #include <dpl/wrt-dao-ro/wrt_db_types.h>
31
32 #include <appsvc.h>
33 #include <bundle.h>
34
35 namespace ApplicationLauncherEvents {
36 DECLARE_GENERIC_EVENT_3(LaunchApplicationByAppService,
37                         bundle*,
38                         appsvc_res_fn,
39                         void*)
40 DECLARE_GENERIC_EVENT_4(LaunchApplicationByPkgname,
41                         std::string,
42                         std::string,
43                         std::string,
44                         std::string)
45 } //namespace ApplicationLauncherEvents
46
47 namespace ApplicationLauncherPkgname {
48     const std::string PKG_NAME_PREFIX = "com.samsung.";
49     const std::string PKG_NAME_DOWNLOAD_PROVIDER = PKG_NAME_PREFIX + "download-provider";
50     const std::string PKG_NAME_VIDEO_PLAYER = PKG_NAME_PREFIX + "video-player";
51     const std::string PKG_NAME_VT_MAIN = PKG_NAME_PREFIX + "vtmain";
52 } // namespace ApplicationLauncherPkgname
53
54 class ApplicationLauncher :
55         public DPL::Event::Controller<DPL::TypeListDecl<
56             ApplicationLauncherEvents::LaunchApplicationByPkgname,
57             ApplicationLauncherEvents::LaunchApplicationByAppService
58         >::Type>
59 {
60   public:
61     ApplicationLauncher();
62     virtual ~ApplicationLauncher();
63     void setWidgetTizenId(const std::string& tizenId);
64
65   protected:
66     virtual void OnEventReceived(
67             const ApplicationLauncherEvents::
68             LaunchApplicationByPkgname &event);
69     virtual void OnEventReceived(
70             const ApplicationLauncherEvents::
71             LaunchApplicationByAppService &event);
72
73   private:
74     std::string m_tizenId;
75 };
76
77 typedef DPL::Singleton<ApplicationLauncher> ApplicationLauncherSingleton;
78
79 #endif //APPLICATION_LAUNCHER_H