6415a8b26cd266262a6b0053955d0f8e73676cdd
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / web-view / web-view-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_WEB_VIEW_H
2 #define DALI_TOOLKIT_INTERNAL_WEB_VIEW_H
3
4 /*
5  * Copyright (c) 2024 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/devel-api/actors/actor-devel.h>
23 #include <dali/devel-api/adaptor-framework/proxy-accessible.h>
24 #include <dali/devel-api/adaptor-framework/web-engine/web-engine.h>
25 #include <dali/public-api/images/image-operations.h>
26 #include <dali/public-api/object/property-notification.h>
27 #include <memory>
28
29 // INTERNAL INCLUDES
30 #include <dali-toolkit/devel-api/controls/control-accessible.h>
31 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
32 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
33 #include <dali-toolkit/public-api/controls/control-impl.h>
34 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
35
36 namespace Dali
37 {
38 namespace Toolkit
39 {
40 class KeyEvent;
41 class TouchEvent;
42 class WebBackForwardList;
43 class WebSettings;
44 class WebView;
45
46 namespace Internal
47 {
48 class WebView : public Control
49 {
50 protected:
51   WebView();
52
53   WebView(const std::string& locale, const std::string& timezoneId);
54
55   WebView(uint32_t argc, char** argv);
56
57   virtual ~WebView();
58
59 public:
60   /**
61    * @copydoc Dali::Toolkit::WebView::New()
62    */
63   static Toolkit::WebView New();
64
65   /**
66    * @copydoc Dali::Toolkit::WebView::New( const std::string&, const std::string& )
67    */
68   static Toolkit::WebView New(const std::string& locale, const std::string& timezoneId);
69
70   /**
71    * @copydoc Dali::Toolkit::WebView::New( uint32_t, char** )
72    */
73   static Toolkit::WebView New(uint32_t argc, char** argv);
74
75   /**
76    * @copydoc Dali::Toolkit::WebView::FindWebView()
77    */
78   static Toolkit::WebView FindWebView(Dali::WebEnginePlugin* plugin);
79
80   /**
81    * @copydoc Dali::Toolkit::WebView::GetContext()
82    */
83   static Dali::WebEngineContext* GetContext();
84
85   /**
86    * @copydoc Dali::Toolkit::WebView::GetCookieManager()
87    */
88   static Dali::WebEngineCookieManager* GetCookieManager();
89
90   /**
91    * @copydoc Dali::Toolkit::WebView::GetSettings()
92    */
93   Dali::Toolkit::WebSettings* GetSettings() const;
94
95   /**
96    * @copydoc Dali::Toolkit::WebView::GetBackForwardList()
97    */
98   Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
99
100   /**
101    * @copydoc Dali::Toolkit::WebView::GetPlugin()
102    */
103   Dali::WebEnginePlugin* GetPlugin() const;
104
105   /**
106    * @copydoc Dali::Toolkit::WebView::GetFavicon()
107    */
108   Dali::Toolkit::ImageView GetFavicon() const;
109
110   /**
111    * @copydoc Dali::Toolkit::WebView::LoadUrl()
112    */
113   void LoadUrl(const std::string& url);
114
115   /**
116    * @copydoc Dali::WebEngine::LoadHTMLString()
117    */
118   void LoadHtmlString(const std::string& htmlString);
119
120   /**
121    * @copydoc Dali::WebEngine::LoadHtmlStringOverrideCurrentEntry()
122    */
123   bool LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl);
124
125   /**
126    * @copydoc Dali::WebEngine::LoadContents()
127    */
128   bool LoadContents(const int8_t* contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri);
129
130   /**
131    * @copydoc Dali::Toolkit::WebView::Reload()
132    */
133   void Reload();
134
135   /**
136    * @copydoc Dali::WebEngine::ReloadWithoutCache()
137    */
138   bool ReloadWithoutCache();
139
140   /**
141    * @copydoc Dali::Toolkit::WebView::StopLoading()
142    */
143   void StopLoading();
144
145   /**
146    * @copydoc Dali::Toolkit::WebView::StopLoading()
147    */
148   void Suspend();
149
150   /**
151    * @copydoc Dali::Toolkit::WebView::Resume()
152    */
153   void Resume();
154
155   /**
156    * @copydoc Dali::WebEngine::SuspendNetworkLoading()
157    */
158   void SuspendNetworkLoading();
159
160   /**
161    * @copydoc Dali::WebEngine::ResumeNetworkLoading()
162    */
163   void ResumeNetworkLoading();
164
165   /**
166    * @copydoc Dali::WebEngine::AddCustomHeader()
167    */
168   bool AddCustomHeader(const std::string& name, const std::string& value);
169
170   /**
171    * @copydoc Dali::WebEngine::RemoveCustomHeader()
172    */
173   bool RemoveCustomHeader(const std::string& name);
174
175   /**
176    * @copydoc Dali::WebEngine::StartInspectorServer()
177    */
178   uint32_t StartInspectorServer(uint32_t port);
179
180   /**
181    * @copydoc Dali::WebEngine::StopInspectorServer()
182    */
183   bool StopInspectorServer();
184
185   /**
186    * @copydoc Dali::Toolkit::WebView::ScrollBy()
187    */
188   void ScrollBy(int32_t deltaX, int32_t deltaY);
189
190   /**
191    * @copydoc Dali::WebEngine::ScrollEdgeBy()
192    */
193   bool ScrollEdgeBy(int32_t deltaX, int32_t deltaY);
194
195   /**
196    * @copydoc Dali::Toolkit::WebView::CanGoForward()
197    */
198   bool CanGoForward();
199
200   /**
201    * @copydoc Dali::Toolkit::WebView::GoForward()
202    */
203   void GoForward();
204
205   /**
206    * @copydoc Dali::Toolkit::WebView::CanGoBack()
207    */
208   bool CanGoBack();
209
210   /**
211    * @copydoc Dali::Toolkit::WebView::GoBack()
212    */
213   void GoBack();
214
215   /**
216    * @copydoc Dali::Toolkit::WebView::EvaluateJavaScript()
217    */
218   void EvaluateJavaScript(const std::string& script, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback resultHandler);
219
220   /**
221    * @copydoc Dali::Toolkit::WebView::AddJavaScriptMessageHandler()
222    */
223   void AddJavaScriptMessageHandler(const std::string& exposedObjectName, Dali::WebEnginePlugin::JavaScriptMessageHandlerCallback handler);
224
225   /**
226    * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptAlertCallback()
227    */
228   void RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback);
229
230   /**
231    * @copydoc Dali::Toolkit::WebView::JavaScriptAlertReply()
232    */
233   void JavaScriptAlertReply();
234
235   /**
236    * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptConfirmCallback()
237    */
238   void RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback);
239
240   /**
241    * @copydoc Dali::Toolkit::WebView::JavaScriptConfirmReply()
242    */
243   void JavaScriptConfirmReply(bool confirmed);
244
245   /**
246    * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptPromptCallback()
247    */
248   void RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback);
249
250   /**
251    * @copydoc Dali::Toolkit::WebView::JavaScriptPromptReply()
252    */
253   void JavaScriptPromptReply(const std::string& result);
254
255   /**
256    * @copydoc Dali::Toolkit::WebView::CreateHitTest()
257    */
258   std::unique_ptr<Dali::WebEngineHitTest> CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode);
259
260   /**
261    * @copydoc Dali::Toolkit::WebView::CreateHitTestAsynchronously()
262    */
263   bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback);
264
265   /**
266    * @copydoc Dali::Toolkit::WebView::ClearHistory()
267    */
268   void ClearHistory();
269
270   /**
271    * @copydoc Dali::Toolkit::WebView::ClearAllTilesResources()
272    */
273   void ClearAllTilesResources();
274
275   /**
276    * @copydoc Dali::Toolkit::WebView::SetScaleFactor()
277    */
278   void SetScaleFactor(float scaleFactor, Dali::Vector2 point);
279
280   /**
281    * @copydoc Dali::Toolkit::WebView::GetScaleFactor()
282    */
283   float GetScaleFactor() const;
284
285   /**
286    * @copydoc Dali::Toolkit::WebView::ActivateAccessibility()
287    */
288   void ActivateAccessibility(bool activated);
289
290   /**
291    * @copydoc Dali::Toolkit::WebView::HighlightText()
292    */
293   bool HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount);
294
295   /**
296    * @copydoc Dali::Toolkit::WebView::AddDynamicCertificatePath()
297    */
298   void AddDynamicCertificatePath(const std::string& host, const std::string& certPath);
299
300   /**
301    * @copydoc Dali::Toolkit::WebView::GetScreenshot()
302    */
303   Dali::Toolkit::ImageView GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor);
304
305   /**
306    * @copydoc Dali::Toolkit::WebView::GetScreenshotAsynchronously()
307    */
308   bool GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback);
309
310   /**
311    * @copydoc Dali::Toolkit::WebView::CheckVideoPlayingAsynchronously()
312    */
313   bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback);
314
315   /**
316    * @copydoc Dali::Toolkit::WebView::RegisterGeolocationPermissionCallback()
317    */
318   void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
319
320   /**
321    * @copydoc Dali::Toolkit::WebView::SetTtsFocus()
322    */
323   void SetTtsFocus(bool focused);
324
325   /**
326    * @copydoc Dali::Toolkit::WebView::RegisterPageLoadStartedCallback()
327    */
328   void RegisterPageLoadStartedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
329
330   /**
331    * @copydoc Dali::Toolkit::WebView::RegisterPageLoadInProgressCallback()
332    */
333   void RegisterPageLoadInProgressCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
334
335   /**
336    * @copydoc Dali::Toolkit::WebView::RegisterPageLoadFinishedCallback()
337    */
338   void RegisterPageLoadFinishedCallback(Dali::WebEnginePlugin::WebEnginePageLoadCallback callback);
339
340   /**
341    * @copydoc Dali::Toolkit::WebView::RegisterPageLoadErrorCallback()
342    */
343   void RegisterPageLoadErrorCallback(Dali::WebEnginePlugin::WebEnginePageLoadErrorCallback callback);
344
345   /**
346    * @copydoc Dali::Toolkit::WebView::RegisterScrollEdgeReachedCallback()
347    */
348   void RegisterScrollEdgeReachedCallback(Dali::WebEnginePlugin::WebEngineScrollEdgeReachedCallback callback);
349
350   /**
351    * @copydoc Dali::Toolkit::WebView::RegisterUrlChangedCallback()
352    */
353   void RegisterUrlChangedCallback(Dali::WebEnginePlugin::WebEngineUrlChangedCallback callback);
354
355   /**
356    * @copydoc Dali::Toolkit::WebView::RegisterFormRepostDecidedCallback()
357    */
358   void RegisterFormRepostDecidedCallback(Dali::WebEnginePlugin::WebEngineFormRepostDecidedCallback callback);
359
360   /**
361    * @copydoc Dali::Toolkit::WebView::RegisterFrameRenderedCallback()
362    */
363   void RegisterFrameRenderedCallback(Dali::WebEnginePlugin::WebEngineFrameRenderedCallback callback);
364
365   /**
366    * @copydoc Dali::Toolkit::WebView::RegisterConsoleMessageReceivedCallback()
367    */
368   void RegisterConsoleMessageReceivedCallback(Dali::WebEnginePlugin::WebEngineConsoleMessageReceivedCallback callback);
369
370   /**
371    * @copydoc Dali::Toolkit::WebView::RegisterResponsePolicyDecidedCallback()
372    */
373   void RegisterResponsePolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineResponsePolicyDecidedCallback callback);
374
375   /**
376    * @copydoc Dali::Toolkit::WebView::RegisterNavigationPolicyDecidedCallback()
377    */
378   void RegisterNavigationPolicyDecidedCallback(Dali::WebEnginePlugin::WebEngineNavigationPolicyDecidedCallback callback);
379
380   /**
381    * @copydoc Dali::Toolkit::WebView::RegisterNewWindowCreatedCallback()
382    */
383   void RegisterNewWindowCreatedCallback(Dali::WebEnginePlugin::WebEngineNewWindowCreatedCallback callback);
384
385   /**
386    * @copydoc Dali::Toolkit::WebView::RegisterCertificateConfirmedCallback()
387    */
388   void RegisterCertificateConfirmedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback);
389
390   /**
391    * @copydoc Dali::Toolkit::WebView::RegisterSslCertificateChangedCallback()
392    */
393   void RegisterSslCertificateChangedCallback(Dali::WebEnginePlugin::WebEngineCertificateCallback callback);
394
395   /**
396    * @copydoc Dali::Toolkit::WebView::RegisterHttpAuthHandlerCallback()
397    */
398   void RegisterHttpAuthHandlerCallback(Dali::WebEnginePlugin::WebEngineHttpAuthHandlerCallback callback);
399
400   /**
401    * @copydoc Dali::Toolkit::WebView::RegisterContextMenuShownCallback()
402    */
403   void RegisterContextMenuShownCallback(Dali::WebEnginePlugin::WebEngineContextMenuShownCallback callback);
404
405   /**
406    * @copydoc Dali::Toolkit::WebView::RegisterContextMenuHiddenCallback()
407    */
408   void RegisterContextMenuHiddenCallback(Dali::WebEnginePlugin::WebEngineContextMenuHiddenCallback callback);
409
410   /**
411    * @copydoc Dali::Toolkit::WebView::GetPlainTextAsynchronously()
412    */
413   void GetPlainTextAsynchronously(Dali::WebEnginePlugin::PlainTextReceivedCallback callback);
414
415 public: // Properties
416   /**
417    * @brief Called when a property of an object of this type is set.
418    *
419    * @param[in] object The object whose property is set.
420    * @param[in] index The property index.
421    * @param[in] value The new property value.
422    */
423   static void SetProperty(Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value);
424
425   /**
426    * @brief Called to retrieve a property of an object of this type.
427    *
428    * @param[in] object The object whose property is to be retrieved.
429    * @param[in] index The property index.
430    * @return The current value of the property.
431    */
432   static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index propertyIndex);
433
434 private: // From Control
435   /**
436    * @copydoc Toolkit::Control::OnInitialize()
437    */
438   void OnInitialize() override;
439
440   /**
441    * @copydoc Toolkit::Internal::Control::CreateAccessibleObject()
442    */
443   DevelControl::ControlAccessible* CreateAccessibleObject() override;
444
445   /**
446    * @copydoc Toolkit::Internal::Control::OnRelayout()
447    */
448   void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
449
450   /**
451    * @copydoc Toolkit::Control::GetNaturalSize
452    */
453   Vector3 GetNaturalSize() override;
454
455   /**
456    * @copydoc Toolkit::Control::OnKeyEvent()
457    */
458   bool OnKeyEvent(const Dali::KeyEvent& event) override;
459
460   /**
461    * @copydoc Toolkit::Control::OnKeyInputFocusGained()
462    */
463   void OnKeyInputFocusGained() override;
464
465   /**
466    * @copydoc Toolkit::Control::OnKeyInputFocusLost()
467    */
468   void OnKeyInputFocusLost() override;
469
470   /**
471    * @copydoc Toolkit::Control::OnSceneConnection()
472    */
473   void OnSceneConnection(int depth) override;
474
475   /**
476    * @copydoc Toolkit::Control::OnSceneDisconnection()
477    */
478   void OnSceneDisconnection() override;
479
480 private:
481   // Undefined
482   WebView(const WebView& webView);
483
484   WebView& operator=(const WebView& webView);
485
486   /**
487    * @brief Set an absolute scroll of the given view.
488    * @param[in] x The coordinate x of scroll
489    * @param[in] y The coordinate y of scroll
490    */
491   void SetScrollPosition(int32_t x, int32_t y);
492
493   /**
494    * @brief Get the current scroll position of the given view.
495    * @param[out] x The coordinate x of scroll
496    * @param[out] y The coordinate y of scroll
497    */
498   Dali::Vector2 GetScrollPosition() const;
499
500   /**
501    * @brief Get the possible scroll size of the given view.
502    * @param[out] width The width of scroll size
503    * @param[out] height The height of scroll size
504    */
505   Dali::Vector2 GetScrollSize() const;
506
507   /**
508    * @brief Get the last known content's size.
509    * @param[out] width The width of content's size
510    * @param[out] height The height of content's size
511    */
512   Dali::Vector2 GetContentSize() const;
513
514   /**
515    * @brief Return the title of the Web.
516    *
517    * @return The title of web page
518    */
519   std::string GetTitle() const;
520
521   /**
522    * @brief Set the background color of web page.
523    * @param[in] color The value of background color.
524    */
525   void SetDocumentBackgroundColor(Dali::Vector4 color);
526
527   /**
528    * @brief Clear tiles when hidden.
529    *
530    * @param[in] cleared Whether tiles are cleared or not
531    */
532   void ClearTilesWhenHidden(bool cleared);
533
534   /**
535    * @brief Set multiplier of cover area of tile.
536    *
537    * @param[in] multiplier The multiplier of cover area
538    */
539   void SetTileCoverAreaMultiplier(float multiplier);
540
541   /**
542    * @brief Enable cursor by client.
543    * @param[in] enabled Whether cursor is enabled or not.
544    */
545   void EnableCursorByClient(bool enabled);
546
547   /**
548    * @brief Get the selected text.
549    * @return The selected text
550    */
551   std::string GetSelectedText() const;
552
553   /**
554    * @brief Get url of web page.
555    * @return The string of url
556    */
557   std::string GetUrl() const;
558
559   /**
560    * @brief Get user agent string.
561    * @return The string value of user agent
562    */
563   std::string GetUserAgent() const;
564
565   /**
566    * @brief Set user agent string.
567    * @param[in] userAgent The string value of user agent
568    */
569   void SetUserAgent(const std::string& userAgent);
570
571   /**
572    * @brief Set zoom factor of the current page.
573    * @param[in] zoomFactor a new factor to be set.
574    */
575   void SetPageZoomFactor(float zoomFactor);
576
577   /**
578    * @brief Query the current zoom factor of the page。
579    * @return The current page zoom factor.
580    */
581   float GetPageZoomFactor() const;
582
583   /**
584    * @brief Set the current text zoom level。.
585    * @param[in] zoomFactor a new factor to be set.
586    */
587   void SetTextZoomFactor(float zoomFactor);
588
589   /**
590    * @brief Get the current text zoom level.
591    * @return The current text zoom factor.
592    */
593   float GetTextZoomFactor() const;
594
595   /**
596    * @brief Get the current load progress of the page.
597    * @return The load progress of the page.
598    */
599   float GetLoadProgressPercentage() const;
600
601   /**
602    * @brief Request to set the current page's visibility.
603    * @param[in] visible Visible or not.
604    *
605    * @return true if succeeded, false otherwise
606    */
607   bool SetVisibility(bool visible);
608
609   /**
610    * @brief Enable/Disable video hole for video playing.
611    * @param[in] enabled True if video hole is enabled, false otherwise.
612    */
613   void EnableVideoHole(bool enabled);
614
615   /**
616    * @brief Enable blend mode.
617    * @param[in] blendEnabled True if turn on blend mode, false otherwise.
618    */
619   void EnableBlendMode(bool blendEnabled);
620
621   /**
622    * @brief Enable/disable mouse events. The default is enabled.
623    *
624    * @param[in] enabled True if mouse events are enabled, false otherwise
625    */
626   void EnableMouseEvents(bool enabled);
627
628   /**
629    * @brief Enable/disable key events. The default is enabled.
630    *
631    * @param[in] enabled True if key events enabled, false otherwise
632    */
633   void EnableKeyEvents(bool enabled);
634
635   /**
636    * @brief Create image view by pixel data.
637    * @param[in] pixel Pixel data
638    * @return The new image view
639    */
640   Dali::Toolkit::ImageView CreateImageView(Dali::PixelData pixel) const;
641
642   /**
643    * @brief Signal occurs when the Web View has been touched.
644    * @param[in] actor The Actor Touched
645    * @param[in] touch The Touch Data.
646    * @return Whether to consume event or not.
647    */
648   bool OnTouchEvent(Actor actor, const Dali::TouchEvent& touch);
649
650   /**
651    * @brief Signal occurs when the Web View has been hovered.
652    * @param[in] actor The Actor Hovered
653    * @param[in] hover The Hover Data.
654    * @return Whether to consume event or not.
655    */
656   bool OnHoverEvent(Actor actor, const Dali::HoverEvent& hover);
657
658   /**
659    * @brief Signal occurs when the Web View receives wheel event.
660    * @param[in] actor The Actor that receives Wheel event.
661    * @param[in] wheel The Wheel Data.
662    * @return Whether to consume event or not.
663    */
664   bool OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel);
665
666   /**
667    * @brief Callback function to be called when frame is rendered.
668    */
669   void OnFrameRendered();
670
671   /**
672    * @brief Callback for updating display area of web view.
673    * @param[in] source The soource triggers Notification.
674    */
675   void OnDisplayAreaUpdated(Dali::PropertyNotification& source);
676
677   /**
678    * @brief Callback function to be called when visibility is changed.
679    * @param[in] actor The actor, or child of actor, whose visibility has changed
680    * @param[in] isVisible Whether the actor is now visible or not
681    * @param[in] type, Whether the actor's visible property has changed or a parent's
682    */
683   void OnVisibilityChanged(Actor actor, bool isVisible, Dali::DevelActor::VisibilityChange::Type type);
684
685   /**
686    * @brief Callback when the visibility of the window is changed.
687    * @param[in] window The window whose visibility has changed
688    * @param[in] visible Whether the window is now visible or not
689    */
690   void OnWindowVisibilityChanged(Window window, bool visible);
691
692   /**
693    * @brief callback for screen shot captured.
694    * @param[in] pixel Pixel data of screen shot.
695    */
696   void OnScreenshotCaptured(Dali::PixelData pixel);
697
698   /**
699    * @brief Set DisplayArea by input value.
700    * It will send changes area infomations to webengine internally.
701    *
702    * @param[in] displayArea The display area for current webview want to show.
703    */
704   void SetDisplayArea(const Dali::Rect<int32_t>& displayArea);
705
706   /**
707    * @brief Apply self visibility state and send visibility chagend to web engine.
708    */
709   void ApplyVisibilityCheck();
710
711 protected:
712   class WebViewAccessible : public DevelControl::ControlAccessible
713   {
714   public:
715     WebViewAccessible() = delete;
716
717     WebViewAccessible(Dali::Actor self, Dali::WebEngine& webEngine);
718
719   protected:
720     /**
721      * @copydoc Dali::Accessibility::Accessible::GetAttributes()
722      */
723     Dali::Accessibility::Attributes GetAttributes() const override;
724
725     /**
726      * @copydoc Dali::Accessibility::ActorAccessible::DoGetChildren()
727      */
728     void DoGetChildren(std::vector<Dali::Accessibility::Accessible*>& children) override;
729
730   private:
731     void OnAccessibilityEnabled();
732     void OnAccessibilityDisabled();
733     void SetRemoteChildAddress(Dali::Accessibility::Address address);
734
735     Dali::Accessibility::ProxyAccessible mRemoteChild;
736     Dali::WebEngine&                     mWebEngine;
737   };
738
739 private:
740   Dali::Toolkit::Visual::Base mVisual;
741   Dali::Size                  mWebViewSize;
742   Dali::WebEngine             mWebEngine;
743
744   uint32_t mLastRenderedNativeImageWidth;
745   uint32_t mLastRenderedNativeImageHeight;
746
747   enum WebViewVisibleStateFlag
748   {
749     NONE        = 0,
750     SCENE_ON    = 1 << 0,
751     WINDOW_SHOW = 1 << 1,
752     SELF_SHOW   = 1 << 2,
753     PARENT_SHOW = 1 << 3,
754
755     VISIBLE = SCENE_ON | WINDOW_SHOW | SELF_SHOW | PARENT_SHOW,
756   };
757   uint32_t           mWebViewVisibleState{WebViewVisibleStateFlag::NONE}; /// Flag of web view visible.
758   WeakHandle<Window> mPlacementWindow;
759
760   std::unique_ptr<Dali::Toolkit::WebSettings>        mWebSettings;
761   std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
762
763   Dali::PropertyNotification mPositionUpdateNotification;
764   Dali::PropertyNotification mSizeUpdateNotification;
765   Dali::PropertyNotification mScaleUpdateNotification;
766   Dali::Rect<int32_t>        mWebViewArea;
767   bool                       mVideoHoleEnabled;
768   bool                       mMouseEventsEnabled;
769   bool                       mKeyEventsEnabled;
770
771   bool mVisualChangeRequired;
772
773   Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback;
774   Dali::WebEnginePlugin::WebEngineFrameRenderedCallback     mFrameRenderedCallback;
775 };
776
777 } // namespace Internal
778
779 inline Toolkit::Internal::WebView& GetImpl(Toolkit::WebView& handle)
780 {
781   DALI_ASSERT_ALWAYS(handle);
782   Dali::RefObject& impl = handle.GetImplementation();
783   return static_cast<Toolkit::Internal::WebView&>(impl);
784 }
785
786 inline const Toolkit::Internal::WebView& GetImpl(const Toolkit::WebView& handle)
787 {
788   DALI_ASSERT_ALWAYS(handle);
789   const Dali::RefObject& impl = handle.GetImplementation();
790   return static_cast<const Toolkit::Internal::WebView&>(impl);
791 }
792
793 } // namespace Toolkit
794
795 } // namespace Dali
796
797 #endif // DALI_TOOLKIT_INTERNAL_WEB_VIEW_H