#define DALI_WEB_ENGINE_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * 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.
namespace Dali
{
-
namespace Internal
{
-
namespace Adaptor
{
- class WebEngine;
+class WebEngine;
} // namespace Adaptor
} // namespace Internal
class DALI_ADAPTOR_API WebEngine : public BaseHandle
{
public:
-
/**
* @brief Constructor.
*/
*
* @param[in] WebEngine WebEngine to copy. The copied WebEngine will point at the same implementation
*/
- WebEngine( const WebEngine& WebEngine );
+ WebEngine(const WebEngine& WebEngine);
/**
* @brief Assignment operator.
* @param[in] WebEngine The WebEngine to assign from.
* @return The updated WebEngine.
*/
- WebEngine& operator=( const WebEngine& WebEngine );
+ WebEngine& operator=(const WebEngine& WebEngine);
/**
* @brief Downcast a handle to WebEngine handle.
* @param[in] handle Handle to an object
* @return Handle to a WebEngine or an uninitialized handle
*/
- static WebEngine DownCast( BaseHandle handle );
+ static WebEngine DownCast(BaseHandle handle);
/**
* @brief Creates WebEngine instance.
* @param [in] locale The locale of Web
* @param [in] timezoneId The timezoneID of Web
*/
- void Create( int width, int height, const std::string& locale, const std::string& timezoneId );
+ void Create(int width, int height, const std::string& locale, const std::string& timezoneId);
/**
* @brief Destroys WebEngine instance.
*
* @param [in] url The URL of the resource to load
*/
- void LoadUrl( const std::string& url );
+ void LoadUrl(const std::string& url);
/**
* @brief Gets the url.
*
* @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.
void StopLoading();
/**
+ * @brief Suspends the operation associated with the view.
+ */
+ void Suspend();
+
+ /**
+ * @brief Resumes the operation associated with the view object after calling Suspend().
+ */
+ void Resume();
+
+ /**
* @brief Returns whether forward is possible.
*
* @return True if forward is possible, false otherwise
* @brief Evaluates JavaScript code represented as a string.
*
* @param[in] script The JavaScript code
+ * @param[in] resultHandler The callback function to be called by the JavaScript runtime. This carries evaluation result.
*/
- void EvaluateJavaScript( const std::string& script );
+ void EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler);
/**
* @brief Add a message handler into JavaScript.
* @param[in] exposedObjectName The name of exposed object
* @param[in] handler The callback function
*/
- void AddJavaScriptMessageHandler( const std::string& exposedObjectName, std::function< void( const std::string& ) > handler );
+ void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
/**
* @brief Clears the history 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
+ */
+ const std::string& GetUserAgent() const;
+
+ /**
+ * @brief Set user agent string.
+ *
+ * @param[in] userAgent The string value of user agent
+ */
+ 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 );
+ void SetSize(int width, int height);
/**
* @brief Sends Touch Events.
*/
- bool SendTouchEvent( const TouchData& touch );
+ bool SendTouchEvent(const TouchEvent& touch);
/**
* @brief Sends key Events.
*/
- bool SendKeyEvent( const KeyEvent& event );
+ bool SendKeyEvent(const KeyEvent& event);
+
+ /**
+ * @brief Set focus.
+ */
+ void SetFocus( bool focused );
/**
* @brief Connects to this signal to be notified when page loading is started.
*
* @return A signal object to connect with.
*/
- Dali::WebEnginePlugin::WebEngineSignalType& PageLoadStartedSignal();
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadStartedSignal();
/**
* @brief Connects to this signal to be notified when page loading is finished.
*
* @return A signal object to connect with.
*/
- Dali::WebEnginePlugin::WebEngineSignalType& PageLoadFinishedSignal();
+ Dali::WebEnginePlugin::WebEnginePageLoadSignalType& PageLoadFinishedSignal();
-private: // Not intended for application developers
+ /**
+ * @brief Connects to this signal to be notified when an error occurs in page loading.
+ *
+ * @return A signal object to connect with.
+ */
+ Dali::WebEnginePlugin::WebEnginePageLoadErrorSignalType& PageLoadErrorSignal();
+private: // Not intended for application developers
/**
* @brief Internal constructor
*/
- explicit DALI_INTERNAL WebEngine( Internal::Adaptor::WebEngine* internal );
+ explicit DALI_INTERNAL WebEngine(Internal::Adaptor::WebEngine* internal);
};
-} // namespace Dali;
+} // namespace Dali
#endif // DALI_WEB_ENGINE_H