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.
16 #ifndef WRT_SRC_INSTALLER_CORE_INSTALLER_CONTROLLER_H_
17 #define WRT_SRC_INSTALLER_CORE_INSTALLER_CONTROLLER_H_
19 #include <dpl/singleton.h>
20 #include <dpl/event/controller.h>
21 #include <dpl/generic_event.h>
24 #include <dpl/task_list.h>
26 #include <dpl/type_list.h>
27 #include <widget_install/widget_installer_struct.h>
28 #include <installer_logic.h>
32 * @brief holds events send to InstallControler
34 namespace InstallerControllerEvents {
36 * @brief Event for inicieting instalation process.
38 * This event holds std::string witch should be path to widget package
40 DECLARE_GENERIC_EVENT_2(InstallWidgetEvent,
42 WidgetInstallationStruct) // (zipFileName, installerStruct)
45 * @brief Event for iniciating plugin instalation process.
46 * This event holds std::string witch should be path to plugin directory
47 * and PluginInstallerStruct which contain
48 * StatusCallack, progressCallback and private data for callbacks
50 DECLARE_GENERIC_EVENT_2(InstallPluginEvent, std::string, PluginInstallerStruct)
53 * @brief Event for indiciating W3C Geolocation plugin instalation process.
55 DECLARE_GENERIC_EVENT_1(InstallPluginGeolocationEvent, PluginInstallerStruct) //
58 * @brief Event for inicietig widget uninstallation.
60 * WidgetHandler is used to point witch widget shuld be uninstalled
62 DECLARE_GENERIC_EVENT_2(UninstallWidgetEvent,
64 WidgetUninstallationStruct)
67 * @brief Event for pushing installation process forward.
69 DECLARE_GENERIC_EVENT_1(NextStepEvent, Jobs::Job *)
71 DECLARE_GENERIC_EVENT_0(InstallDeferredWidgetPackagesEvent)
73 DECLARE_GENERIC_EVENT_0(InitializeEvent)
74 DECLARE_GENERIC_EVENT_0(TerminateEvent)
76 } // namespace InstallerEvents
79 * @brief Controls Widget installation
81 * Main Controler of wiget installation/uninstallation, this is also used
82 * for pushing forward each of processes.
83 * It waits for three events:
85 * <li>InstallWidgetEvent</li>
86 * <li>UninstallWidgetEvent</li>
87 * <li>NextStepEvent</li>
91 typedef DPL::TypeListDecl<
92 InstallerControllerEvents::InstallWidgetEvent,
93 InstallerControllerEvents::InstallPluginEvent,
94 InstallerControllerEvents::InstallPluginGeolocationEvent,
95 InstallerControllerEvents::UninstallWidgetEvent,
96 InstallerControllerEvents::NextStepEvent,
97 InstallerControllerEvents::InstallDeferredWidgetPackagesEvent,
98 InstallerControllerEvents::InitializeEvent,
99 InstallerControllerEvents::TerminateEvent>::Type
100 InstallerControllerEventsSet;
102 class InstallerController : public DPL::Event::Controller<InstallerControllerEventsSet>
106 * @brief Executed on InstallWidgetEvent received.
108 virtual void OnEventReceived(
109 const InstallerControllerEvents::InstallWidgetEvent &event);
112 * @brief Executed on InstallPluginEvent received.
114 virtual void OnEventReceived(
115 const InstallerControllerEvents::InstallPluginEvent &event);
118 * @brief Executed on InstallPluginEvent received.
120 virtual void OnEventReceived(
121 const InstallerControllerEvents::InstallPluginGeolocationEvent
125 * @brief Executed on UninstallWidgetEvent received.
127 virtual void OnEventReceived(
128 const InstallerControllerEvents::UninstallWidgetEvent &event);
130 * @brief Executed on NextStepEvent received.
132 virtual void OnEventReceived(
133 const InstallerControllerEvents::NextStepEvent &event);
135 virtual void OnEventReceived(
136 const InstallerControllerEvents::InstallDeferredWidgetPackagesEvent
139 virtual void OnEventReceived(
140 const InstallerControllerEvents::InitializeEvent &event);
141 virtual void OnEventReceived(
142 const InstallerControllerEvents::TerminateEvent &event);
146 InstallerLogic m_installerLogic;
148 InstallerController();
150 static Eina_Bool AddNextStep(void *data);
152 friend class DPL::Singleton<InstallerController>;
155 typedef DPL::Singleton<InstallerController> InstallerControllerSingleton;
157 #endif // INSTALLER_CONTROLLER_H