tizen beta release
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_parental_mode.cpp
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    task_parental_mode.cpp
18  * @author  Janusz Majnert (j.majnert@samsung.com)
19  * @version 1.0
20  * @brief   Implementation for parental mode check installer task
21  */
22 #include <widget_install/task_parental_mode.h>
23 #include <widget_install/widget_install_errors.h>
24 #include <widget_install/widget_install_context.h>
25 #include <dpl/wrt-dao-ro/global_config.h>
26 #include <dpl/log/log.h>
27
28 namespace Jobs {
29 namespace WidgetInstall {
30 TaskParentalMode::TaskParentalMode(InstallerContext &installerContext) :
31     DPL::TaskDecl<TaskParentalMode>(this),
32     m_installerContext(installerContext)
33 {
34     AddStep(&TaskParentalMode::StepCheckParentalMode);
35 }
36
37 TaskParentalMode::~TaskParentalMode()
38 {
39     //Nothing to do for now
40 }
41
42 void TaskParentalMode::StepCheckParentalMode()
43 {
44     LogInfo("Step: Checking parental mode status");
45
46     using namespace WrtDB;
47     if (GlobalDAOReadOnly::GetParentalMode()) {
48         Throw(Exceptions::ParentalModeActive);
49     }
50 }
51 } //namespace WidgetInstall
52 } //namespace Jobs