Add WebView SetTtsFocus
[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) 2021 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/web-engine.h>
24 #include <dali/public-api/images/image-operations.h>
25 #include <dali/public-api/object/property-notification.h>
26 #include <memory>
27
28 // INTERNAL INCLUDES
29 #include <dali-toolkit/devel-api/controls/web-view/web-view.h>
30 #include <dali-toolkit/devel-api/visual-factory/visual-base.h>
31 #include <dali-toolkit/public-api/controls/control-impl.h>
32 #include <dali-toolkit/public-api/controls/image-view/image-view.h>
33
34 namespace Dali
35 {
36 namespace Toolkit
37 {
38 class KeyEvent;
39 class TouchEvent;
40 class WebBackForwardList;
41 class WebContext;
42 class WebCookieManager;
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::GetSettings()
77    */
78   Dali::Toolkit::WebSettings* GetSettings() const;
79
80   /**
81    * @copydoc Dali::Toolkit::WebView::GetContext()
82    */
83   Dali::Toolkit::WebContext* GetContext() const;
84
85   /**
86    * @copydoc Dali::Toolkit::WebView::GetCookieManager()
87    */
88   Dali::Toolkit::WebCookieManager* GetCookieManager() const;
89
90   /**
91    * @copydoc Dali::Toolkit::WebView::GetBackForwardList()
92    */
93   Dali::Toolkit::WebBackForwardList* GetBackForwardList() const;
94
95   /**
96    * @copydoc Dali::Toolkit::WebView::GetFavicon()
97    */
98   Dali::Toolkit::ImageView GetFavicon() const;
99
100   /**
101    * @copydoc Dali::Toolkit::WebView::LoadUrl()
102    */
103   void LoadUrl(const std::string& url);
104
105   /**
106    * @copydoc Dali::WebEngine::LoadHTMLString()
107    */
108   void LoadHtmlString(const std::string& htmlString);
109
110   /**
111    * @copydoc Dali::WebEngine::LoadHtmlStringOverrideCurrentEntry()
112    */
113   bool LoadHtmlStringOverrideCurrentEntry(const std::string& html, const std::string& basicUri, const std::string& unreachableUrl);
114
115   /**
116    * @copydoc Dali::WebEngine::LoadContents()
117    */
118   bool LoadContents(const std::string& contents, uint32_t contentSize, const std::string& mimeType, const std::string& encoding, const std::string& baseUri);
119
120   /**
121    * @copydoc Dali::Toolkit::WebView::Reload()
122    */
123   void Reload();
124
125   /**
126    * @copydoc Dali::WebEngine::ReloadWithoutCache()
127    */
128   bool ReloadWithoutCache();
129
130   /**
131    * @copydoc Dali::Toolkit::WebView::StopLoading()
132    */
133   void StopLoading();
134
135   /**
136    * @copydoc Dali::Toolkit::WebView::StopLoading()
137    */
138   void Suspend();
139
140   /**
141    * @copydoc Dali::Toolkit::WebView::Resume()
142    */
143   void Resume();
144
145   /**
146    * @copydoc Dali::WebEngine::SuspendNetworkLoading()
147    */
148   void SuspendNetworkLoading();
149
150   /**
151    * @copydoc Dali::WebEngine::ResumeNetworkLoading()
152    */
153   void ResumeNetworkLoading();
154
155   /**
156    * @copydoc Dali::WebEngine::AddCustomHeader()
157    */
158   bool AddCustomHeader(const std::string& name, const std::string& value);
159
160   /**
161    * @copydoc Dali::WebEngine::RemoveCustomHeader()
162    */
163   bool RemoveCustomHeader(const std::string& name);
164
165   /**
166    * @copydoc Dali::WebEngine::StartInspectorServer()
167    */
168   uint32_t StartInspectorServer(uint32_t port);
169
170   /**
171    * @copydoc Dali::WebEngine::StopInspectorServer()
172    */
173   bool StopInspectorServer();
174
175   /**
176    * @copydoc Dali::Toolkit::WebView::ScrollBy()
177    */
178   void ScrollBy(int32_t deltaX, int32_t deltaY);
179
180   /**
181    * @copydoc Dali::WebEngine::ScrollEdgeBy()
182    */
183   bool ScrollEdgeBy(int32_t deltaX, int32_t deltaY);
184
185   /**
186    * @copydoc Dali::Toolkit::WebView::CanGoForward()
187    */
188   bool CanGoForward();
189
190   /**
191    * @copydoc Dali::Toolkit::WebView::GoForward()
192    */
193   void GoForward();
194
195   /**
196    * @copydoc Dali::Toolkit::WebView::CanGoBack()
197    */
198   bool CanGoBack();
199
200   /**
201    * @copydoc Dali::Toolkit::WebView::GoBack()
202    */
203   void GoBack();
204
205   /**
206    * @copydoc Dali::Toolkit::WebView::EvaluateJavaScript()
207    */
208   void EvaluateJavaScript(const std::string& script, std::function<void(const std::string&)> resultHandler);
209
210   /**
211    * @copydoc Dali::Toolkit::WebView::AddJavaScriptMessageHandler()
212    */
213   void AddJavaScriptMessageHandler(const std::string& exposedObjectName, std::function<void(const std::string&)> handler);
214
215   /**
216    * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptAlertCallback()
217    */
218   void RegisterJavaScriptAlertCallback(Dali::WebEnginePlugin::JavaScriptAlertCallback callback);
219
220   /**
221    * @copydoc Dali::Toolkit::WebView::JavaScriptAlertReply()
222    */
223   void JavaScriptAlertReply();
224
225   /**
226    * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptConfirmCallback()
227    */
228   void RegisterJavaScriptConfirmCallback(Dali::WebEnginePlugin::JavaScriptConfirmCallback callback);
229
230   /**
231    * @copydoc Dali::Toolkit::WebView::JavaScriptConfirmReply()
232    */
233   void JavaScriptConfirmReply(bool confirmed);
234
235   /**
236    * @copydoc Dali::Toolkit::WebView::RegisterJavaScriptPromptCallback()
237    */
238   void RegisterJavaScriptPromptCallback(Dali::WebEnginePlugin::JavaScriptPromptCallback callback);
239
240   /**
241    * @copydoc Dali::Toolkit::WebView::JavaScriptPromptReply()
242    */
243   void JavaScriptPromptReply(const std::string& result);
244
245   /**
246    * @copydoc Dali::Toolkit::WebView::CreateHitTest()
247    */
248   std::unique_ptr<Dali::WebEngineHitTest> CreateHitTest(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode);
249
250   /**
251    * @copydoc Dali::Toolkit::WebView::CreateHitTestAsynchronously()
252    */
253   bool CreateHitTestAsynchronously(int32_t x, int32_t y, Dali::WebEngineHitTest::HitTestMode mode, Dali::WebEnginePlugin::WebEngineHitTestCreatedCallback callback);
254
255   /**
256    * @copydoc Dali::Toolkit::WebView::ClearHistory()
257    */
258   void ClearHistory();
259
260   /**
261    * @copydoc Dali::Toolkit::WebView::ClearAllTilesResources()
262    */
263   void ClearAllTilesResources();
264
265   /**
266    * @copydoc Dali::Toolkit::WebView::SetScaleFactor()
267    */
268   void SetScaleFactor(float scaleFactor, Dali::Vector2 point);
269
270   /**
271    * @copydoc Dali::Toolkit::WebView::GetScaleFactor()
272    */
273   float GetScaleFactor() const;
274
275   /**
276    * @copydoc Dali::Toolkit::WebView::ActivateAccessibility()
277    */
278   void ActivateAccessibility(bool activated);
279
280   /**
281    * @copydoc Dali::Toolkit::WebView::HighlightText()
282    */
283   bool HighlightText(const std::string& text, Dali::WebEnginePlugin::FindOption options, uint32_t maxMatchCount);
284
285   /**
286    * @copydoc Dali::Toolkit::WebView::AddDynamicCertificatePath()
287    */
288   void AddDynamicCertificatePath(const std::string& host, const std::string& certPath);
289
290   /**
291    * @copydoc Dali::Toolkit::WebView::GetScreenshot()
292    */
293   Dali::Toolkit::ImageView GetScreenshot(Dali::Rect<int32_t> viewArea, float scaleFactor);
294
295   /**
296    * @copydoc Dali::Toolkit::WebView::GetScreenshotAsynchronously()
297    */
298   bool GetScreenshotAsynchronously(Dali::Rect<int32_t> viewArea, float scaleFactor, Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback callback);
299
300   /**
301    * @copydoc Dali::Toolkit::WebView::CheckVideoPlayingAsynchronously()
302    */
303   bool CheckVideoPlayingAsynchronously(Dali::WebEnginePlugin::VideoPlayingCallback callback);
304
305   /**
306    * @copydoc Dali::Toolkit::WebView::RegisterGeolocationPermissionCallback()
307    */
308   void RegisterGeolocationPermissionCallback(Dali::WebEnginePlugin::GeolocationPermissionCallback callback);
309
310   /**
311    * @copydoc Dali::Toolkit::WebView::SetTtsFocus()
312    */
313   void SetTtsFocus(bool focused);
314
315   /**
316    * @copydoc Dali::Toolkit::WebView::PageLoadStartedSignal()
317    */
318   Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadStartedSignal();
319
320   /**
321    * @copydoc Dali::Toolkit::WebView::PageLoadInProgressSignal()
322    */
323   Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadInProgressSignal();
324
325   /**
326    * @copydoc Dali::Toolkit::WebView::PageLoadFinishedSignal()
327    */
328   Dali::Toolkit::WebView::WebViewPageLoadSignalType& PageLoadFinishedSignal();
329
330   /**
331    * @copydoc Dali::Toolkit::WebView::PageLoadErrorSignal()
332    */
333   Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType& PageLoadErrorSignal();
334
335   /**
336    * @copydoc Dali::Toolkit::WebView::ScrollEdgeReachedSignal()
337    */
338   Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType& ScrollEdgeReachedSignal();
339
340   /**
341    * @copydoc Dali::Toolkit::WebView::UrlChangedSignal()
342    */
343   Dali::Toolkit::WebView::WebViewUrlChangedSignalType& UrlChangedSignal();
344
345   /**
346    * @copydoc Dali::Toolkit::WebView::FormRepostDecisionSignal()
347    */
348   Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType& FormRepostDecisionSignal();
349
350   /**
351    * @copydoc Dali::Toolkit::WebView::FrameRenderedSignal()
352    */
353   Dali::Toolkit::WebView::WebViewFrameRenderedSignalType& FrameRenderedSignal();
354
355   /**
356    * @copydoc Dali::Toolkit::WebView::RequestInterceptorSignal()
357    */
358   Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType& RequestInterceptorSignal();
359
360   /**
361    * @copydoc Dali::Toolkit::WebView::ConsoleMessageSignal()
362    */
363   Dali::Toolkit::WebView::WebViewConsoleMessageSignalType& ConsoleMessageSignal();
364
365   /**
366    * @copydoc Dali::Toolkit::WebView::ResponsePolicyDecisionSignal()
367    */
368   Dali::Toolkit::WebView::WebViewResponsePolicyDecisionSignalType& ResponsePolicyDecisionSignal();
369
370   /**
371    * @copydoc Dali::Toolkit::WebView::CertificateConfirmSignal()
372    */
373   Dali::Toolkit::WebView::WebViewCertificateSignalType& CertificateConfirmSignal();
374
375   /**
376    * @copydoc Dali::Toolkit::WebView::SslCertificateChangedSignal()
377    */
378   Dali::Toolkit::WebView::WebViewCertificateSignalType& SslCertificateChangedSignal();
379
380   /**
381    * @copydoc Dali::Toolkit::WebView::HttpAuthHandlerSignal()
382    */
383   Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType& HttpAuthHandlerSignal();
384
385   /**
386    * @copydoc Dali::Toolkit::WebView::ContextMenuShownSignal()
387    */
388   Dali::Toolkit::WebView::WebViewContextMenuShownSignalType& ContextMenuShownSignal();
389
390   /**
391    * @copydoc Dali::Toolkit::WebView::ContextMenuHiddenSignal()
392    */
393   Dali::Toolkit::WebView::WebViewContextMenuHiddenSignalType& ContextMenuHiddenSignal();
394
395 public: // Properties
396   /**
397    * @brief Called when a property of an object of this type is set.
398    *
399    * @param[in] object The object whose property is set.
400    * @param[in] index The property index.
401    * @param[in] value The new property value.
402    */
403   static void SetProperty(Dali::BaseObject* object, Dali::Property::Index index, const Dali::Property::Value& value);
404
405   /**
406    * @brief Called to retrieve a property of an object of this type.
407    *
408    * @param[in] object The object whose property is to be retrieved.
409    * @param[in] index The property index.
410    * @return The current value of the property.
411    */
412   static Dali::Property::Value GetProperty(Dali::BaseObject* object, Dali::Property::Index propertyIndex);
413
414   /**
415    * Connects a callback function with the object's signals.
416    * @param[in] object The object providing the signal.
417    * @param[in] tracker Used to disconnect the signal.
418    * @param[in] signalName The signal to connect to.
419    * @param[in] functor A newly allocated FunctorDelegate.
420    * @return True if the signal was connected.
421    * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the c
422    */
423   static bool DoConnectSignal(BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor);
424
425 private: // From Control
426   /**
427    * @copydoc Toolkit::Control::OnInitialize()
428    */
429   void OnInitialize() override;
430
431   /**
432    * @copydoc Toolkit::Control::GetNaturalSize
433    */
434   Vector3 GetNaturalSize() override;
435
436   /**
437    * @copydoc Toolkit::Control::OnKeyEvent()
438    */
439   bool OnKeyEvent(const Dali::KeyEvent& event) override;
440
441   /**
442    * @copydoc Toolkit::Control::OnKeyInputFocusGained()
443    */
444   void OnKeyInputFocusGained() override;
445
446   /**
447    * @copydoc Toolkit::Control::OnKeyInputFocusLost()
448    */
449   void OnKeyInputFocusLost() override;
450
451   /**
452    * @copydoc Toolkit::Control::OnSceneConnection()
453    */
454   void OnSceneConnection(int depth) override;
455
456 private:
457   // Undefined
458   WebView(const WebView& webView);
459
460   WebView& operator=(const WebView& webView);
461
462   /**
463    * @brief Set an absolute scroll of the given view.
464    * @param[in] x The coordinate x of scroll
465    * @param[in] y The coordinate y of scroll
466    */
467   void SetScrollPosition(int32_t x, int32_t y);
468
469   /**
470    * @brief Get the current scroll position of the given view.
471    * @param[out] x The coordinate x of scroll
472    * @param[out] y The coordinate y of scroll
473    */
474   Dali::Vector2 GetScrollPosition() const;
475
476   /**
477    * @brief Get the possible scroll size of the given view.
478    * @param[out] width The width of scroll size
479    * @param[out] height The height of scroll size
480    */
481   Dali::Vector2 GetScrollSize() const;
482
483   /**
484    * @brief Get the last known content's size.
485    * @param[out] width The width of content's size
486    * @param[out] height The height of content's size
487    */
488   Dali::Vector2 GetContentSize() const;
489
490   /**
491    * @brief Return the title of the Web.
492    *
493    * @return The title of web page
494    */
495   std::string GetTitle() const;
496
497   /**
498    * @brief Set the background color of web page.
499    * @param[in] color The value of background color.
500    */
501   void SetDocumentBackgroundColor(Dali::Vector4 color);
502
503   /**
504    * @brief Clear tiles when hidden.
505    *
506    * @param[in] cleared Whether tiles are cleared or not
507    */
508   void ClearTilesWhenHidden(bool cleared);
509
510   /**
511    * @brief Set multiplier of cover area of tile.
512    *
513    * @param[in] multiplier The multiplier of cover area
514    */
515   void SetTileCoverAreaMultiplier(float multiplier);
516
517   /**
518    * @brief Enable cursor by client.
519    * @param[in] enabled Whether cursor is enabled or not.
520    */
521   void EnableCursorByClient(bool enabled);
522
523   /**
524    * @brief Get the selected text.
525    * @return The selected text
526    */
527   std::string GetSelectedText() const;
528
529   /**
530    * @brief Get url of web page.
531    * @return The string of url
532    */
533   std::string GetUrl() const;
534
535   /**
536    * @brief Get user agent string.
537    * @return The string value of user agent
538    */
539   std::string GetUserAgent() const;
540
541   /**
542    * @brief Set user agent string.
543    * @param[in] userAgent The string value of user agent
544    */
545   void SetUserAgent(const std::string& userAgent);
546
547   /**
548    * @brief Set zoom factor of the current page.
549    * @param[in] zoomFactor a new factor to be set.
550    */
551   void SetPageZoomFactor(float zoomFactor);
552
553   /**
554    * @brief Query the current zoom factor of the page。
555    * @return The current page zoom factor.
556    */
557   float GetPageZoomFactor() const;
558
559   /**
560    * @brief Set the current text zoom level。.
561    * @param[in] zoomFactor a new factor to be set.
562    */
563   void SetTextZoomFactor(float zoomFactor);
564
565   /**
566    * @brief Get the current text zoom level.
567    * @return The current text zoom factor.
568    */
569   float GetTextZoomFactor() const;
570
571   /**
572    * @brief Get the current load progress of the page.
573    * @return The load progress of the page.
574    */
575   float GetLoadProgressPercentage() const;
576
577   /**
578    * @brief Request to set the current page's visibility.
579    * @param[in] visible Visible or not.
580    *
581    * @return true if succeeded, false otherwise
582    */
583   bool SetVisibility(bool visible);
584
585   /**
586    * @brief Update display area of web view.
587    * @param[in] source The soource triggers Notification.
588    */
589   void UpdateDisplayArea(Dali::PropertyNotification& source);
590
591   /**
592    * @brief Enable/Disable video hole for video playing.
593    * @param[in] enabled True if video hole is enabled, false otherwise.
594    */
595   void EnableVideoHole(bool enabled);
596
597   /**
598    * @brief Enable blend mode.
599    * @param[in] blendEnabled True if turn on blend mode, false otherwise.
600    */
601   void EnableBlendMode(bool blendEnabled);
602
603   /**
604    * @brief Enable/disable mouse events. The default is enabled.
605    *
606    * @param[in] enabled True if mouse events are enabled, false otherwise
607    */
608   void EnableMouseEvents(bool enabled);
609
610   /**
611    * @brief Enable/disable key events. The default is enabled.
612    *
613    * @param[in] enabled True if key events enabled, false otherwise
614    */
615   void EnableKeyEvents(bool enabled);
616
617   /**
618    * @brief Create image view by pixel data.
619    * @param[in] pixel Pixel data
620    * @return The new image view
621    */
622   Dali::Toolkit::ImageView CreateImageView(Dali::PixelData pixel) const;
623
624   /**
625    * @brief Callback function to be called when page load started.
626    * @param[in] url The url currently being loaded
627    */
628   void OnPageLoadStarted(const std::string& url);
629
630   /**
631    * @brief Callback function to be called when page is loading in progress.
632    * @param[in] url The url currently being loaded
633    */
634   void OnPageLoadInProgress(const std::string& url);
635
636   /**
637    * @brief Callback function to be called when page load finished.
638    * @param[in] url The url currently being loaded
639    */
640   void OnPageLoadFinished(const std::string& url);
641
642   /**
643    * @brief Callback function to be called when there is an error in page loading.
644    * @param[in] url The url currently being loaded
645    * @param[in] errorCode The error code
646    */
647   void OnPageLoadError(std::shared_ptr<Dali::WebEngineLoadError> error);
648
649   /**
650    * @brief Callback function to be called when scroll edge is reached.
651    * @param[in] edge The scroll edge reached.
652    */
653   void OnScrollEdgeReached(Dali::WebEnginePlugin::ScrollEdge edge);
654
655   /**
656    * @brief Callback function to be called when url is changed.
657    * @param[in] url The url currently being loaded
658    */
659   void OnUrlChanged(const std::string& url);
660
661   /**
662    * @brief Signal occurs when the Web View has been touched.
663    * @param[in] actor The Actor Touched
664    * @param[in] touch The Touch Data.
665    * @return Whether to consume event or not.
666    */
667   bool OnTouchEvent(Actor actor, const Dali::TouchEvent& touch);
668
669   /**
670    * @brief Signal occurs when the Web View has been hovered.
671    * @param[in] actor The Actor Hovered
672    * @param[in] hover The Hover Data.
673    * @return Whether to consume event or not.
674    */
675   bool OnHoverEvent(Actor actor, const Dali::HoverEvent& hover);
676
677   /**
678    * @brief Signal occurs when the Web View receives wheel event.
679    * @param[in] actor The Actor that receives Wheel event.
680    * @param[in] wheel The Wheel Data.
681    * @return Whether to consume event or not.
682    */
683   bool OnWheelEvent(Actor actor, const Dali::WheelEvent& wheel);
684
685   /**
686    * @brief Callback function to be called when form repost decision need be checked.
687    * @param[in] decision The new decision for form repost
688    */
689   void OnFormRepostDecision(std::shared_ptr<Dali::WebEngineFormRepostDecision> decision);
690
691   /**
692    * @brief Callback function to be called when frame is rendered.
693    */
694   void OnFrameRendered();
695
696   /**
697    * @brief Callback function to be called when frame is rendered. This is to check initial buffer is ready.
698    */
699   void OnInitialFrameRendered();
700
701   /**
702    * @brief Callback function to be called when visibility is changed.
703    * @param[in] actor The actor, or child of actor, whose visibility has changed
704    * @param[in] isVisible Whether the actor is now visible or not
705    * @param[in] type, Whether the actor's visible property has changed or a parent's
706    */
707   void OnVisibilityChanged(Actor actor, bool isVisible, Dali::DevelActor::VisibilityChange::Type type);
708
709   /**
710    * @brief callback for screen shot captured.
711    * @param[in] pixel Pixel data of screen shot.
712    */
713   void OnScreenshotCaptured(Dali::PixelData pixel);
714
715   /**
716    * @brief Callback function to be called when http request need be intercepted.
717    * @param [in] request The http request interceptor.
718    */
719   void OnInterceptRequest(std::shared_ptr<Dali::WebEngineRequestInterceptor> interceptor);
720
721   /**
722    * @brief Callback function to be called when console message will be logged.
723    * @param[in] message The message logged.
724    */
725   void OnConsoleMessage(std::shared_ptr<Dali::WebEngineConsoleMessage> message);
726
727   /**
728    * @brief Callback function to be called when response policy need be decided.
729    * @param[in] decision The policy decided.
730    */
731   void OnResponsePolicyDecided(std::shared_ptr<Dali::WebEnginePolicyDecision> decision);
732
733   /**
734    * @brief Callback function to be called when certificate need be confirmed.
735    * @param[in] certificate The certificate policy decision.
736    */
737   void OnCertificateConfirm(std::shared_ptr<Dali::WebEngineCertificate> certificate);
738
739   /**
740    * @brief Callback function to be called when ssl certificate is changed.
741    * @param[in] certificate The certificate information received.
742    */
743   void OnSslCertificateChanged(std::shared_ptr<Dali::WebEngineCertificate> certificate);
744
745   /**
746    * @brief Callback function to be called when http authentication need be confirmed.
747    * @param[in] handler The handler for http authentication
748    */
749   void OnHttpAuthenticationRequest(std::shared_ptr<Dali::WebEngineHttpAuthHandler> handler);
750
751   /**
752    * @brief Callback function to be called when context menu would be shown.
753    * @param[in] e The scroll edge reached.
754    */
755   void OnContextMenuShown(std::shared_ptr<Dali::WebEngineContextMenu> menu);
756
757   /**
758    * @brief Callback function to be called when context menu would be hidden.
759    * @param[in] url The url currently being loaded
760    */
761   void OnContextMenuHidden(std::shared_ptr<Dali::WebEngineContextMenu> menu);
762
763 private:
764   Dali::Toolkit::Visual::Base mVisual;
765   Dali::Size                  mWebViewSize;
766   Dali::WebEngine             mWebEngine;
767
768   Dali::Toolkit::WebView::WebViewPageLoadSignalType               mPageLoadStartedSignal;
769   Dali::Toolkit::WebView::WebViewPageLoadSignalType               mPageLoadInProgressSignal;
770   Dali::Toolkit::WebView::WebViewPageLoadSignalType               mPageLoadFinishedSignal;
771   Dali::Toolkit::WebView::WebViewPageLoadErrorSignalType          mPageLoadErrorSignal;
772   Dali::Toolkit::WebView::WebViewUrlChangedSignalType             mUrlChangedSignal;
773   Dali::Toolkit::WebView::WebViewScrollEdgeReachedSignalType      mScrollEdgeReachedSignal;
774   Dali::Toolkit::WebView::WebViewFormRepostDecisionSignalType     mFormRepostDecisionSignal;
775   Dali::Toolkit::WebView::WebViewFrameRenderedSignalType          mFrameRenderedSignal;
776   Dali::Toolkit::WebView::WebViewRequestInterceptorSignalType     mRequestInterceptorSignal;
777   Dali::Toolkit::WebView::WebViewConsoleMessageSignalType         mConsoleMessageSignal;
778   Dali::Toolkit::WebView::WebViewResponsePolicyDecisionSignalType mResponsePolicyDecisionSignal;
779   Dali::Toolkit::WebView::WebViewCertificateSignalType            mCertificateConfirmSignal;
780   Dali::Toolkit::WebView::WebViewCertificateSignalType            mSslCertificateChangedSignal;
781   Dali::Toolkit::WebView::WebViewHttpAuthHandlerSignalType        mHttpAuthHandlerSignal;
782   Dali::Toolkit::WebView::WebViewContextMenuShownSignalType       mContextMenuShownSignal;
783   Dali::Toolkit::WebView::WebViewContextMenuHiddenSignalType      mContextMenuHiddenSignal;
784
785   std::unique_ptr<Dali::Toolkit::WebContext>         mWebContext;
786   std::unique_ptr<Dali::Toolkit::WebCookieManager>   mWebCookieManager;
787   std::unique_ptr<Dali::Toolkit::WebSettings>        mWebSettings;
788   std::unique_ptr<Dali::Toolkit::WebBackForwardList> mWebBackForwardList;
789
790   Dali::PropertyNotification mPositionUpdateNotification;
791   Dali::PropertyNotification mSizeUpdateNotification;
792   Dali::PropertyNotification mScaleUpdateNotification;
793   Dali::Rect<int32_t>        mWebViewArea;
794   bool                       mVideoHoleEnabled;
795   bool                       mMouseEventsEnabled;
796   bool                       mKeyEventsEnabled;
797
798   Dali::Toolkit::WebView::WebViewScreenshotCapturedCallback mScreenshotCapturedCallback;
799 };
800
801 } // namespace Internal
802
803 inline Toolkit::Internal::WebView& GetImpl(Toolkit::WebView& handle)
804 {
805   DALI_ASSERT_ALWAYS(handle);
806   Dali::RefObject& impl = handle.GetImplementation();
807   return static_cast<Toolkit::Internal::WebView&>(impl);
808 }
809
810 inline const Toolkit::Internal::WebView& GetImpl(const Toolkit::WebView& handle)
811 {
812   DALI_ASSERT_ALWAYS(handle);
813   const Dali::RefObject& impl = handle.GetImplementation();
814   return static_cast<const Toolkit::Internal::WebView&>(impl);
815 }
816
817 } // namespace Toolkit
818
819 } // namespace Dali
820
821 #endif // DALI_TOOLKIT_INTERNAL_WEB_VIEW_H