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