Change WebEngine API
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / web-engine.cpp
1 /*
2  * Copyright (c) 2018 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/devel-api/adaptor-framework/web-engine.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/web-engine/common/web-engine-impl.h>
23
24 namespace Dali
25 {
26
27 WebEngine::WebEngine()
28 {
29 }
30
31 WebEngine::WebEngine( Internal::Adaptor::WebEngine* internal )
32 : BaseHandle( internal )
33 {
34 }
35
36 WebEngine::~WebEngine()
37 {
38 }
39
40 WebEngine WebEngine::New()
41 {
42   Internal::Adaptor::WebEnginePtr engine = Internal::Adaptor::WebEngine::New();
43
44   return WebEngine( engine.Get() );
45 }
46
47 WebEngine::WebEngine( const WebEngine& webEngine )
48 : BaseHandle( webEngine )
49 {
50 }
51
52 WebEngine& WebEngine::operator=( const WebEngine& webEngine )
53 {
54   if( *this != webEngine )
55   {
56     BaseHandle::operator=( webEngine );
57   }
58   return *this;
59 }
60
61 WebEngine WebEngine::DownCast( BaseHandle handle )
62 {
63   return WebEngine( dynamic_cast< Internal::Adaptor::WebEngine* >( handle.GetObjectPtr() ) );
64 }
65
66 void WebEngine::Create( int width, int height, const std::string& locale, const std::string& timezoneId )
67 {
68   GetImplementation( *this ).Create( width, height, locale, timezoneId );
69 }
70
71 void WebEngine::Destroy()
72 {
73   GetImplementation( *this ).Destroy();
74 }
75
76 NativeImageInterfacePtr WebEngine::GetNativeImageSource()
77 {
78   return GetImplementation( *this ).GetNativeImageSource();
79 }
80
81 void WebEngine::LoadUrl( const std::string& url )
82 {
83   return GetImplementation( *this ).LoadUrl( url );
84 }
85
86 const std::string& WebEngine::GetUrl()
87 {
88   return GetImplementation( *this ).GetUrl();
89 }
90
91 void WebEngine::LoadHTMLString( const std::string& htmlString )
92 {
93   GetImplementation( *this ).LoadHTMLString( htmlString );
94 }
95
96 void WebEngine::Reload()
97 {
98   GetImplementation( *this ).Reload();
99 }
100
101 void WebEngine::StopLoading()
102 {
103   GetImplementation( *this ).StopLoading();
104 }
105
106 bool WebEngine::CanGoForward()
107 {
108   return GetImplementation( *this ).CanGoForward();
109 }
110
111 void WebEngine::GoForward()
112 {
113   GetImplementation( *this ).GoForward();
114 }
115
116 bool WebEngine::CanGoBack()
117 {
118   return GetImplementation( *this ).CanGoBack();
119 }
120
121 void WebEngine::GoBack()
122 {
123   GetImplementation( *this ).GoBack();
124 }
125
126 void WebEngine::EvaluateJavaScript( const std::string& script )
127 {
128   GetImplementation( *this ).EvaluateJavaScript( script );
129 }
130
131 void WebEngine::AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler )
132 {
133   GetImplementation( *this ).AddJavaScriptMessageHandler( exposedObjectName, handler );
134 }
135
136 void WebEngine::ClearHistory()
137 {
138   return GetImplementation( *this ).ClearHistory();
139 }
140
141 void WebEngine::ClearCache()
142 {
143   return GetImplementation( *this ).ClearCache();
144 }
145
146 void WebEngine::SetSize( int width, int height )
147 {
148   return GetImplementation( *this ).SetSize( width, height );
149 }
150
151 bool WebEngine::SendTouchEvent( const TouchData& touch )
152 {
153   return GetImplementation( *this ).SendTouchEvent( touch );
154 }
155
156 bool WebEngine::SendKeyEvent( const KeyEvent& event )
157 {
158   return GetImplementation( *this ).SendKeyEvent( event );
159 }
160
161 Dali::WebEnginePlugin::WebEngineSignalType& WebEngine::PageLoadStartedSignal()
162 {
163   return GetImplementation( *this ).PageLoadStartedSignal();
164 }
165
166 Dali::WebEnginePlugin::WebEngineSignalType& WebEngine::PageLoadFinishedSignal()
167 {
168   return GetImplementation( *this ).PageLoadFinishedSignal();
169 }
170
171 } // namespace Dali;
172