Tizen 2.1 base
[framework/web/wrt-commons.git] / modules / vcore / src / vcore / DeveloperModeValidator.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        DeveloperModeValidator.h
18  * @author      Bartosz Janiak (b.janiak@samsung.com)
19  * @version     1.0
20  * @brief       DeveloperModeValidatorValidator - implementing WAC 2.0 spec, including TargetRestriction
21  */
22
23 #ifndef \
24     WRT_ENGINE_SRC_INSTALLER_CORE_VALIDATION_CORE_DEVELOPER_MODE_VALIDATOR_H
25 #define \
26     WRT_ENGINE_SRC_INSTALLER_CORE_VALIDATION_CORE_DEVELOPER_MODE_VALIDATOR_H
27
28 #include <string>
29 #include <dpl/exception.h>
30 #include "SignatureData.h"
31
32 namespace ValidationCore {
33
34 class DeveloperModeValidator
35 {
36   public:
37     explicit DeveloperModeValidator(bool complianceMode = false,
38                                     const std::string &fakeIMEI = "",
39                                     const std::string &fakeMEID = "");
40
41     class Exception
42     {
43       public:
44         DECLARE_EXCEPTION_TYPE(DPL::Exception, Base)
45         DECLARE_EXCEPTION_TYPE(Base, UnableToLoadTestCertificate)
46         DECLARE_EXCEPTION_TYPE(Base, NoTargetRestrictionSatisfied)
47     };
48
49     void check(const SignatureData &data);
50   private:
51     bool m_complianceModeEnabled;
52     std::string m_fakeIMEI;
53     std::string m_fakeMEID;
54 };
55
56 }
57 #endif /* WRT_ENGINE_SRC_INSTALLER_CORE_VALIDATION_CORE_DEVELOPER_MODE_VALIDATOR_H */
58