From 000d9e2ec52d1749d68a11532895db8b3a4544e7 Mon Sep 17 00:00:00 2001 From: "huayong.xu" Date: Wed, 2 Dec 2020 17:56:19 +0800 Subject: [PATCH] Implement some new ewk apis in web engine. Support some new APIs, e.g. BackForwardList, Context, CookieManager, Settings. Change-Id: I015e667ba674d9e4037480cf43dac84d7a6f67c3 --- .../web-engine-back-forward-list-item.h | 70 +++++++++ .../web-engine-back-forward-list.h | 73 ++++++++++ .../adaptor-framework/web-engine-context.h | 127 ++++++++++++++++ .../adaptor-framework/web-engine-cookie-manager.h | 101 +++++++++++++ .../adaptor-framework/web-engine-plugin.h | 162 ++++----------------- .../adaptor-framework/web-engine-settings.h | 146 +++++++++++++++++++ dali/devel-api/adaptor-framework/web-engine.cpp | 98 ++++--------- dali/devel-api/adaptor-framework/web-engine.h | 116 +++------------ dali/devel-api/file.list | 5 + .../internal/web-engine/common/web-engine-impl.cpp | 102 ++++--------- dali/internal/web-engine/common/web-engine-impl.h | 104 ++++--------- 11 files changed, 652 insertions(+), 452 deletions(-) create mode 100755 dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h create mode 100755 dali/devel-api/adaptor-framework/web-engine-back-forward-list.h create mode 100755 dali/devel-api/adaptor-framework/web-engine-context.h create mode 100755 dali/devel-api/adaptor-framework/web-engine-cookie-manager.h create mode 100755 dali/devel-api/adaptor-framework/web-engine-settings.h diff --git a/dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h b/dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h new file mode 100755 index 0000000..6ab63de --- /dev/null +++ b/dali/devel-api/adaptor-framework/web-engine-back-forward-list-item.h @@ -0,0 +1,70 @@ +#ifndef DALI_WEB_ENGINE_BACK_FORWARD_LIST_ITEM_H +#define DALI_WEB_ENGINE_BACK_FORWARD_LIST_ITEM_H + +/* + * Copyright (c) 2021 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 + +namespace Dali +{ + +/** + * @brief A class WebBackForwardListItem for back forward list item of web engine. + */ +class WebEngineBackForwardListItem +{ + +public: + + /** + * @brief Constructor. + */ + WebEngineBackForwardListItem() = default; + + /** + * @brief Destructor. + */ + virtual ~WebEngineBackForwardListItem() = default; + + /** + * @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 item, otherwise "" in case of an error + */ + virtual std::string GetUrl() const = 0; + + /** + * @brief Returns the title of the item. + * @return The title of the item, otherwise "" in case of an error + */ + virtual std::string GetTitle() const = 0; + + /** + * @brief Returns the original URL of the item. + * @return The original URL of the item, otherwise "" in case of an error + */ + virtual std::string GetOriginalUrl() const = 0; + +}; + +} // namespace Dali + +#endif // DALI_WEB_ENGINE_BACK_FORWARD_LIST_ITEM_H + diff --git a/dali/devel-api/adaptor-framework/web-engine-back-forward-list.h b/dali/devel-api/adaptor-framework/web-engine-back-forward-list.h new file mode 100755 index 0000000..26fd66a --- /dev/null +++ b/dali/devel-api/adaptor-framework/web-engine-back-forward-list.h @@ -0,0 +1,73 @@ +#ifndef DALI_WEB_ENGINE_BACK_FORWARD_LIST_H +#define DALI_WEB_ENGINE_BACK_FORWARD_LIST_H + +/* + * Copyright (c) 2021 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 +#include + +namespace Dali +{ + +class WebEngineBackForwardListItem; + +/** + * @brief A class WebBackForwardList for back forward list of web engine. + */ +class WebEngineBackForwardList +{ + +public: + + /** + * @brief Constructor. + */ + WebEngineBackForwardList() = default; + + /** + * @brief Destructor. + */ + virtual ~WebEngineBackForwardList() = default; + + /** + * @brief Returns the current item in the @a list. + * @return The item of back-forward list. + */ + virtual WebEngineBackForwardListItem& GetCurrentItem() const = 0; + + /** + * @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 of back-forward list. + */ + virtual WebEngineBackForwardListItem& GetItemAtIndex( uint32_t index ) const = 0; + + /** + * @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, + * otherwise @c 0 in case of an error + */ + virtual uint32_t GetItemCount() const = 0; + +}; + +} // namespace Dali + +#endif // DALI_WEB_ENGINE_BACK_FORWARD_LIST_H diff --git a/dali/devel-api/adaptor-framework/web-engine-context.h b/dali/devel-api/adaptor-framework/web-engine-context.h new file mode 100755 index 0000000..752ac81 --- /dev/null +++ b/dali/devel-api/adaptor-framework/web-engine-context.h @@ -0,0 +1,127 @@ +#ifndef DALI_WEB_ENGINE_CONTEXT_H +#define DALI_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 + +namespace Dali +{ + +/** + * @brief A class WebEngineContext for context of web engine. + */ +class WebEngineContext +{ + +public: + + /** + * @brief Enumeration for cache model options. + */ + enum class CacheModel + { + DOCUMENT_VIEWER, ///< Use the smallest cache capacity. + DOCUMENT_BROWSER, ///< Use the bigger cache capacity than DocumentBrowser. + PRIMARY_WEB_BROWSER, ///< Use the biggest cache capacity. + }; + + /** + * @brief Constructor. + */ + WebEngineContext() = default; + + /** + * @brief Destructor. + */ + virtual ~WebEngineContext() = default; + + /** + * @brief Returns the cache model type. + * @return #CacheModel + */ + virtual CacheModel GetCacheModel() const = 0; + + /** + * @brief Requests to set the cache model. + * @param[in] cacheModel The cache model + */ + virtual void SetCacheModel( CacheModel cacheModel ) = 0; + + /** + * @brief Sets the given proxy URI to network backend of specific context. + * @param[in] uri The proxy URI to set + */ + virtual void SetProxyUri( const std::string& uri ) = 0; + + /** + * @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 + */ + virtual void SetDefaultProxyAuth( const std::string& username, const std::string& password ) = 0; + + /** + * 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 + */ + virtual void SetCertificateFilePath( const std::string& certificatePath ) = 0; + + /** + * Requests for deleting all web databases. + */ + virtual void DeleteWebDatabase() = 0; + + /** + * @brief Deletes web storage. + * @details This function does not ensure that all data will be removed. + * Should be used to extend free physical memory. + */ + virtual void DeleteWebStorage() = 0; + + /** + * @brief Requests for deleting all local file systems. + */ + virtual void DeleteLocalFileSystem() = 0; + + /** + * 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 + */ + virtual void DisableCache( bool cacheDisabled ) = 0; + + /** + * @brief Requests to clear cache + */ + virtual void ClearCache() = 0; + +}; + +} // namespace Dali + +#endif // DALI_WEB_ENGINE_CONTEXT_H diff --git a/dali/devel-api/adaptor-framework/web-engine-cookie-manager.h b/dali/devel-api/adaptor-framework/web-engine-cookie-manager.h new file mode 100755 index 0000000..e053263 --- /dev/null +++ b/dali/devel-api/adaptor-framework/web-engine-cookie-manager.h @@ -0,0 +1,101 @@ +#ifndef DALI_WEB_ENGINE_COOKIE_MANAGER_H +#define DALI_WEB_ENGINE_COOKIE_MANAGER_H + +/* + * Copyright (c) 2021 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 + +namespace Dali +{ + +/** + * @brief A class WebEngineCookieManager to wrap ewk cookie manager. + */ +class WebEngineCookieManager +{ + +public: + + /** + * @brief Enumeration for the cookies accept policies. + */ + enum class CookieAcceptPolicy + { + ALWAYS, ///< Accepts every cookie sent from any page. + NEVER, ///< Rejects all the cookies. + NO_THIRD_PARTY, ///< Accepts only cookies set by the main document that is loaded. + }; + + /** + * @brief Enumeration for the cookie persistent storage type. + */ + enum class CookiePersistentStorage + { + TEXT, ///< Cookies are stored in a text file in the Mozilla "cookies.txt" format. + SQLITE, ///< Cookies are stored in a SQLite file in the current Mozilla format. + }; + + /** + * @brief Constructor. + */ + WebEngineCookieManager() = default; + + /** + * @brief Destructor. + */ + virtual ~WebEngineCookieManager() = default; + + /** + * @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 + */ + virtual void SetCookieAcceptPolicy( CookieAcceptPolicy policy ) = 0; + + /** + * @brief Gets the cookie acceptance policy. + * The default is Toolkit::WebEngineCookieManager::CookieAcceptPolicy::NO_THIRD_PARTY. + * @see Toolkit::WebEngineCookieManager::CookieAcceptPolicy::Type + */ + virtual CookieAcceptPolicy GetCookieAcceptPolicy() const = 0; + + /** + * @brief Deletes all the cookies of @a manager. + */ + virtual void ClearCookies() = 0; + + /** + * @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 + */ + virtual void SetPersistentStorage( const std::string& path, CookiePersistentStorage storage ) = 0; + +}; + +} // namespace Dali + +#endif // DALI_WEB_ENGINE_COOKIE_MANAGER_H diff --git a/dali/devel-api/adaptor-framework/web-engine-plugin.h b/dali/devel-api/adaptor-framework/web-engine-plugin.h index c3b9389..fbf8d1c 100755 --- a/dali/devel-api/adaptor-framework/web-engine-plugin.h +++ b/dali/devel-api/adaptor-framework/web-engine-plugin.h @@ -27,6 +27,10 @@ namespace Dali { class KeyEvent; class TouchEvent; +class WebEngineBackForwardList; +class WebEngineContext; +class WebEngineCookieManager; +class WebEngineSettings; /** * @brief WebEnginePlugin is an abstract interface, used by dali-adaptor to access WebEngine plugin. @@ -54,48 +58,6 @@ public: typedef Signal< void( const ScrollEdge )> WebEngineScrollEdgeReachedSignalType; /** - * @brief Enumeration for cache model options. - */ - enum class CacheModel - { - /** - * @brief Use the smallest cache capacity. - */ - DOCUMENT_VIEWER, - - /** - * @brief Use the bigger cache capacity than DocumentBrowser. - */ - DOCUMENT_BROWSER, - - /** - * @brief Use the biggest cache capacity. - */ - PRIMARY_WEB_BROWSER - }; - - /** - * @brief Enumeration for the cookies accept policies. - */ - enum class CookieAcceptPolicy - { - /** - * @brief Accepts every cookie sent from any page. - */ - ALWAYS, - - /** - * @brief Rejects all the cookies. - */ - NEVER, - - /** - * @brief Accepts only cookies set by the main document that is loaded. - */ - NO_THIRD_PARTY - }; - - /** * @brief Enumeration for the scroll edge. */ enum class ScrollEdge @@ -132,6 +94,26 @@ public: virtual void Destroy() = 0; /** + * @brief Get settings of WebEngine. + */ + virtual WebEngineSettings& GetSettings() const = 0; + + /** + * @brief Get context of WebEngine. + */ + virtual WebEngineContext& GetContext() const = 0; + + /** + * @brief Get cookie manager of WebEngine. + */ + virtual WebEngineCookieManager& GetCookieManager() const = 0; + + /** + * @brief Get back-forward list of WebEngine. + */ + virtual WebEngineBackForwardList& GetBackForwardList() const = 0; + + /** * @brief Loads a web page based on a given URL. * * @param [in] url The URL of the resource to load @@ -155,7 +137,7 @@ public: * * @param [in] htmlString The string to use as the contents of the web page */ - virtual void LoadHTMLString(const std::string& htmlString) = 0; + virtual void LoadHtmlString(const std::string& htmlString) = 0; /** * @brief Reloads the Web. @@ -248,44 +230,6 @@ public: virtual void ClearHistory() = 0; /** - * @brief Clears the cache of Web. - */ - virtual void ClearCache() = 0; - - /** - * @brief Clears all the cookies of Web. - */ - virtual void ClearCookies() = 0; - - /** - * @brief Get cache model option. The default is DOCUMENT_VIEWER. - * - * @return The cache model option - */ - virtual CacheModel GetCacheModel() const = 0; - - /** - * @brief Set cache model option. The default is DOCUMENT_VIEWER. - * - * @param[in] cacheModel The cache model option - */ - virtual void SetCacheModel(CacheModel cacheModel) = 0; - - /** - * @brief Gets the cookie acceptance policy. The default is NO_THIRD_PARTY. - * - * @return The cookie acceptance policy - */ - virtual CookieAcceptPolicy GetCookieAcceptPolicy() const = 0; - - /** - * @brief Sets the cookie acceptance policy. The default is NO_THIRD_PARTY. - * - * @param[in] policy The cookie acceptance policy - */ - virtual void SetCookieAcceptPolicy(CookieAcceptPolicy policy) = 0; - - /** * @brief Get user agent string. * * @return The string value of user agent @@ -300,62 +244,6 @@ public: virtual void SetUserAgent(const std::string& userAgent) = 0; /** - * @brief Returns whether JavaScript can be executable. The default is true. - * - * @return true if JavaScript executing is enabled, false otherwise - */ - virtual bool IsJavaScriptEnabled() const = 0; - - /** - * @brief Enables/disables JavaScript executing. The default is enabled. - * - * @param[in] enabled True if JavaScript executing is enabled, false otherwise - */ - virtual void EnableJavaScript(bool enabled) = 0; - - /** - * @brief Returns whether images can be loaded automatically. The default is true. - * - * @return true if images are loaded automatically, false otherwise - */ - virtual bool AreImagesAutomaticallyLoaded() const = 0; - - /** - * @brief Enables/disables auto loading of images. The default is enabled. - * - * @param[in] automatic True if images are loaded automatically, false otherwise - */ - virtual void LoadImagesAutomatically(bool automatic) = 0; - - /** - * @brief Gets the default text encoding name (e.g. UTF-8). - * - * @return The default text encoding name - */ - virtual const std::string& GetDefaultTextEncodingName() const = 0; - - /** - * @brief Sets the default text encoding name (e.g. UTF-8). - * - * @param[in] defaultTextEncodingName The default text encoding name - */ - virtual void SetDefaultTextEncodingName(const std::string& defaultTextEncodingName) = 0; - - /** - * @brief Returns the default font size in pixel. The default value is 16. - * - * @return The default font size - */ - virtual int GetDefaultFontSize() const = 0; - - /** - * @brief Sets the default font size in pixel. The default value is 16. - * - * @param[in] defaultFontSize A new default font size to set - */ - virtual void SetDefaultFontSize(int defaultFontSize) = 0; - - /** * @brief Sets size of Web Page. */ virtual void SetSize(int width, int height) = 0; diff --git a/dali/devel-api/adaptor-framework/web-engine-settings.h b/dali/devel-api/adaptor-framework/web-engine-settings.h new file mode 100755 index 0000000..6da577e --- /dev/null +++ b/dali/devel-api/adaptor-framework/web-engine-settings.h @@ -0,0 +1,146 @@ +#ifndef DALI_WEB_ENGINE_SETTINGS_H +#define DALI_WEB_ENGINE_SETTINGS_H + +/* + * Copyright (c) 2021 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 + +namespace Dali +{ + +/** + * @brief A class WebEngineSettings for settings of web engine. + */ +class WebEngineSettings +{ + +public: + + /** + * @brief Constructor. + */ + WebEngineSettings() = default; + + /** + * @brief Destructor. + */ + virtual ~WebEngineSettings() = default; + + /** + *@brief Allow running mixed contents or not. + * + * @param[in] allowed if true, allow to run mixed contents, + * otherwise not allow + */ + virtual void AllowMixedContents( bool allowed ) = 0; + + /** + * @brief Enable the spatial navigation or not. + * + * @param[in] enabled if true, use spatial navigation, + * otherwise to disable + */ + virtual void EnableSpatialNavigation( bool enabled ) = 0; + + /** + * @brief Get the default font size. + * + * @return defaut font size. + */ + virtual uint32_t GetDefaultFontSize() const = 0; + + /** + * @brief Set the default font size. + * + * @param[in] size a new default font size to set + */ + virtual void SetDefaultFontSize( uint32_t size ) = 0; + + /** + * @brief Enables/disables web security. + * + * @param[in] enabled if true, to enable the web security + * otherwise to disable + */ + virtual void EnableWebSecurity( bool enabled ) = 0; + + /** + * @brief Allow/Disallow file access from external url + * + * @param[in] allowed if true, to allow file access from external url + * otherwise to disallow + */ + virtual void AllowFileAccessFromExternalUrl( bool allowed ) = 0; + + /** + * @brief Check if javascript is enabled or not. + * + * @return true if enabled, false if disabled. + */ + virtual bool IsJavaScriptEnabled() const = 0; + + /** + * @brief Enable/Disable javascript + * + * @param[in] enabled if true, to enable javascript + * otherwise to disable + */ + virtual void EnableJavaScript( bool enabled ) = 0; + + /** + * @brief Allow if the scripts can open new windows. + * + * @param[in] allowed if true, the scripts can open new windows, + * otherwise not + */ + virtual void AllowScriptsOpenWindows( bool allowed ) = 0; + + /** + * @brief Check if images are loaded automatically or not. + * + * @return true if enabled, false if disabled. + */ + virtual bool AreImagesLoadedAutomatically() const = 0; + + /** + * @brief Allow to load images automatically + * + * @param[in] automatic if true, to load images automatically, + * otherwise not + */ + virtual void AllowImagesLoadAutomatically( bool automatic ) = 0; + + /** + * @brief Get the default encoding name. + * + * @return defaut encoding name. + */ + virtual std::string GetDefaultTextEncodingName() const = 0; + + /** + * @brief Set the default encoding name. + * + * @param[in] defaultTextEncodingName a default encoding name to set + */ + virtual void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) = 0; + +}; + +} // namespace Dali + +#endif // DALI_WEB_ENGINE_SETTINGS_H diff --git a/dali/devel-api/adaptor-framework/web-engine.cpp b/dali/devel-api/adaptor-framework/web-engine.cpp index efdc38c..46130fa 100755 --- a/dali/devel-api/adaptor-framework/web-engine.cpp +++ b/dali/devel-api/adaptor-framework/web-engine.cpp @@ -19,6 +19,10 @@ #include // INTERNAL INCLUDES +#include +#include +#include +#include #include namespace Dali @@ -77,6 +81,26 @@ NativeImageInterfacePtr WebEngine::GetNativeImageSource() return GetImplementation(*this).GetNativeImageSource(); } +Dali::WebEngineSettings& WebEngine::GetSettings() const +{ + return GetImplementation( *this ).GetSettings(); +} + +Dali::WebEngineContext& WebEngine::GetContext() const +{ + return GetImplementation( *this ).GetContext(); +} + +Dali::WebEngineCookieManager& WebEngine::GetCookieManager() const +{ + return GetImplementation( *this ).GetCookieManager(); +} + +Dali::WebEngineBackForwardList& WebEngine::GetBackForwardList() const +{ + return GetImplementation( *this ).GetBackForwardList(); +} + void WebEngine::LoadUrl(const std::string& url) { return GetImplementation(*this).LoadUrl(url); @@ -87,9 +111,9 @@ const std::string& WebEngine::GetUrl() return GetImplementation(*this).GetUrl(); } -void WebEngine::LoadHTMLString(const std::string& htmlString) +void WebEngine::LoadHtmlString(const std::string& htmlString) { - GetImplementation(*this).LoadHTMLString(htmlString); + GetImplementation(*this).LoadHtmlString(htmlString); } void WebEngine::Reload() @@ -172,36 +196,6 @@ void WebEngine::ClearHistory() return GetImplementation(*this).ClearHistory(); } -void WebEngine::ClearCache() -{ - return GetImplementation(*this).ClearCache(); -} - -void WebEngine::ClearCookies() -{ - return GetImplementation(*this).ClearCookies(); -} - -Dali::WebEnginePlugin::CacheModel WebEngine::GetCacheModel() const -{ - return GetImplementation(*this).GetCacheModel(); -} - -void WebEngine::SetCacheModel(Dali::WebEnginePlugin::CacheModel cacheModel) -{ - GetImplementation(*this).SetCacheModel(cacheModel); -} - -Dali::WebEnginePlugin::CookieAcceptPolicy WebEngine::GetCookieAcceptPolicy() const -{ - return GetImplementation(*this).GetCookieAcceptPolicy(); -} - -void WebEngine::SetCookieAcceptPolicy(Dali::WebEnginePlugin::CookieAcceptPolicy policy) -{ - GetImplementation(*this).SetCookieAcceptPolicy(policy); -} - const std::string& WebEngine::GetUserAgent() const { return GetImplementation(*this).GetUserAgent(); @@ -212,46 +206,6 @@ void WebEngine::SetUserAgent(const std::string& userAgent) GetImplementation(*this).SetUserAgent(userAgent); } -bool WebEngine::IsJavaScriptEnabled() const -{ - return GetImplementation(*this).IsJavaScriptEnabled(); -} - -void WebEngine::EnableJavaScript(bool enabled) -{ - GetImplementation(*this).EnableJavaScript(enabled); -} - -bool WebEngine::AreImagesAutomaticallyLoaded() const -{ - return GetImplementation(*this).AreImagesAutomaticallyLoaded(); -} - -void WebEngine::LoadImagesAutomatically(bool automatic) -{ - GetImplementation(*this).LoadImagesAutomatically(automatic); -} - -const std::string& WebEngine::GetDefaultTextEncodingName() const -{ - return GetImplementation(*this).GetDefaultTextEncodingName(); -} - -void WebEngine::SetDefaultTextEncodingName(const std::string& defaultTextEncodingName) -{ - GetImplementation(*this).SetDefaultTextEncodingName(defaultTextEncodingName); -} - -int WebEngine::GetDefaultFontSize() const -{ - return GetImplementation(*this).GetDefaultFontSize(); -} - -void WebEngine::SetDefaultFontSize(int defaultFontSize) -{ - GetImplementation(*this).SetDefaultFontSize(defaultFontSize); -} - void WebEngine::SetSize(int width, int height) { return GetImplementation(*this).SetSize(width, height); diff --git a/dali/devel-api/adaptor-framework/web-engine.h b/dali/devel-api/adaptor-framework/web-engine.h index adebcd7..a01db89 100755 --- a/dali/devel-api/adaptor-framework/web-engine.h +++ b/dali/devel-api/adaptor-framework/web-engine.h @@ -107,6 +107,26 @@ public: NativeImageInterfacePtr GetNativeImageSource(); /** + * @brief Get settings of WebEngine. + */ + Dali::WebEngineSettings& GetSettings() const; + + /** + * @brief Get context of WebEngine. + */ + Dali::WebEngineContext& GetContext() const; + + /** + * @brief Get cookie manager of WebEngine. + */ + Dali::WebEngineCookieManager& GetCookieManager() const; + + /** + * @brief Get back-forward list of WebEngine. + */ + Dali::WebEngineBackForwardList& GetBackForwardList() const; + + /** * @brief Loads a web page based on a given URL. * * @param [in] url The URL of the resource to load @@ -123,7 +143,7 @@ public: * * @param [in] htmlString The string to use as the contents of the web page */ - void LoadHTMLString(const std::string& htmlString); + void LoadHtmlString(const std::string& htmlString); /** * @brief Reloads the Web. @@ -216,44 +236,6 @@ public: void ClearHistory(); /** - * @brief Clears the cache of Web. - */ - void ClearCache(); - - /** - * @brief Clears all the cookies of Web. - */ - void ClearCookies(); - - /** - * @brief Get cache model option. The default is DOCUMENT_VIEWER. - * - * @return The cache model option - */ - Dali::WebEnginePlugin::CacheModel GetCacheModel() const; - - /** - * @brief Set cache model option. The default is DOCUMENT_VIEWER. - * - * @param[in] cacheModel The cache model option - */ - void SetCacheModel(Dali::WebEnginePlugin::CacheModel cacheModel); - - /** - * @brief Gets the cookie acceptance policy. The default is NO_THIRD_PARTY. - * - * @return The cookie acceptance policy - */ - Dali::WebEnginePlugin::CookieAcceptPolicy GetCookieAcceptPolicy() const; - - /** - * @brief Sets the cookie acceptance policy. The default is NO_THIRD_PARTY. - * - * @param[in] policy The cookie acceptance policy - */ - void SetCookieAcceptPolicy(Dali::WebEnginePlugin::CookieAcceptPolicy policy); - - /** * @brief Get user agent string. * * @return The string value of user agent @@ -268,62 +250,6 @@ public: void SetUserAgent(const std::string& userAgent); /** - * @brief Returns whether JavaScript can be executable. The default is true. - * - * @return true if JavaScript executing is enabled, false otherwise - */ - bool IsJavaScriptEnabled() const; - - /** - * @brief Enables/disables JavaScript executing. The default is enabled. - * - * @param[in] enabled True if JavaScript executing is enabled, false otherwise - */ - void EnableJavaScript(bool enabled); - - /** - * @brief Returns whether JavaScript can be executable. The default is true. - * - * @return true if images are loaded automatically, false otherwise - */ - bool AreImagesAutomaticallyLoaded() const; - - /** - * @brief Enables/disables auto loading of images. The default is enabled. - * - * @param[in] automatic True if images are loaded automatically, false otherwise - */ - void LoadImagesAutomatically(bool automatic); - - /** - * @brief Gets the default text encoding name. - * - * @return The default text encoding name - */ - const std::string& GetDefaultTextEncodingName() const; - - /** - * @brief Sets the default text encoding name. - * - * @param[in] defaultTextEncodingName The default text encoding name - */ - void SetDefaultTextEncodingName(const std::string& defaultTextEncodingName); - - /** - * @brief Returns the default font size in pixel. The default value is 16. - * - * @return The default font size - */ - int GetDefaultFontSize() const; - - /** - * @brief Sets the default font size in pixel. The default value is 16. - * - * @param[in] defaultFontSize A new default font size to set - */ - void SetDefaultFontSize(int defaultFontSize); - - /** * @brief Sets the size of Web Pages. */ void SetSize(int width, int height); diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index aa03a5f..2549770 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -82,7 +82,12 @@ SET( devel_api_adaptor_framework_header_files ${adaptor_devel_api_dir}/adaptor-framework/video-player.h ${adaptor_devel_api_dir}/adaptor-framework/video-player-plugin.h ${adaptor_devel_api_dir}/adaptor-framework/web-engine.h + ${adaptor_devel_api_dir}/adaptor-framework/web-engine-back-forward-list-item.h + ${adaptor_devel_api_dir}/adaptor-framework/web-engine-back-forward-list.h + ${adaptor_devel_api_dir}/adaptor-framework/web-engine-context.h + ${adaptor_devel_api_dir}/adaptor-framework/web-engine-cookie-manager.h ${adaptor_devel_api_dir}/adaptor-framework/web-engine-plugin.h + ${adaptor_devel_api_dir}/adaptor-framework/web-engine-settings.h ${adaptor_devel_api_dir}/adaptor-framework/key-extension-plugin.h ${adaptor_devel_api_dir}/adaptor-framework/virtual-keyboard.h ${adaptor_devel_api_dir}/adaptor-framework/physical-keyboard.h diff --git a/dali/internal/web-engine/common/web-engine-impl.cpp b/dali/internal/web-engine/common/web-engine-impl.cpp index d3718ef..3381dac 100755 --- a/dali/internal/web-engine/common/web-engine-impl.cpp +++ b/dali/internal/web-engine/common/web-engine-impl.cpp @@ -26,6 +26,10 @@ // INTERNAL INCLUDES #include +#include +#include +#include +#include #include #include @@ -178,6 +182,26 @@ Dali::NativeImageInterfacePtr WebEngine::GetNativeImageSource() return mPlugin->GetNativeImageSource(); } +Dali::WebEngineSettings& WebEngine::GetSettings() const +{ + return mPlugin->GetSettings(); +} + +Dali::WebEngineContext& WebEngine::GetContext() const +{ + return mPlugin->GetContext(); +} + +Dali::WebEngineCookieManager& WebEngine::GetCookieManager() const +{ + return mPlugin->GetCookieManager(); +} + +Dali::WebEngineBackForwardList& WebEngine::GetBackForwardList() const +{ + return mPlugin->GetBackForwardList(); +} + void WebEngine::LoadUrl( const std::string& url ) { mPlugin->LoadUrl( url ); @@ -188,9 +212,9 @@ const std::string& WebEngine::GetUrl() return mPlugin->GetUrl(); } -void WebEngine::LoadHTMLString( const std::string& htmlString ) +void WebEngine::LoadHtmlString( const std::string& htmlString ) { - mPlugin->LoadHTMLString( htmlString ); + mPlugin->LoadHtmlString( htmlString ); } void WebEngine::Reload() @@ -268,41 +292,6 @@ void WebEngine::AddJavaScriptMessageHandler( const std::string& exposedObjectNam mPlugin->AddJavaScriptMessageHandler( exposedObjectName, handler ); } -void WebEngine::ClearHistory() -{ - mPlugin->ClearHistory(); -} - -void WebEngine::ClearCache() -{ - mPlugin->ClearCache(); -} - -void WebEngine::ClearCookies() -{ - mPlugin->ClearCookies(); -} - -Dali::WebEnginePlugin::CacheModel WebEngine::GetCacheModel() const -{ - return mPlugin->GetCacheModel(); -} - -void WebEngine::SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel ) -{ - mPlugin->SetCacheModel( cacheModel ); -} - -Dali::WebEnginePlugin::CookieAcceptPolicy WebEngine::GetCookieAcceptPolicy() const -{ - return mPlugin->GetCookieAcceptPolicy(); -} - -void WebEngine::SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy ) -{ - mPlugin->SetCookieAcceptPolicy( policy ); -} - const std::string& WebEngine::GetUserAgent() const { return mPlugin->GetUserAgent(); @@ -313,44 +302,9 @@ void WebEngine::SetUserAgent( const std::string& userAgent ) mPlugin->SetUserAgent( userAgent ); } -bool WebEngine::IsJavaScriptEnabled() const -{ - return mPlugin->IsJavaScriptEnabled(); -} - -void WebEngine::EnableJavaScript( bool enabled ) -{ - mPlugin->EnableJavaScript( enabled ); -} - -bool WebEngine::AreImagesAutomaticallyLoaded() const -{ - return mPlugin->AreImagesAutomaticallyLoaded(); -} - -void WebEngine::LoadImagesAutomatically( bool automatic ) -{ - mPlugin->LoadImagesAutomatically( automatic ); -} - -const std::string& WebEngine::GetDefaultTextEncodingName() const -{ - return mPlugin->GetDefaultTextEncodingName(); -} - -void WebEngine::SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ) -{ - mPlugin->SetDefaultTextEncodingName( defaultTextEncodingName ); -} - -int WebEngine::GetDefaultFontSize() const -{ - return mPlugin->GetDefaultFontSize(); -} - -void WebEngine::SetDefaultFontSize( int defaultFontSize ) +void WebEngine::ClearHistory() { - mPlugin->SetDefaultFontSize( defaultFontSize ); + mPlugin->ClearHistory(); } void WebEngine::SetSize( int width, int height ) diff --git a/dali/internal/web-engine/common/web-engine-impl.h b/dali/internal/web-engine/common/web-engine-impl.h index 18bb93c..28cedec 100755 --- a/dali/internal/web-engine/common/web-engine-impl.h +++ b/dali/internal/web-engine/common/web-engine-impl.h @@ -28,6 +28,12 @@ namespace Dali { +// forward declaration +class WebEngineBackForwardList; +class WebEngineContext; +class WebEngineCookieManager; +class WebEngineSettings; + namespace Internal { @@ -68,6 +74,26 @@ public: Dali::NativeImageInterfacePtr GetNativeImageSource(); /** + * @copydoc Dali::WebEngine::GetSettings() + */ + Dali::WebEngineSettings& GetSettings() const; + + /** + * @copydoc Dali::WebEngine::GetContext() + */ + Dali::WebEngineContext& GetContext() const; + + /** + * @copydoc Dali::WebEngine::GetCookieManager() + */ + Dali::WebEngineCookieManager& GetCookieManager() const; + + /** + * @copydoc Dali::WebEngine::GetBackForwardList() + */ + Dali::WebEngineBackForwardList& GetBackForwardList() const; + + /** * @copydoc Dali::WebEngine::LoadUrl() */ void LoadUrl( const std::string& url ); @@ -78,9 +104,9 @@ public: const std::string& GetUrl(); /** - * @copydoc Dali::WebEngine::LoadHTMLString() + * @copydoc Dali::WebEngine::LoadHtmlString() */ - void LoadHTMLString( const std::string& htmlString ); + void LoadHtmlString( const std::string& htmlString ); /** * @copydoc Dali::WebEngine::Reload() @@ -158,41 +184,6 @@ public: void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void(const std::string&) > handler ); /** - * @copydoc Dali::WebEngine::ClearHistory() - */ - void ClearHistory(); - - /** - * @copydoc Dali::WebEngine::ClearCache() - */ - void ClearCache(); - - /** - * @copydoc Dali::WebEngine::ClearCookies() - */ - void ClearCookies(); - - /** - * @copydoc Dali::WebEngine::GetCacheModel() - */ - Dali::WebEnginePlugin::CacheModel GetCacheModel() const; - - /** - * @copydoc Dali::WebEngine::SetCacheModel() - */ - void SetCacheModel( Dali::WebEnginePlugin::CacheModel cacheModel ); - - /** - * @copydoc Dali::WebEngine::GetCookieAcceptPolicy() - */ - Dali::WebEnginePlugin::CookieAcceptPolicy GetCookieAcceptPolicy() const; - - /** - * @copydoc Dali::WebEngine::SetCookieAcceptPolicy() - */ - void SetCookieAcceptPolicy( Dali::WebEnginePlugin::CookieAcceptPolicy policy ); - - /** * @copydoc Dali::WebEngine::GetUserAgent() */ const std::string& GetUserAgent() const; @@ -203,44 +194,9 @@ public: void SetUserAgent( const std::string& userAgent ); /** - * @copydoc Dali::WebEngine::IsJavaScriptEnabled() - */ - bool IsJavaScriptEnabled() const; - - /** - * @copydoc Dali::WebEngine::EnableJavaScript() - */ - void EnableJavaScript( bool enabled ); - - /** - * @copydoc Dali::WebEngine::AreImagesAutomaticallyLoaded() - */ - bool AreImagesAutomaticallyLoaded() const; - - /** - * @copydoc Dali::WebEngine::LoadImagesAutomatically() - */ - void LoadImagesAutomatically( bool automatic ); - - /** - * @copydoc Dali::WebEngine::GetDefaultTextEncodingName() - */ - const std::string& GetDefaultTextEncodingName() const; - - /** - * @copydoc Dali::WebEngine::SetDefaultTextEncodingName() - */ - void SetDefaultTextEncodingName( const std::string& defaultTextEncodingName ); - - /** - * @copydoc Dali::WebEngine::GetDefaultFontSize() - */ - int GetDefaultFontSize() const; - - /** - * @copydoc Dali::WebEngine::SetDefaultFontSize() + * @copydoc Dali::WebEngine::ClearHistory() */ - void SetDefaultFontSize( int defaultFontSize ); + void ClearHistory(); /** * @copydoc Dali::WebEngine::SetSize() -- 2.7.4