Implement some new ewk apis in web view.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / web-view / web-view.cpp
1 /*
2  * Copyright (c) 2020 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 // CLASS HEADER
19 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/controls/web-view/web-view-impl.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 WebView::WebView()
29 {
30 }
31
32 WebView::WebView(const WebView& WebView)
33 : Control(WebView)
34 {
35 }
36
37 WebView& WebView::operator=(const WebView& view)
38 {
39   if(&view != this)
40   {
41     Control::operator=(view);
42   }
43
44   return *this;
45 }
46
47 WebView::~WebView()
48 {
49 }
50
51 WebView WebView::New()
52 {
53   return Internal::WebView::New();
54 }
55
56 WebView WebView::New(const std::string& locale, const std::string& timezoneId)
57 {
58   return Internal::WebView::New(locale, timezoneId);
59 }
60
61 WebView WebView::DownCast(BaseHandle handle)
62 {
63   return Control::DownCast<WebView, Internal::WebView>(handle);
64 }
65
66 Dali::Toolkit::WebSettings* WebView::GetSettings() const
67 {
68   return Dali::Toolkit::GetImpl( *this ).GetSettings();
69 }
70
71 Dali::Toolkit::WebContext* WebView::GetContext() const
72 {
73   return Dali::Toolkit::GetImpl( *this ).GetContext();
74 }
75
76 Dali::Toolkit::WebCookieManager* WebView::GetCookieManager() const
77 {
78   return Dali::Toolkit::GetImpl( *this ).GetCookieManager();
79 }
80
81 Dali::Toolkit::WebBackForwardList* WebView::GetBackForwardList() const
82 {
83   return Dali::Toolkit::GetImpl( *this ).GetBackForwardList();
84 }
85
86 void WebView::LoadUrl(const std::string& url)
87 {
88   Dali::Toolkit::GetImpl(*this).LoadUrl(url);
89 }
90
91 void WebView::LoadHtmlString(const std::string& htmlString)
92 {
93   Dali::Toolkit::GetImpl(*this).LoadHtmlString(htmlString);
94 }
95
96 void WebView::Reload()
97 {
98   Dali::Toolkit::GetImpl(*this).Reload();
99 }
100
101 void WebView::StopLoading()
102 {
103   Dali::Toolkit::GetImpl(*this).StopLoading();
104 }
105
106 void WebView::Suspend()
107 {
108   Dali::Toolkit::GetImpl(*this).Suspend();
109 }
110
111 void WebView::Resume()
112 {
113   Dali::Toolkit::GetImpl(*this).Resume();
114 }
115
116 void WebView::ScrollBy( int deltaX, int deltaY )
117 {
118   Dali::Toolkit::GetImpl( *this ).ScrollBy( deltaX, deltaY );
119 }
120
121 bool WebView::CanGoForward()
122 {
123   return Dali::Toolkit::GetImpl(*this).CanGoForward();
124 }
125
126 void WebView::GoForward()
127 {
128   Dali::Toolkit::GetImpl(*this).GoForward();
129 }
130
131 bool WebView::CanGoBack()
132 {
133   return Dali::Toolkit::GetImpl(*this).CanGoBack();
134 }
135
136 void WebView::GoBack()
137 {
138   Dali::Toolkit::GetImpl(*this).GoBack();
139 }
140
141 void WebView::EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler)
142 {
143   Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, resultHandler);
144 }
145
146 void WebView::EvaluateJavaScript(const std::string& script)
147 {
148   Dali::Toolkit::GetImpl(*this).EvaluateJavaScript(script, nullptr);
149 }
150
151 void WebView::AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler)
152 {
153   Dali::Toolkit::GetImpl(*this).AddJavaScriptMessageHandler(exposedObjectName, handler);
154 }
155
156 void WebView::ClearHistory()
157 {
158   Dali::Toolkit::GetImpl(*this).ClearHistory();
159 }
160
161 WebView::WebViewPageLoadSignalType& WebView::PageLoadStartedSignal()
162 {
163   return Dali::Toolkit::GetImpl(*this).PageLoadStartedSignal();
164 }
165
166 WebView::WebViewPageLoadSignalType& WebView::PageLoadFinishedSignal()
167 {
168   return Dali::Toolkit::GetImpl(*this).PageLoadFinishedSignal();
169 }
170
171 WebView::WebViewPageLoadErrorSignalType& WebView::PageLoadErrorSignal()
172 {
173   return Dali::Toolkit::GetImpl(*this).PageLoadErrorSignal();
174 }
175
176 WebView::WebViewScrollEdgeReachedSignalType& WebView::ScrollEdgeReachedSignal()
177 {
178   return Dali::Toolkit::GetImpl( *this ).ScrollEdgeReachedSignal();
179 }
180
181 WebView::WebView(Internal::WebView& implementation)
182 : Control(implementation)
183 {
184 }
185
186 WebView::WebView(Dali::Internal::CustomActor* internal)
187 : Control(internal)
188 {
189   VerifyCustomActorPointer<Internal::WebView>(internal);
190 }
191
192 } // namespace Toolkit
193
194 } // namespace Dali