Fix the boiler plate codes
[apps/osp/CertificateSelector.git] / src / CertificateSelectorFrame.cpp
1 //
2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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 /**
18  * @file        CertificateSelectorFrame.cpp
19  * @brief       This is the implementation for the %CertificateSelectorFrame class.
20  */
21
22 #include <unique_ptr.h>
23 #include "CertificateSelectorForm.h"
24 #include "CertificateSelectorFrame.h"
25
26 using namespace Tizen::Base;
27 using namespace Tizen::Ui;
28 using namespace Tizen::Ui::Controls;
29
30 CertificateSelectorFrame::CertificateSelectorFrame(void)
31         : __reqId(-1)
32 {
33 }
34
35 CertificateSelectorFrame::~CertificateSelectorFrame(void)
36 {
37 }
38
39 void
40 CertificateSelectorFrame::SetRequestId(RequestId reqId)
41 {
42         __reqId = reqId;
43 }
44
45 result
46 CertificateSelectorFrame::OnInitializing(void)
47 {
48         result r = E_SUCCESS;
49         Form* pForm = null;
50
51         std::unique_ptr<CertificateSelectorForm> pCertificateSelectorForm(new (std::nothrow) CertificateSelectorForm());
52         TryReturnResult(pCertificateSelectorForm, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY
53                 , "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
54
55         AppAssertf(__reqId > -1, "The request ID is invalid.");
56         r = pCertificateSelectorForm->Initialize(__reqId);
57         TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
58
59         pForm = pCertificateSelectorForm.release();
60
61         r = AddControl(*pForm);
62         TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
63
64         r = SetCurrentForm(*pForm);
65         TryReturnResult(!IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
66
67         pForm->Invalidate(true);
68
69         return r;
70 }
71
72 result
73 CertificateSelectorFrame::OnTerminating(void)
74 {
75         return E_SUCCESS;
76 }
77
78