* Support some new APIs, e.g. BackForwardList, Context, CookieManager, Settings.
* Create, GetTitle, GetFavicon, etc are added.
Change-Id: If21a797b9772e595ec0e7c6cd6eb1810adc5bcf0
web_engine_chromium_plugin_src_files = \
- $(extension_src_dir)/web-engine-chromium/tizen-web-engine-chromium.cpp
+ $(extension_src_dir)/web-engine-chromium/tizen-web-engine-back-forward-list.cpp \
+ $(extension_src_dir)/web-engine-chromium/tizen-web-engine-back-forward-list-item.cpp \
+ $(extension_src_dir)/web-engine-chromium/tizen-web-engine-chromium.cpp \
+ $(extension_src_dir)/web-engine-chromium/tizen-web-engine-context.cpp \
+ $(extension_src_dir)/web-engine-chromium/tizen-web-engine-cookie-manager.cpp \
+ $(extension_src_dir)/web-engine-chromium/tizen-web-engine-settings.cpp
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "tizen-web-engine-back-forward-list-item.h"
+
+namespace Dali
+{
+namespace Plugin
+{
+
+TizenWebEngineBackForwardListItem::TizenWebEngineBackForwardListItem( Ewk_Back_Forward_List_Item* item )
+ : ewkBackForwardListItem( item )
+{
+}
+
+TizenWebEngineBackForwardListItem::~TizenWebEngineBackForwardListItem()
+{
+}
+
+std::string TizenWebEngineBackForwardListItem::GetUrl() const
+{
+ return std::string( ewk_back_forward_list_item_url_get( ewkBackForwardListItem ) );
+}
+
+std::string TizenWebEngineBackForwardListItem::GetTitle() const
+{
+ return std::string( ewk_back_forward_list_item_title_get( ewkBackForwardListItem ) );
+}
+
+std::string TizenWebEngineBackForwardListItem::GetOriginalUrl() const
+{
+ return std::string( ewk_back_forward_list_item_original_url_get( ewkBackForwardListItem ) );
+}
+
+} // namespace Plugin
+} // namespace Dali
\ No newline at end of file
--- /dev/null
+#ifndef DALI_PLUGIN_TIZEN_WEB_ENGINE_BACK_FORWARD_LIST_ITEM_H
+#define DALI_PLUGIN_TIZEN_WEB_ENGINE_BACK_FORWARD_LIST_ITEM_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <ewk_back_forward_list_item.h>
+
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h>
+
+namespace Dali
+{
+namespace Plugin
+{
+
+/**
+ * @brief A class TizenWebEngineBackForwardListItem for back-forward list item.
+ */
+class TizenWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem
+{
+
+public:
+
+ /**
+ * @brief Constructor.
+ */
+ TizenWebEngineBackForwardListItem( Ewk_Back_Forward_List_Item* );
+
+ /**
+ * @brief Destructor.
+ */
+ ~TizenWebEngineBackForwardListItem();
+
+ /**
+ * @brief Returns the URL of the item.
+ *
+ * @details The returned URL may differ from the original URL (For example,
+ * if the page is redirected).
+ *
+ * @return The URL of the @a item,
+ * otherwise @c "" in case of an error
+ */
+ std::string GetUrl() const override;
+
+ /**
+ * @brief Returns the title of the item.
+ *
+ * @return The title of the @a item,
+ * otherwise @c "" in case of an error
+ */
+ std::string GetTitle() const override;
+
+ /**
+ * @brief Returns the original URL of the item.
+ *
+ * @return The original URL of the @a item,
+ * otherwise @c "" in case of an error
+ */
+ std::string GetOriginalUrl() const override;
+
+private:
+
+ Ewk_Back_Forward_List_Item* ewkBackForwardListItem;
+
+};
+
+} // namespace Plugin
+} // namespace Dali
+
+#endif // DALI_PLUGIN_TIZEN_WEB_ENGINE_BACK_FORWARD_LIST_ITEM_H
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "tizen-web-engine-back-forward-list-item.h"
+#include "tizen-web-engine-back-forward-list.h"
+
+namespace Dali
+{
+namespace Plugin
+{
+
+TizenWebEngineBackForwardList::TizenWebEngineBackForwardList( Ewk_Back_Forward_List* list )
+ : ewkBackForwardList( list )
+{
+}
+
+TizenWebEngineBackForwardList::~TizenWebEngineBackForwardList()
+{
+}
+
+Dali::WebEngineBackForwardListItem& TizenWebEngineBackForwardList::GetCurrentItem() const
+{
+ static TizenWebEngineBackForwardListItem itemCache( 0 );
+ Ewk_Back_Forward_List_Item* item = ewk_back_forward_list_current_item_get( ewkBackForwardList );
+ itemCache = TizenWebEngineBackForwardListItem( item );
+ return itemCache;
+}
+
+Dali::WebEngineBackForwardListItem& TizenWebEngineBackForwardList::GetItemAtIndex( uint32_t index ) const
+{
+ static TizenWebEngineBackForwardListItem itemCache( 0 );
+ Ewk_Back_Forward_List_Item* item = ewk_back_forward_list_item_at_index_get( ewkBackForwardList, index );
+ itemCache = TizenWebEngineBackForwardListItem( item );
+ return itemCache;
+}
+
+uint32_t TizenWebEngineBackForwardList::GetItemCount() const
+{
+ return ewk_back_forward_list_count( ewkBackForwardList );
+}
+
+} // namespace Plugin
+} // namespace Dali
\ No newline at end of file
--- /dev/null
+#ifndef DALI_PLUGIN_TIZEN_WEB_ENGINE_BACK_FORWARD_LIST_H
+#define DALI_PLUGIN_TIZEN_WEB_ENGINE_BACK_FORWARD_LIST_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <ewk_back_forward_list.h>
+
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
+
+namespace Dali
+{
+namespace Plugin
+{
+
+class WebEngineBackForwardListItem;
+
+/**
+ * @brief A class TizenWebEngineBackForwardList for back-forward list of chromium.
+ */
+class TizenWebEngineBackForwardList : public Dali::WebEngineBackForwardList
+{
+
+public:
+
+ /**
+ * @brief Constructor.
+ */
+ TizenWebEngineBackForwardList( Ewk_Back_Forward_List* );
+
+ /**
+ * @brief Destructor.
+ */
+ ~TizenWebEngineBackForwardList();
+
+ /**
+ * @brief Returns the current item in the @a list.
+ *
+ * @param[in] list The back-forward list instance
+ *
+ * @return The current item in the @a list,\n
+ * otherwise @c NULL in case of an error
+ */
+ Dali::WebEngineBackForwardListItem& GetCurrentItem() const override;
+
+ /**
+ * @brief Returns the item at a given @a index relative to the current item.
+ *
+ * @param[in] index The index of the item
+ *
+ * @return The item at a given @a index relative to the current item,\n
+ * otherwise @c NULL in case of an error
+ */
+ Dali::WebEngineBackForwardListItem& GetItemAtIndex( uint32_t index ) const override;
+
+ /**
+ * @brief Returns the length of the back-forward list including the current
+ * item.
+ *
+ * @return The length of the back-forward list including the current item,\n
+ * otherwise @c 0 in case of an error
+ */
+ uint32_t GetItemCount() const override;
+
+private:
+
+ Ewk_Back_Forward_List* ewkBackForwardList;
+
+};
+} // namespace Plugin
+} // namespace Dali
+
+#endif // DALI_PLUGIN_TIZEN_WEB_ENGINE_BACK_FORWARD_LIST_H
*
*/
-#include <tizen-web-engine-chromium.h>
+#include "tizen-web-engine-chromium.h"
+
+#include "tizen-web-engine-back-forward-list.h"
+#include "tizen-web-engine-context.h"
+#include "tizen-web-engine-cookie-manager.h"
+#include "tizen-web-engine-settings.h"
#include <Ecore.h>
#include <Ecore_Evas.h>
#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/adaptor-framework/adaptor.h>
+#include <dali/public-api/images/pixel-data.h>
using namespace Dali;
namespace Plugin
{
+namespace
+{
+// const
+const std::string EMPTY_STRING;
+}
+
class WebViewContainerClientPair {
public:
WebViewContainerClientPair( WebViewContainerClient* client, Evas_Object* webView )
: mClient( client ),
mWidth( width ),
mHeight( height ),
- mCookieAcceptancePolicy( EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY )
+ mCookieAcceptancePolicy( EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY ),
+ mWebEngineSettings( 0 ),
+ mWebEngineContext( 0 ),
+ mWebEngineCookieManager( 0 ),
+ mWebEngineBackForwardList( 0 )
+ {
+ InitWebView( 0, 0 );
+
+ WebEngineManager::Get().AddContainerClient( &mClient, mWebView );
+ }
+
+ WebViewContainerForDali( WebViewContainerClient& client, int width, int height, int argc, char** argv )
+ : mClient( client ),
+ mWidth( width ),
+ mHeight( height ),
+ mCookieAcceptancePolicy( EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY ),
+ mWebEngineSettings( 0 ),
+ mWebEngineContext( 0 ),
+ mWebEngineCookieManager( 0 ),
+ mWebEngineBackForwardList( 0 )
{
- InitWebView();
+ InitWebView( argc, argv );
WebEngineManager::Get().AddContainerClient( &mClient, mWebView );
}
evas_object_del( mWebView );
}
- void InitWebView()
+ void InitWebView( int argc, char** argv )
{
+ if ( argc > 0 )
+ {
+ ewk_set_arguments( argc, argv );
+ }
+
Ecore_Wl2_Window* win = AnyCast< Ecore_Wl2_Window* >( Adaptor::Get().GetNativeWindowHandle() );
Ewk_Context* context = ewk_context_default_get();
ewk_context_max_refresh_rate_set( context, 60 );
ewk_view_offscreen_rendering_enabled_set( mWebView, true );
ewk_view_ime_window_set( mWebView, win );
+ Ewk_Settings* settings = ewk_view_settings_get( mWebView );
+ mWebEngineSettings = TizenWebEngineSettings( settings );
+
+ context = ewk_view_context_get( mWebView );
+ mWebEngineContext = TizenWebEngineContext( context );
+
+ Ewk_Cookie_Manager* manager = ewk_context_cookie_manager_get( context );
+ mWebEngineCookieManager = TizenWebEngineCookieManager( manager );
+
+ Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get( mWebView );
+ mWebEngineBackForwardList = TizenWebEngineBackForwardList( backForwardList );
+
+ ewk_settings_viewport_meta_tag_set(settings, false);
+
evas_object_smart_callback_add( mWebView, "offscreen,frame,rendered",
&WebViewContainerForDali::OnFrameRendered,
&mClient );
return std::string( ewk_view_url_get( mWebView ) );
}
+ std::string GetTitle()
+ {
+ return std::string( ewk_view_title_get( mWebView ) );
+ }
+
+ Dali::PixelData GetFavicon()
+ {
+ Evas_Object* iconObject = ewk_view_favicon_get( mWebView );
+ if ( !iconObject )
+ {
+ return Dali::PixelData();
+ }
+
+ int width = 0, height = 0;
+ evas_object_image_size_get( iconObject, &width, &height );
+
+ uint32_t bufferSize = width * height * 4;
+ uint8_t* convertedBuffer = new uint8_t[ bufferSize ];
+
+ // color-space is argb8888.
+ uint8_t* pixelBuffer = ( uint8_t* ) evas_object_image_data_get( iconObject, false );
+
+ // convert the color-space to rgba8888.
+ for( uint32_t i = 0; i < bufferSize; i += 4 )
+ {
+ convertedBuffer[ i ] = pixelBuffer[ i + 1 ];
+ convertedBuffer[ i + 1 ] = pixelBuffer[ i + 2 ];
+ convertedBuffer[ i + 2 ] = pixelBuffer[ i + 3 ];
+ convertedBuffer[ i + 3 ] = pixelBuffer[ i ];
+ }
+
+ return Dali::PixelData::New( convertedBuffer, bufferSize, width, height,
+ Dali::Pixel::Format::RGBA8888,
+ Dali::PixelData::ReleaseFunction::DELETE_ARRAY );
+ }
+
void Reload()
{
ewk_view_reload( mWebView );
ewk_view_javascript_message_handler_add( mWebView, &WebViewContainerForDali::OnJavaScriptMessage, exposedObjectName.c_str() );
}
- void ClearHistory()
- {
- ewk_view_back_forward_list_clear( mWebView );
- }
-
- void ClearCache()
- {
- ewk_context_cache_clear( ewk_view_context_get( mWebView ) );
- }
-
- void ClearCookies()
- {
- ewk_cookie_manager_cookies_clear( ewk_context_cookie_manager_get( ewk_view_context_get( mWebView ) ) );
- }
-
- Ewk_Cache_Model GetCacheModel()
+ void ClearAllTilesResources()
{
- return ewk_context_cache_model_get( ewk_view_context_get( mWebView ) );
+ ewk_view_clear_all_tiles_resources( mWebView );
}
- void SetCacheModel( Ewk_Cache_Model cacheModel )
- {
- ewk_context_cache_model_set( ewk_view_context_get( mWebView ), cacheModel );
- }
-
- Ewk_Cookie_Accept_Policy GetCookieAcceptPolicy()
- {
- return mCookieAcceptancePolicy;
- }
-
- void SetCookieAcceptPolicy( Ewk_Cookie_Accept_Policy policy )
+ void ClearHistory()
{
- ewk_cookie_manager_accept_policy_set( ewk_context_cookie_manager_get( ewk_view_context_get( mWebView ) ), policy );
- mCookieAcceptancePolicy = policy;
+ ewk_view_back_forward_list_clear( mWebView );
}
const std::string& GetUserAgent()
ewk_view_user_agent_set( mWebView, userAgent.c_str() );
}
- bool IsJavaScriptEnabled()
+ Dali::WebEngineSettings& GetSettings()
{
- return ewk_settings_javascript_enabled_get( ewk_view_settings_get( mWebView ) );
+ return mWebEngineSettings;
}
- void EnableJavaScript( bool enabled )
+ Dali::WebEngineContext& GetContext()
{
- ewk_settings_javascript_enabled_set( ewk_view_settings_get( mWebView ), enabled );
+ return mWebEngineContext;
}
- bool AreImagesAutomaticallyLoaded()
+ Dali::WebEngineCookieManager& GetCookieManager()
{
- return ewk_settings_loads_images_automatically_get( ewk_view_settings_get( mWebView ) );
+ return mWebEngineCookieManager;
}
- void LoadImagesAutomatically( bool automatic )
+ Dali::WebEngineBackForwardList& GetBackForwardList()
{
- ewk_settings_loads_images_automatically_set( ewk_view_settings_get( mWebView ), automatic );
- }
-
- const std::string& GetDefaultTextEncodingName()
- {
- mDefaultTextEncodingName = std::string( ewk_settings_default_text_encoding_name_get( ewk_view_settings_get( mWebView ) ) );
- return mDefaultTextEncodingName;
- }
-
- void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
- {
- ewk_settings_default_text_encoding_name_set( ewk_view_settings_get( mWebView ), defaultTextEncodingName.c_str() );
- }
-
- int GetDefaultFontSize()
- {
- return ewk_settings_default_font_size_get( ewk_view_settings_get( mWebView ) );
- }
-
- void SetDefaultFontSize( int defaultFontSize )
- {
- ewk_settings_default_font_size_set( ewk_view_settings_get( mWebView ), defaultFontSize );
+ return mWebEngineBackForwardList;
}
void SetSize( int width, int height )
Eina_List* pointList = 0;
Ewk_Touch_Point* point = new Ewk_Touch_Point;
point->id = 0;
- point->x = touch.GetLocalPosition( 0 ).x;
- point->y = touch.GetLocalPosition( 0 ).y;
+ point->x = touch.GetScreenPosition( 0 ).x;
+ point->y = touch.GetScreenPosition( 0 ).y;
point->state = state;
pointList = eina_list_append( pointList, point );
Ewk_Cookie_Accept_Policy mCookieAcceptancePolicy;
std::string mUserAgent;
std::string mDefaultTextEncodingName;
+
+ TizenWebEngineSettings mWebEngineSettings;
+ TizenWebEngineContext mWebEngineContext;
+ TizenWebEngineCookieManager mWebEngineCookieManager;
+ TizenWebEngineBackForwardList mWebEngineBackForwardList;
};
class TBMSurfaceSourceInitializer
const std::string& locale,
const std::string& timezoneID )
{
- mWebViewContainer =
- new WebViewContainerForDali( *this, width, height );
+ mWebViewContainer = new WebViewContainerForDali( *this, width, height );
+ TBMSurfaceSourceInitializer initializer( mDaliImageSrc, width, height );
+}
+
+void TizenWebEngineChromium::Create( int width, int height,
+ int argc, char** argv )
+{
+ mWebViewContainer = new WebViewContainerForDali( *this, width, height, argc, argv );
TBMSurfaceSourceInitializer initializer( mDaliImageSrc, width, height );
}
}
}
+std::string TizenWebEngineChromium::GetTitle() const
+{
+ return mWebViewContainer ? mWebViewContainer->GetTitle() : EMPTY_STRING;
+}
+
+Dali::PixelData TizenWebEngineChromium::GetFavicon() const
+{
+ return mWebViewContainer ? mWebViewContainer->GetFavicon() : Dali::PixelData();
+}
+
NativeImageInterfacePtr TizenWebEngineChromium::GetNativeImageSource()
{
return mDaliImageSrc;
return mUrl;
}
-void TizenWebEngineChromium::LoadHTMLString( const std::string& string )
+void TizenWebEngineChromium::LoadHtmlString( const std::string& string )
{
if( mWebViewContainer )
{
}
}
-void TizenWebEngineChromium::ClearHistory()
-{
- if( mWebViewContainer )
- {
- mWebViewContainer->ClearHistory();
- }
-}
-
-void TizenWebEngineChromium::ClearCache()
-{
- if( mWebViewContainer )
- {
- mWebViewContainer->ClearCache();
- }
-}
-
-void TizenWebEngineChromium::ClearCookies()
-{
- if( mWebViewContainer )
- {
- mWebViewContainer->ClearCookies();
- }
-}
-
-Dali::WebEnginePlugin::CacheModel TizenWebEngineChromium::GetCacheModel() const
-{
- if( mWebViewContainer )
- {
- return static_cast< Dali::WebEnginePlugin::CacheModel >( mWebViewContainer->GetCacheModel() );
- }
- return Dali::WebEnginePlugin::CacheModel::DOCUMENT_VIEWER;
-}
-
-void TizenWebEngineChromium::SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel )
+void TizenWebEngineChromium::ClearAllTilesResources()
{
if( mWebViewContainer )
{
- return mWebViewContainer->SetCacheModel( static_cast< Ewk_Cache_Model >( cacheModel ) );
+ mWebViewContainer->ClearAllTilesResources();
}
}
-Dali::WebEnginePlugin::CookieAcceptPolicy TizenWebEngineChromium::GetCookieAcceptPolicy() const
-{
- if( mWebViewContainer )
- {
- return static_cast< Dali::WebEnginePlugin::CookieAcceptPolicy >( mWebViewContainer->GetCookieAcceptPolicy() );
- }
- return Dali::WebEnginePlugin::CookieAcceptPolicy::NO_THIRD_PARTY;
-}
-
-void TizenWebEngineChromium::SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy )
+void TizenWebEngineChromium::ClearHistory()
{
if( mWebViewContainer )
{
- mWebViewContainer->SetCookieAcceptPolicy( static_cast< Ewk_Cookie_Accept_Policy >( policy ) );
+ mWebViewContainer->ClearHistory();
}
}
-const std::string kEmpty;
-
const std::string& TizenWebEngineChromium::GetUserAgent() const
{
if( mWebViewContainer )
{
return mWebViewContainer->GetUserAgent();
}
- return kEmpty;
+ return EMPTY_STRING;
}
void TizenWebEngineChromium::SetUserAgent( const std::string& userAgent )
}
}
-bool TizenWebEngineChromium::IsJavaScriptEnabled() const
-{
- if( mWebViewContainer )
- {
- return mWebViewContainer->IsJavaScriptEnabled();
- }
- return false;
-}
-
-void TizenWebEngineChromium::EnableJavaScript( bool enabled )
+Dali::WebEngineSettings& TizenWebEngineChromium::GetSettings() const
{
- if( mWebViewContainer )
+ if( !mWebViewContainer )
{
- mWebViewContainer->EnableJavaScript( enabled );
+ DALI_LOG_ERROR( "Web engine is not created successfully!" );
}
+ return mWebViewContainer->GetSettings();
}
-bool TizenWebEngineChromium::AreImagesAutomaticallyLoaded() const
+Dali::WebEngineContext& TizenWebEngineChromium::GetContext() const
{
- if( mWebViewContainer )
+ if( !mWebViewContainer )
{
- return mWebViewContainer->AreImagesAutomaticallyLoaded();
+ DALI_LOG_ERROR( "Web engine is not created successfully!" );
}
- return false;
+ return mWebViewContainer->GetContext();
}
-void TizenWebEngineChromium::LoadImagesAutomatically( bool automatic )
+Dali::WebEngineCookieManager& TizenWebEngineChromium::GetCookieManager() const
{
- if( mWebViewContainer )
+ if( !mWebViewContainer )
{
- mWebViewContainer->LoadImagesAutomatically( automatic );
+ DALI_LOG_ERROR( "Web engine is not created successfully!" );
}
+ return mWebViewContainer->GetCookieManager();
}
-const std::string& TizenWebEngineChromium::GetDefaultTextEncodingName() const
+Dali::WebEngineBackForwardList& TizenWebEngineChromium::GetBackForwardList() const
{
- if( mWebViewContainer )
- {
- return mWebViewContainer->GetDefaultTextEncodingName();
- }
- return kEmpty;
-}
-
-void TizenWebEngineChromium::SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
-{
- if( mWebViewContainer )
- {
- mWebViewContainer->SetDefaultTextEncodingName( defaultTextEncodingName );
- }
-}
-
-int TizenWebEngineChromium::GetDefaultFontSize() const
-{
- if( mWebViewContainer )
- {
- return mWebViewContainer->AreImagesAutomaticallyLoaded();
- }
- return 0;
-}
-
-void TizenWebEngineChromium::SetDefaultFontSize( int defaultFontSize )
-{
- if( mWebViewContainer )
+ if( !mWebViewContainer )
{
- mWebViewContainer->SetDefaultFontSize( defaultFontSize );
+ DALI_LOG_ERROR( "Web engine is not created successfully!" );
}
+ return mWebViewContainer->GetBackForwardList();
}
void TizenWebEngineChromium::SetSize( int width, int height )
namespace Dali
{
+
+class PixelData;
+
namespace Plugin
{
// WebEnginePlugin Interface
-
/**
* @copydoc Dali::WebEnginePlugin::Create()
*/
void Create( int width, int height, const std::string& locale, const std::string& timezoneID ) override;
/**
+ * @copydoc Dali::WebEnginePlugin::Create()
+ */
+ void Create( int width, int height, int argc, char** argv ) override;
+
+ /**
* @copydoc Dali::WebEnginePlugin::Destroy()
*/
void Destroy() override;
/**
+ * @copydoc Dali::WebEnginePlugin::GetSettings()
+ */
+ Dali::WebEngineSettings& GetSettings() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::GetContext()
+ */
+ Dali::WebEngineContext& GetContext() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::GetCookieManager()
+ */
+ Dali::WebEngineCookieManager& GetCookieManager() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::GetBackForwardList()
+ */
+ Dali::WebEngineBackForwardList& GetBackForwardList() const override;
+
+ /**
* @copydoc Dali::WebEnginePlugin::LoadUrl()
*/
void LoadUrl( const std::string& url ) override;
NativeImageInterfacePtr GetNativeImageSource() override;
/**
+ * @copydoc Dali::WebEnginePlugin::GetTitle()
+ */
+ std::string GetTitle() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::GetFavicon()
+ */
+ Dali::PixelData GetFavicon() const override;
+
+ /**
* @copydoc Dali::WebEnginePlugin::GetUrl()
*/
const std::string& GetUrl() override;
/**
- * @copydoc Dali::WebEnginePlugin::LoadHTMLString()
+ * @copydoc Dali::WebEnginePlugin::LoadHtmlString()
*/
- void LoadHTMLString( const std::string& string ) override;
+ void LoadHtmlString( const std::string& string ) override;
/**
* @copydoc Dali::WebEnginePlugin::Reload()
void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler ) override;
/**
- * @copydoc Dali::WebEnginePlugin::ClearHistory()
- */
- void ClearHistory() override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::ClearCache()
- */
- void ClearCache() override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::ClearCookies()
- */
- void ClearCookies() override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::GetCacheModel()
- */
- Dali::WebEnginePlugin::CacheModel GetCacheModel() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::SetCacheModel()
+ * @copydoc Dali::WebEnginePlugin::ClearAllTilesResources()
*/
- void SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel ) override;
+ void ClearAllTilesResources() override;
/**
- * @copydoc Dali::WebEnginePlugin::GetCookieAcceptPolicy()
- */
- Dali::WebEnginePlugin::CookieAcceptPolicy GetCookieAcceptPolicy() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::SetCookieAcceptPolicy()
+ * @copydoc Dali::WebEnginePlugin::ClearHistory()
*/
- void SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy ) override;
+ void ClearHistory() override;
/**
* @copydoc Dali::WebEnginePlugin::GetUserAgent()
void SetUserAgent( const std::string& userAgent ) override;
/**
- * @copydoc Dali::WebEnginePlugin::IsJavaScriptEnabled()
- */
- bool IsJavaScriptEnabled() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::EnableJavaScript()
- */
- void EnableJavaScript( bool enabled ) override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::AreImagesAutomaticallyLoaded()
- */
- bool AreImagesAutomaticallyLoaded() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::LoadImagesAutomatically()
- */
- void LoadImagesAutomatically( bool automatic ) override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::GetDefaultTextEncodingName()
- */
- const std::string& GetDefaultTextEncodingName() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::SetDefaultTextEncodingName()
- */
- void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::GetDefaultFontSize()
- */
- int GetDefaultFontSize() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::SetDefaultFontSize()
- */
- void SetDefaultFontSize( int defaultFontSize ) override;
-
- /**
* @copydoc Dali::WebEnginePlugin::SetSize()
*/
void SetSize( int width, int height ) override;
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "tizen-web-engine-context.h"
+
+#include <ewk_context.h>
+#include <ewk_context_internal.h>
+#include <ewk_context_product.h>
+
+namespace Dali
+{
+namespace Plugin
+{
+
+TizenWebEngineContext::TizenWebEngineContext( Ewk_Context* context )
+ : ewkContext( context )
+{
+}
+
+TizenWebEngineContext::~TizenWebEngineContext()
+{
+}
+
+Dali::WebEngineContext::CacheModel TizenWebEngineContext::GetCacheModel() const
+{
+ return static_cast< Dali::WebEngineContext::CacheModel >( ewk_context_cache_model_get( ewkContext ) );
+}
+
+void TizenWebEngineContext::SetCacheModel( Dali::WebEngineContext::CacheModel cacheModel )
+{
+ ewk_context_cache_model_set( ewkContext, static_cast< Ewk_Cache_Model >( cacheModel ) );
+}
+
+void TizenWebEngineContext::SetProxyUri( const std::string& uri )
+{
+ ewk_context_proxy_uri_set( ewkContext, uri.c_str() );
+}
+
+void TizenWebEngineContext::SetDefaultProxyAuth( const std::string& username, const std::string& password )
+{
+ ewk_context_proxy_default_auth_set( ewkContext, username.c_str(), password.c_str() );
+}
+
+void TizenWebEngineContext::SetCertificateFilePath( const std::string& certificatePath )
+{
+ ewk_context_certificate_file_set( ewkContext, certificatePath.c_str() );
+}
+
+void TizenWebEngineContext::DeleteWebDatabase()
+{
+ ewk_context_web_database_delete_all( ewkContext );
+}
+
+void TizenWebEngineContext::DeleteWebStorage()
+{
+ ewk_context_web_storage_delete_all( ewkContext );
+}
+
+void TizenWebEngineContext::DeleteLocalFileSystem()
+{
+ ewk_context_local_file_system_all_delete( ewkContext );
+}
+
+void TizenWebEngineContext::DisableCache( bool cacheDisabled )
+{
+ ewk_context_cache_disabled_set( ewkContext, cacheDisabled );
+}
+
+void TizenWebEngineContext::ClearCache()
+{
+ ewk_context_cache_clear( ewkContext );
+}
+
+} // namespace Plugin
+} // namespace Dali
--- /dev/null
+#ifndef DALI_PLUGIN_WEB_ENGINE_CONTEXT_H
+#define DALI_PLUGIN_WEB_ENGINE_CONTEXT_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+
+struct Ewk_Context;
+
+namespace Dali
+{
+namespace Plugin
+{
+
+/**
+ * @brief A class TizenWebEngineContext for context of chromium.
+ */
+class TizenWebEngineContext : public Dali::WebEngineContext
+{
+
+public:
+
+ /**
+ * @brief Constructor.
+ */
+ TizenWebEngineContext( Ewk_Context* );
+
+ /**
+ * @brief Destructor.
+ */
+ ~TizenWebEngineContext();
+
+ /**
+ * @brief Returns the cache model type.
+ *
+ * @return #Dali::WebEngineContext::CacheModel
+ */
+ CacheModel GetCacheModel() const override;
+
+ /**
+ * @brief Requests to set the cache model.
+ *
+ * @param[in] cacheModel The cache model
+ */
+ void SetCacheModel( CacheModel cacheModel ) override;
+
+ /**
+ * @brief Sets the given proxy URI to network backend of specific context.
+ *
+ * @param[in] uri, proxy URI to set
+ */
+ void SetProxyUri( const std::string& uri ) override;
+
+ /**
+ * @brief Sets a proxy auth credential to network backend of specific context.
+ *
+ * @details Normally, proxy auth credential should be got from the callback
+ * set by ewk_view_authentication_callback_set, once the username in
+ * this API has been set with a non-null value, the authentication
+ * callback will never been invoked. Try to avoid using this API.
+ *
+ * @param[in] username username to set
+ * @param[in] password password to set
+ */
+ void SetDefaultProxyAuth( const std::string& username, const std::string& password ) override;
+
+ /**
+ * Adds CA certificates to persistent NSS certificate database
+ *
+ * Function accepts a path to a CA certificate file, a path to a directory
+ * containing CA certificate files, or a colon-seprarated list of those.
+ *
+ * Certificate files should have *.crt extension.
+ *
+ * Directories are traversed recursively.
+ *
+ * @param[in] certificatePath path to a CA certificate file(s), see above for details
+ */
+ void SetCertificateFilePath( const std::string& certificatePath ) override;
+
+ /**
+ * Requests for deleting all web databases.
+ */
+ void DeleteWebDatabase() override;
+
+ /**
+ * @brief Deletes web storage.
+ *
+ * @details This function does not ensure that all data will be removed.
+ * Should be used to extend free physical memory.
+ *
+ * @param[in] context Context object
+ */
+ void DeleteWebStorage() override;
+
+ /**
+ * @brief Requests for deleting all local file systems.
+ */
+ void DeleteLocalFileSystem() override;
+
+ /**
+ * Toggles the cache to be enabled or disabled
+ *
+ * Function works asynchronously.
+ * By default the cache is disabled resulting in not storing network data on disk.
+ *
+ * @param[in] cacheDisabled enable or disable cache
+ */
+ void DisableCache( bool cacheDisabled ) override;
+
+ /**
+ * @brief Requests to clear cache
+ */
+ void ClearCache() override;
+
+private:
+
+ Ewk_Context* ewkContext;
+
+};
+} // namespace Plugin
+} // namespace Dali
+
+#endif // DALI_PLUGIN_WEB_ENGINE_CONTEXT_H
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "tizen-web-engine-cookie-manager.h"
+
+#include <ewk_cookie_manager.h>
+
+namespace Dali
+{
+namespace Plugin
+{
+
+TizenWebEngineCookieManager::TizenWebEngineCookieManager( Ewk_Cookie_Manager* manager )
+ : ewkCookieManager( manager )
+{
+}
+
+TizenWebEngineCookieManager::~TizenWebEngineCookieManager()
+{
+}
+
+void TizenWebEngineCookieManager::SetCookieAcceptPolicy( Dali::WebEngineCookieManager::CookieAcceptPolicy policy )
+{
+ ewk_cookie_manager_accept_policy_set( ewkCookieManager, static_cast< Ewk_Cookie_Accept_Policy >( policy ) );
+}
+
+Dali::WebEngineCookieManager::CookieAcceptPolicy TizenWebEngineCookieManager::GetCookieAcceptPolicy() const
+{
+ //todo...
+ return Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY;
+}
+
+void TizenWebEngineCookieManager::SetPersistentStorage( const std::string& path, Dali::WebEngineCookieManager::CookiePersistentStorage storage )
+{
+ ewk_cookie_manager_persistent_storage_set( ewkCookieManager, path.c_str(), static_cast< Ewk_Cookie_Persistent_Storage >( storage ) );
+}
+
+void TizenWebEngineCookieManager::ClearCookies()
+{
+ ewk_cookie_manager_cookies_clear( ewkCookieManager );
+}
+
+} // namespace Plugin
+} // namespace Dali
--- /dev/null
+#ifndef DALI_PLUGIN_WEB_ENGINE_COOKIE_MANAGER_H
+#define DALI_PLUGIN_WEB_ENGINE_COOKIE_MANAGER_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
+
+struct Ewk_Cookie_Manager;
+
+namespace Dali
+{
+namespace Plugin
+{
+
+/**
+ * @brief A class TizenWebEngineCookieManager for cookie manager of chromium.
+ */
+class TizenWebEngineCookieManager : public Dali::WebEngineCookieManager
+{
+
+public:
+
+ /**
+ * @brief Constructor.
+ */
+ TizenWebEngineCookieManager( Ewk_Cookie_Manager* );
+
+ /**
+ * @brief Destructor.
+ */
+ ~TizenWebEngineCookieManager();
+
+ /**
+ * @brief Sets @a policy as the cookie acceptance policy for @a manager.
+ *
+ * @details By default, only cookies set by the main document loaded are
+ * accepted.
+ *
+ * @param[in] policy A #Dali::WebEngineCookieManager::CookieAcceptPolicy
+ */
+ void SetCookieAcceptPolicy( CookieAcceptPolicy policy ) override;
+
+ /**
+ * @brief Gets the cookie acceptance policy.
+ * The default is Dali::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY.
+ * @see Dali::WebEngineCookieManager::CookieAcceptPolicy::Type
+ */
+ CookieAcceptPolicy GetCookieAcceptPolicy() const override;
+
+ /**
+ * @brief Sets the @a path where non-session cookies are stored persistently using
+ * @a storage as the format to read/write the cookies.
+ *
+ * @details Cookies are initially read from @a path/Cookies to create an initial
+ * set of cookies. Then, non-session cookies will be written to @a path/Cookies.
+ * By default, @a manager doesn't store the cookies persistently, so you need to
+ * call this method to keep cookies saved across sessions.
+ * If @a path does not exist it will be created.
+ *
+ * @param[in] path The path where to read/write Cookies
+ * @param[in] storage The type of storage
+ */
+ void SetPersistentStorage( const std::string& path, CookiePersistentStorage storage ) override;
+
+ /**
+ * @brief Deletes all the cookies of @a manager.
+ */
+ void ClearCookies() override;
+
+private:
+
+ Ewk_Cookie_Manager* ewkCookieManager;
+
+};
+} // namespace Plugin
+} // namespace Dali
+
+#endif // DALI_PLUGIN_WEB_ENGINE_COOKIE_MANAGER_H
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <tizen-web-engine-settings.h>
+
+#include <ewk_settings.h>
+#include <ewk_settings_product.h>
+
+namespace Dali
+{
+namespace Plugin
+{
+
+TizenWebEngineSettings::TizenWebEngineSettings( Ewk_Settings* settings )
+ : ewkSettings( settings )
+{
+}
+
+TizenWebEngineSettings::~TizenWebEngineSettings()
+{
+}
+
+void TizenWebEngineSettings::AllowMixedContents( bool allowed )
+{
+ ewk_settings_mixed_contents_set( ewkSettings, allowed );
+}
+
+void TizenWebEngineSettings::EnableSpatialNavigation( bool enabled )
+{
+ ewk_settings_spatial_navigation_enabled_set( ewkSettings, enabled );
+}
+
+uint32_t TizenWebEngineSettings::GetDefaultFontSize() const
+{
+ return ewk_settings_default_font_size_get( ewkSettings );
+}
+
+void TizenWebEngineSettings::SetDefaultFontSize( uint32_t size )
+{
+ ewk_settings_default_font_size_set( ewkSettings, size );
+}
+
+void TizenWebEngineSettings::EnableWebSecurity( bool enabled )
+{
+ ewk_settings_web_security_enabled_set( ewkSettings, enabled );
+}
+
+void TizenWebEngineSettings::AllowFileAccessFromExternalUrl( bool allowed )
+{
+ ewk_settings_allow_file_access_from_external_url_set( ewkSettings, allowed );
+}
+
+bool TizenWebEngineSettings::IsJavaScriptEnabled() const
+{
+ return ewk_settings_javascript_enabled_get( ewkSettings );
+}
+
+void TizenWebEngineSettings::EnableJavaScript( bool enabled )
+{
+ ewk_settings_javascript_enabled_set( ewkSettings, enabled );
+}
+
+void TizenWebEngineSettings::AllowScriptsOpenWindows( bool allowed )
+{
+ ewk_settings_scripts_window_open_set( ewkSettings, allowed );
+}
+
+bool TizenWebEngineSettings::AreImagesLoadedAutomatically() const
+{
+ return ewk_settings_loads_images_automatically_get( ewkSettings );
+}
+
+void TizenWebEngineSettings::AllowImagesLoadAutomatically( bool automatic )
+{
+ ewk_settings_loads_images_automatically_set( ewkSettings, automatic );
+}
+
+std::string TizenWebEngineSettings::GetDefaultTextEncodingName() const
+{
+ return std::string( ewk_settings_default_text_encoding_name_get( ewkSettings ) );
+}
+
+void TizenWebEngineSettings::SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
+{
+ ewk_settings_default_text_encoding_name_set( ewkSettings, defaultTextEncodingName.c_str() );
+}
+
+} // namespace Plugin
+} // namespace Dali
--- /dev/null
+#ifndef DALI_PLUGIN_WEB_ENGINE_SETTINGS_H
+#define DALI_PLUGIN_WEB_ENGINE_SETTINGS_H
+
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <dali/devel-api/adaptor-framework/web-engine-settings.h>
+
+struct Ewk_Settings;
+
+namespace Dali
+{
+namespace Plugin
+{
+
+/**
+ * @brief A class TizenWebEngineSettings for settings of chromium.
+ */
+class TizenWebEngineSettings : public Dali::WebEngineSettings
+{
+
+public:
+
+ /**
+ * @brief Constructor.
+ */
+ TizenWebEngineSettings( Ewk_Settings* );
+
+ /**
+ * @brief Destructor.
+ */
+ ~TizenWebEngineSettings();
+
+ /**
+ *@brief Allow running mixed contents or not.
+ *
+ * @param[in] allowed if true, allow to run mixed contents,
+ * otherwise not allow
+ */
+ void AllowMixedContents( bool allowed ) override;
+
+ /**
+ * @brief Enable the spatial navigation or not.
+ *
+ * @param[in] enabled if true, use spatial navigation,
+ * otherwise to disable
+ */
+ void EnableSpatialNavigation( bool enabled ) override;
+
+ /**
+ * @brief Get the default font size.
+ *
+ * @return defaut font size.
+ */
+ uint32_t GetDefaultFontSize() const override;
+
+ /**
+ * @brief Set the default font size.
+ *
+ * @param[in] size a new default font size to set
+ */
+ void SetDefaultFontSize( uint32_t size ) override;
+
+ /**
+ * @brief Enables/disables web security.
+ *
+ * @param[in] enabled if true, to enable the web security
+ * otherwise to disable
+ *
+ */
+ void EnableWebSecurity( bool enabled ) override;
+
+ /**
+ * @brief Allow/Disallow file access from external url
+ *
+ * @param[in] allowed if true, to allow file access from external url
+ * otherwise to disallow
+ */
+ void AllowFileAccessFromExternalUrl( bool allowed ) override;
+
+ /**
+ * @brief Check if javascript is enabled or not.
+ *
+ * @return true if enabled, false if disabled.
+ */
+ bool IsJavaScriptEnabled() const override;
+
+ /**
+ * @brief Enable/Disable javascript
+ *
+ * @param[in] enabled if true, to enable javascript
+ * otherwise to disable
+ */
+ void EnableJavaScript( bool enabled ) override;
+
+ /**
+ * @brief Enables/disables if the scripts can open new windows.
+ *
+ * @param[in] allowed if true, the scripts can open new windows,
+ * otherwise not
+ */
+ void AllowScriptsOpenWindows( bool allowed ) override;
+
+ /**
+ * @brief Check if images are loaded automatically or not.
+ *
+ * @return true if enabled, false if disabled.
+ */
+ bool AreImagesLoadedAutomatically() const override;
+
+ /**
+ * @brief Enable/Disable to load images automatically
+ *
+ * @param[in] automatic if true, to load images automatically,
+ * otherwise not
+ */
+ void AllowImagesLoadAutomatically( bool automatic ) override;
+
+ /**
+ * @brief Get the default encoding name.
+ *
+ * @return defaut encoding name.
+ */
+ std::string GetDefaultTextEncodingName() const override;
+
+ /**
+ * @brief Set the default encoding name.
+ *
+ * @param[in] defaultTextEncodingName a default encoding name to set
+ */
+ void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) override;
+
+private:
+
+ Ewk_Settings* ewkSettings;
+
+};
+} // namespace Plugin
+} // namespace Dali
+
+#endif // DALI_PLUGIN_WEB_ENGINE_SETTINGS_H
#include "tizen-web-engine-lwe.h"
// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
+#include <dali/devel-api/adaptor-framework/application-devel.h>
#include <dali/devel-api/common/stage.h>
+#include <dali/integration-api/debug.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/devel-api/adaptor-framework/application-devel.h>
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list.h>
+#include <dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h>
+#include <dali/devel-api/adaptor-framework/web-engine-context.h>
+#include <dali/devel-api/adaptor-framework/web-engine-cookie-manager.h>
+#include <dali/devel-api/adaptor-framework/web-engine-settings.h>
+#include <dali/public-api/images/pixel-data.h>
#include <unistd.h>
#include <pthread.h>
namespace
{
+const std::string EMPTY_STRING;
+
LWE::KeyValue KeyStringToKeyValue( const char* DALIKeyString, bool isShiftPressed )
{
LWE::KeyValue keyValue = LWE::KeyValue::UnidentifiedKey;
}
+void TizenWebEngineLWE::Create( int width, int height, int argc, char** argv )
+{
+ // NOT IMPLEMENTED
+}
+
void TizenWebEngineLWE::Destroy()
{
if( !mWebContainer )
mWebContainer = NULL;
}
+// NOT IMPLEMENTED
+class NullWebEngineSettings : public Dali::WebEngineSettings
+{
+public:
+ void AllowMixedContents( bool allowed ) override { }
+ void EnableSpatialNavigation( bool enabled ) override { }
+ uint32_t GetDefaultFontSize() const override { return 0; }
+ void SetDefaultFontSize( uint32_t size ) override { }
+ void EnableWebSecurity( bool enabled ) override { }
+ void AllowFileAccessFromExternalUrl( bool allowed ) override { }
+ bool IsJavaScriptEnabled() const override { return false; }
+ void EnableJavaScript( bool enabled ) override { }
+ void AllowScriptsOpenWindows( bool allowed ) override { }
+ bool AreImagesLoadedAutomatically() const override { return false; }
+ void AllowImagesLoadAutomatically( bool automatic ) override { }
+ std::string GetDefaultTextEncodingName() const override { return EMPTY_STRING; }
+ void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) override { }\r
+};
+
+Dali::WebEngineSettings& TizenWebEngineLWE::GetSettings() const
+{
+ // NOT IMPLEMENTED
+ static NullWebEngineSettings settings;
+ return settings;
+}
+
+// NOT IMPLEMENTED
+class NullWebEngineContext : public Dali::WebEngineContext
+{
+public:
+ CacheModel GetCacheModel() const override { return Dali::WebEngineContext::CacheModel::DOCUMENT_VIEWER; }
+ void SetCacheModel( CacheModel cacheModel ) override { }
+ void SetProxyUri( const std::string& uri ) override { }
+ void SetDefaultProxyAuth( const std::string& username, const std::string& password ) override { }
+ void SetCertificateFilePath( const std::string& certificatePath ) override { }
+ void DeleteWebDatabase() override { }
+ void DeleteWebStorage() override { }
+ void DeleteLocalFileSystem() override { }
+ void DisableCache( bool cacheDisabled ) override { }
+ void ClearCache() override { }
+};
+
+Dali::WebEngineContext& TizenWebEngineLWE::GetContext() const
+{
+ // NOT IMPLEMENTED
+ static NullWebEngineContext context;
+ return context;
+}
+
+// NOT IMPLEMENTED
+class NullWebEngineCookieManager : public Dali::WebEngineCookieManager
+{
+public:
+ void SetCookieAcceptPolicy( CookieAcceptPolicy policy ) override { }
+ CookieAcceptPolicy GetCookieAcceptPolicy() const override { return Dali::WebEngineCookieManager::CookieAcceptPolicy::ALWAYS; }
+ void SetPersistentStorage( const std::string& path, CookiePersistentStorage storage ) override { }
+ void ClearCookies() override { }
+};
+
+Dali::WebEngineCookieManager& TizenWebEngineLWE::GetCookieManager() const
+{
+ // NOT IMPLEMENTED
+ static NullWebEngineCookieManager cookieManager;
+ return cookieManager;
+}
+
+// NOT IMPLEMENTED
+class NullWebEngineBackForwardListItem : public Dali::WebEngineBackForwardListItem
+{
+public:
+ std::string GetUrl() const override { return EMPTY_STRING; }
+ std::string GetTitle() const override { return EMPTY_STRING; }
+ std::string GetOriginalUrl() const override { return EMPTY_STRING; }
+};
+
+// NOT IMPLEMENTED
+class NullWebEngineBackForwardList : public Dali::WebEngineBackForwardList
+{
+public:
+ NullWebEngineBackForwardList( WebEngineBackForwardListItem* pItem ) : item( pItem ) { }
+ Dali::WebEngineBackForwardListItem& GetCurrentItem() const override { return *item; }
+ Dali::WebEngineBackForwardListItem& GetItemAtIndex( uint32_t index ) const override { return *item; }
+ uint32_t GetItemCount() const override { return 1; }
+private:
+ WebEngineBackForwardListItem* item;
+};
+
+Dali::WebEngineBackForwardList& TizenWebEngineLWE::GetBackForwardList() const
+{
+ // NOT IMPLEMENTED
+ static NullWebEngineBackForwardListItem item;
+ static NullWebEngineBackForwardList list( &item );
+ return list;
+}
+
void TizenWebEngineLWE::DestroyInstance()
{
DALI_ASSERT_ALWAYS( mWebContainer );
mWebContainer->LoadURL( url );
}
+std::string TizenWebEngineLWE::GetTitle() const
+{
+ // NOT IMPLEMENTED
+ static const std::string kEmpty;
+ return kEmpty;
+}
+
+Dali::PixelData TizenWebEngineLWE::GetFavicon() const
+{
+ // NOT IMPLEMENTED
+ return Dali::PixelData();
+}
+
const std::string& TizenWebEngineLWE::GetUrl()
{
DALI_ASSERT_ALWAYS( mWebContainer );
return mUrl;
}
-void TizenWebEngineLWE::LoadHTMLString( const std::string& str )
+void TizenWebEngineLWE::LoadHtmlString( const std::string& str )
{
DALI_ASSERT_ALWAYS( mWebContainer );
mWebContainer->LoadData( str );
} );
}
-void TizenWebEngineLWE::ClearHistory()
-{
- DALI_ASSERT_ALWAYS( mWebContainer );
- mWebContainer->ClearHistory();
- mCanGoBack = mWebContainer->CanGoBack();
-}
-
-void TizenWebEngineLWE::ClearCache()
-{
- DALI_ASSERT_ALWAYS( mWebContainer );
- mWebContainer->ClearCache();
-}
-
-void TizenWebEngineLWE::ClearCookies()
-{
- // NOT IMPLEMENTED
-}
-
-Dali::WebEnginePlugin::CacheModel TizenWebEngineLWE::GetCacheModel() const
-{
- // NOT IMPLEMENTED
- return Dali::WebEnginePlugin::CacheModel::DOCUMENT_VIEWER;
-}
-
-void TizenWebEngineLWE::SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel )
-{
- // NOT IMPLEMENTED
-}
-
-Dali::WebEnginePlugin::CookieAcceptPolicy TizenWebEngineLWE::GetCookieAcceptPolicy() const
+void TizenWebEngineLWE::ClearAllTilesResources()
{
// NOT IMPLEMENTED
- return Dali::WebEnginePlugin::CookieAcceptPolicy::NO_THIRD_PARTY;
}
-void TizenWebEngineLWE::SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy )
+void TizenWebEngineLWE::ClearHistory()
{
- // NOT IMPLEMENTED
+ DALI_ASSERT_ALWAYS( mWebContainer );
+ mWebContainer->ClearHistory();
+ mCanGoBack = mWebContainer->CanGoBack();
}
const std::string& TizenWebEngineLWE::GetUserAgent() const
{
// NOT IMPLEMENTED
- static const std::string kEmpty;
- return kEmpty;
+ return EMPTY_STRING;
}
void TizenWebEngineLWE::SetUserAgent( const std::string& userAgent )
// NOT IMPLEMENTED
}
-bool TizenWebEngineLWE::IsJavaScriptEnabled() const
-{
- // NOT IMPLEMENTED
- return 0;
-}
-
-void TizenWebEngineLWE::EnableJavaScript( bool enabled )
-{
- // NOT IMPLEMENTED
-}
-
-bool TizenWebEngineLWE::AreImagesAutomaticallyLoaded() const
-{
- // NOT IMPLEMENTED
- return 0;
-}
-
-void TizenWebEngineLWE::LoadImagesAutomatically( bool automatic )
-{
- // NOT IMPLEMENTED
-}
-
-const std::string& TizenWebEngineLWE::GetDefaultTextEncodingName() const
-{
- // NOT IMPLEMENTED
- static const std::string kEmpty;
- return kEmpty;
-}
-
-void TizenWebEngineLWE::SetDefaultTextEncodingName( const std::string& defaultTextEncodingName )
-{
- // NOT IMPLEMENTED
-}
-
-int TizenWebEngineLWE::GetDefaultFontSize() const
-{
- // NOT IMPLEMENTED
- return 0;
-}
-
-void TizenWebEngineLWE::SetDefaultFontSize( int defaultFontSize )
-{
- // NOT IMPLEMENTED
-}
-
void TizenWebEngineLWE::SetSize( int width, int height )
{
DALI_ASSERT_ALWAYS( mWebContainer );
namespace Dali
{
+class PixelData;
+
namespace Plugin
{
void Create( int width, int height, const std::string& locale, const std::string& timezoneId ) override;
/**
+ * @copydoc Dali::WebEnginePlugin::GetSettings()
+ */
+ Dali::WebEngineSettings& GetSettings() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::GetContext()
+ */
+ Dali::WebEngineContext& GetContext() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::GetCookieManager()
+ */
+ Dali::WebEngineCookieManager& GetCookieManager() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::GetBackForwardList()
+ */
+ Dali::WebEngineBackForwardList& GetBackForwardList() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::Create()
+ */
+ void Create( int width, int height, int argc, char** argv ) override;
+
+ /**
* @copydoc Dali::WebEnginePlugin::Destroy()
*/
void Destroy() override;
void LoadUrl( const std::string& url ) override;
/**
+ * @copydoc Dali::WebEnginePlugin::GetTitle()
+ */
+ std::string GetTitle() const override;
+
+ /**
+ * @copydoc Dali::WebEnginePlugin::GetFavicon()
+ */
+ Dali::PixelData GetFavicon() const override;
+
+ /**
* @copydoc Dali::WebEnginePlugin::GetUrl()
*/
const std::string& GetUrl() override;
/**
* @copydoc Dali::WebEnginePlugin::LoadHTMLString()
*/
- void LoadHTMLString( const std::string& string ) override;
+ void LoadHtmlString( const std::string& string ) override;
/**
* @copydoc Dali::WebEnginePlugin::Reload()
void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void(const std::string&) > handler ) override;
/**
- * @copydoc Dali::WebEnginePlugin::ClearHistory()
- */
- void ClearHistory() override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::ClearCache()
- */
- void ClearCache() override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::ClearCookies()
- */
- void ClearCookies() override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::GetCacheModel()
+ * @copydoc Dali::WebEnginePlugin::ClearAllTilesResources()
*/
- Dali::WebEnginePlugin::CacheModel GetCacheModel() const override;
+ void ClearAllTilesResources() override;
/**
- * @copydoc Dali::WebEnginePlugin::SetCacheModel()
- */
- void SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel ) override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::GetCookieAcceptPolicy()
- */
- Dali::WebEnginePlugin::CookieAcceptPolicy GetCookieAcceptPolicy() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::SetCookieAcceptPolicy()
+ * @copydoc Dali::WebEnginePlugin::ClearHistory()
*/
- void SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy ) override;
+ void ClearHistory() override;
/**
* @copydoc Dali::WebEnginePlugin::GetUserAgent()
void SetUserAgent( const std::string& userAgent ) override;
/**
- * @copydoc Dali::WebEnginePlugin::IsJavaScriptEnabled()
- */
- bool IsJavaScriptEnabled() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::EnableJavaScript()
- */
- void EnableJavaScript( bool enabled ) override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::AreImagesAutomaticallyLoaded()
- */
- bool AreImagesAutomaticallyLoaded() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::LoadImagesAutomatically()
- */
- void LoadImagesAutomatically( bool automatic ) override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::GetDefaultTextEncodingName()
- */
- const std::string& GetDefaultTextEncodingName() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::SetDefaultTextEncodingName()
- */
- void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::GetDefaultFontSize()
- */
- int GetDefaultFontSize() const override;
-
- /**
- * @copydoc Dali::WebEnginePlugin::SetDefaultFontSize()
- */
- void SetDefaultFontSize( int defaultFontSize ) override;
-
- /**
* @copydoc Dali::WebEnginePlugin::SetSize()
*/
void SetSize( int width, int height ) override;