Temporary fix for asking geolocation permission popup crash.
[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
31 #include <appfw/app_service.h>
32
33 namespace ApplicationLauncherEvents {
34 DECLARE_GENERIC_EVENT_3(LaunchApplicationByAppService,
35                         service_h,
36                         service_reply_cb,
37                         void*)
38 DECLARE_GENERIC_EVENT_4(LaunchApplicationByPkgname,
39                         std::string,
40                         std::string,
41                         std::string,
42                         std::string)
43 } //namespace ApplicationLauncherEvents
44
45 namespace ApplicationLauncherPkgname {
46 const std::string PKG_NAME_PREFIX = "com.samsung.";
47 const std::string PKG_NAME_DOWNLOAD_PROVIDER = PKG_NAME_PREFIX +
48     "download-provider";
49 const std::string PKG_NAME_VIDEO_PLAYER = PKG_NAME_PREFIX + "video-player";
50 const std::string PKG_NAME_VT_MAIN = PKG_NAME_PREFIX + "vtmain";
51 } // namespace ApplicationLauncherPkgname
52
53 class ApplicationLauncher :
54     public DPL::Event::Controller<DPL::TypeListDecl<
55                                       ApplicationLauncherEvents::
56                                           LaunchApplicationByPkgname,
57                                       ApplicationLauncherEvents::
58                                           LaunchApplicationByAppService
59                                       >::Type>
60 {
61   public:
62     ApplicationLauncher();
63     virtual ~ApplicationLauncher();
64     void setWidgetTizenId(const std::string& tizenId);
65     void setWindowHandle(unsigned windowHandle);
66
67   protected:
68     virtual void OnEventReceived(
69         const ApplicationLauncherEvents::
70             LaunchApplicationByPkgname &event);
71     virtual void OnEventReceived(
72         const ApplicationLauncherEvents::
73             LaunchApplicationByAppService &event);
74
75   private:
76     std::string m_tizenId;
77     unsigned m_windowHandle;
78 };
79
80 typedef DPL::Singleton<ApplicationLauncher> ApplicationLauncherSingleton;
81
82 #endif //APPLICATION_LAUNCHER_H