Apply to remove download listener before deleting _WebImpl
[framework/osp/web.git] / src / controls / FWebCtrl_WebPresenter.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FWebCtrl_WebImpl.cpp
20  * @brief               The file contains the definition of _WebImpl class.
21  *
22  * The file contains the definition of _WebImpl class.
23  */
24 #include <FBaseSysLog.h>
25 #include <FApp_AppImpl.h>
26 #include "FWebCtrl_WebPresenter.h"
27
28
29 namespace Tizen { namespace Web { namespace Controls
30 {
31
32
33 _WebPresenter::_WebPresenter(void)
34         : __stopState(false)
35         , __boolean(false)
36         , __string(L"")
37         , __integer(0)
38         , __pIList(null)
39         , __longInteger(0)
40 {
41         //empty statement
42 }
43
44
45 _WebPresenter::~_WebPresenter(void)
46 {
47 }
48
49
50 void
51 _WebPresenter::InitAsyncProcess(void)
52 {
53         __stopState = false;
54         __boolean = false;
55         __string = L"";
56         __integer = 0;
57          __pIList = null;
58          __longInteger = 0;
59 }
60
61
62 void
63 _WebPresenter::WaitAsyncProcess(bool& result)
64 {
65         ProcessEvent();
66
67         result = __boolean;
68 }
69
70
71 void
72 _WebPresenter::WaitAsyncProcess(Tizen::Base::String& result)
73 {
74         ProcessEvent();
75
76         result = __string;
77 }
78
79
80 void
81 _WebPresenter::WaitAsyncProcess(int& result)
82 {
83         ProcessEvent();
84
85         result = __integer;
86 }
87
88
89 Eina_List*
90 _WebPresenter::WaitAsyncProcess()
91 {
92         ProcessEvent();
93
94         return __pIList;
95 }
96
97
98 void
99 _WebPresenter::WaitAsyncProcess(long& result)
100 {
101         ProcessEvent();
102
103         result = __longInteger;
104 }
105
106
107 void
108 _WebPresenter::ProcessEvent(void)
109 {
110         while (true)
111         {
112                 if (__stopState)
113                 {
114                         break;
115                 }
116
117                 if (Tizen::App::_AppImpl::IsTerminationRequested())
118                 {
119                         break;
120                 }
121
122                 ecore_main_loop_iterate();
123         }
124 }
125
126
127 void
128 _WebPresenter::EndAsyncProcess(const Tizen::Base::String& result)
129 {
130         __string = const_cast< Tizen::Base::String& >(result);
131         __stopState = true;
132 }
133
134
135 void
136 _WebPresenter::EndAsyncProcess(bool result)
137 {
138         __boolean = result;
139         __stopState = true;
140 }
141
142
143 void
144 _WebPresenter::EndAsyncProcess(int result)
145 {
146         __integer = result;
147         __stopState = true;
148 }
149
150
151 void
152 _WebPresenter::EndAsyncProcess(const Eina_List* result)
153 {
154         __pIList = const_cast<Eina_List*>(result);
155         __stopState = true;
156 }
157
158
159 void
160 _WebPresenter::EndAsyncProcess(long result)
161 {
162         __longInteger = result;
163         __stopState = true;
164 }
165
166
167 }}} // Tizen::Web::Controls