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>
25 #include <dpl/type_list.h>
26 #include <widget_install/widget_installer_struct.h>
27 #include <installer_logic.h>
31 * @brief holds events send to InstallControler
33 namespace InstallerControllerEvents {
35 * @brief Event for inicieting instalation process.
37 * This event holds std::string witch should be path to widget package
39 DECLARE_GENERIC_EVENT_3(InstallWidgetEvent,
40 std::string, // zipFileName
41 std::string, // package id
42 Jobs::WidgetInstall::WidgetInstallationStruct) // 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 inicietig widget uninstallation.
55 * tizen id is used to point witch widget shuld be uninstalled
57 DECLARE_GENERIC_EVENT_2(UninstallWidgetEvent,
59 WidgetUninstallationStruct)
62 * @brief Event for pushing installation process forward.
64 DECLARE_GENERIC_EVENT_1(NextStepEvent, Jobs::Job *)
66 DECLARE_GENERIC_EVENT_0(InitializeEvent)
67 DECLARE_GENERIC_EVENT_0(TerminateEvent)
68 } // namespace InstallerEvents
72 * @brief Controls Widget installation
74 * Main Controler of wiget installation/uninstallation, this is also used
75 * for pushing forward each of processes.
76 * It waits for three events:
78 * <li>InstallWidgetEvent</li>
79 * <li>UninstallWidgetEvent</li>
80 * <li>NextStepEvent</li>
84 typedef DPL::TypeListDecl<
85 InstallerControllerEvents::InstallWidgetEvent,
86 InstallerControllerEvents::InstallPluginEvent,
87 InstallerControllerEvents::UninstallWidgetEvent,
88 InstallerControllerEvents::NextStepEvent,
89 InstallerControllerEvents::InitializeEvent,
90 InstallerControllerEvents::TerminateEvent>::Type
91 InstallerControllerEventsSet;
93 class InstallerController : public DPL::Event::Controller<
94 InstallerControllerEventsSet>
98 * @brief Executed on InstallWidgetEvent received.
100 virtual void OnEventReceived(
101 const InstallerControllerEvents::InstallWidgetEvent &event);
104 * @brief Executed on InstallPluginEvent received.
106 virtual void OnEventReceived(
107 const InstallerControllerEvents::InstallPluginEvent &event);
110 * @brief Executed on UninstallWidgetEvent received.
112 virtual void OnEventReceived(
113 const InstallerControllerEvents::UninstallWidgetEvent &event);
115 * @brief Executed on NextStepEvent received.
117 virtual void OnEventReceived(
118 const InstallerControllerEvents::NextStepEvent &event);
120 virtual void OnEventReceived(
121 const InstallerControllerEvents::InitializeEvent &event);
122 virtual void OnEventReceived(
123 const InstallerControllerEvents::TerminateEvent &event);
127 Logic::InstallerLogic m_installerLogic;
129 InstallerController();
131 static Eina_Bool AddNextStep(void *data);
133 friend class DPL::Singleton<InstallerController>;
136 typedef DPL::Singleton<InstallerController> InstallerControllerSingleton;
139 #endif // INSTALLER_CONTROLLER_H