2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <web-engine-lite-impl.h>
23 #include <dali/integration-api/debug.h>
24 #include <dali/public-api/object/type-registry.h>
25 #include <dali/public-api/object/any.h>
37 namespace // unnamed namespace
39 const char* WEB_ENGINE_LITE_PLUGIN_SO( "libdali-web-engine-lite-plugin.so" );
41 Dali::BaseHandle Create()
43 return Dali::WebEngineLite::New();
46 Dali::TypeRegistration type( typeid( Dali::WebEngineLite ), typeid( Dali::BaseHandle ), Create );
48 } // unnamed namespace
50 WebEngineLitePtr WebEngineLite::New()
52 WebEngineLitePtr webEngineLite = new WebEngineLite();
56 WebEngineLite::WebEngineLite()
59 mCreateWebEngineLitePtr( NULL ),
60 mDestroyWebEngineLitePtr( NULL )
64 WebEngineLite::~WebEngineLite()
68 if( mDestroyWebEngineLitePtr != NULL )
70 mDestroyWebEngineLitePtr( mPlugin );
77 void WebEngineLite::Initialize()
81 mHandle = dlopen( WEB_ENGINE_LITE_PLUGIN_SO, RTLD_LAZY );
84 if( mHandle == NULL || error != NULL )
86 DALI_LOG_ERROR( "WebEngineLite::Initialize(), dlopen error: %s\n", error );
90 mCreateWebEngineLitePtr = reinterpret_cast< CreateWebEngineLiteFunction >( dlsym( mHandle, "CreateWebEngineLitePlugin" ) );
91 if( mCreateWebEngineLitePtr == NULL )
93 DALI_LOG_ERROR( "Can't load symbol CreateWebEngineLitePlugin(), error: %s\n", error );
97 mPlugin = mCreateWebEngineLitePtr();
101 DALI_LOG_ERROR( "Can't create the WebEngineLitePlugin object\n" );
105 mDestroyWebEngineLitePtr = reinterpret_cast< DestroyWebEngineLiteFunction >( dlsym( mHandle, "DestroyWebEngineLitePlugin" ) );
106 if( mDestroyWebEngineLitePtr == NULL )
108 DALI_LOG_ERROR( "Can't load symbol DestroyWebEngineLitePlugin(), error: %s\n", error );
114 void WebEngineLite::CreateInstance(int width, int height, int windowX, int windowY, const std::string& locale, const std::string& timezoneID)
116 if( mPlugin != NULL )
118 mPlugin->CreateInstance(width, height, windowX, windowY, locale, timezoneID);
122 void WebEngineLite::DestroyInstance()
124 if( mPlugin != NULL )
126 mPlugin->DestroyInstance();
130 void WebEngineLite::LoadHtml(const std::string& path)
132 if( mPlugin != NULL )
134 mPlugin->LoadHtml(path);
138 Dali::WebEngineLitePlugin::WebEngineLiteSignalType& WebEngineLite::FinishedSignal()
140 if( mPlugin != NULL )
142 return mPlugin->FinishedSignal();
145 return mFinishedSignal;
148 } // namespace Adaptor;
149 } // namespace Internal;