From 25f910c865ebf5b96b0765f9705f146b6495c703 Mon Sep 17 00:00:00 2001 From: yangzhiwen Date: Mon, 4 Mar 2024 16:57:42 +0800 Subject: [PATCH] [M120 Migration] Support Downloadable font info feature Migration from: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/292674/ Change-Id: I71b63bab8327083cc23aaccaf485e0364e1cbea5 Signed-off-by: yangzhiwen --- content/public/browser/web_contents_delegate.h | 4 ++++ .../media/filters/media_player_bridge_capi_tv.cc | 13 +++++++++++++ .../media/filters/media_player_bridge_capi_tv.h | 4 ++++ tizen_src/ewk/efl_integration/eweb_view.cc | 13 +++++++++++++ tizen_src/ewk/efl_integration/eweb_view.h | 4 ++++ tizen_src/ewk/efl_integration/eweb_view_callbacks.h | 2 ++ tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc | 11 +++++++++++ tizen_src/ewk/efl_integration/web_contents_delegate_efl.h | 4 ++++ 8 files changed, 55 insertions(+) diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h index 3798652..8776ed2 100644 --- a/content/public/browser/web_contents_delegate.h +++ b/content/public/browser/web_contents_delegate.h @@ -740,6 +740,10 @@ class CONTENT_EXPORT WebContentsDelegate { uint32_t previous, uint32_t current) {}; virtual bool IsHighBitRate() const { return false; } + virtual void NotifyDownloadableFontInfo(const std::string& scheme_id_uri, + const std::string& value, + const std::string& data, + int type) {} #endif #if BUILDFLAG(IS_ANDROID) diff --git a/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc b/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc index 1a05845..da8a9a5 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc +++ b/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc @@ -209,4 +209,17 @@ bool MediaPlayerBridgeCapiTV::CheckHighBitRate() { return ret; } +void MediaPlayerBridgeCapiTV::HandleDownloadableFontInfo( + const std::string& scheme_id_uri, + const std::string& value, + const std::string& data, + int type) { + content::WebContentsDelegate* web_contents_delegate = + GetMediaPlayerClient()->GetWebContentsDelegate(); + if (!web_contents_delegate) + return; + web_contents_delegate->NotifyDownloadableFontInfo(scheme_id_uri, value, data, + type); +} + } // namespace media diff --git a/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.h b/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.h index eeeba28..68f09cf 100644 --- a/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.h +++ b/tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.h @@ -33,6 +33,10 @@ class MEDIA_EXPORT MediaPlayerBridgeCapiTV : public MediaPlayerBridgeCapi { void PlaybackCompleteUpdate() override; void AppendUrlHighBitRate(const std::string& url); bool CheckHighBitRate(); + void HandleDownloadableFontInfo(const std::string& scheme_id_uri, + const std::string& value, + const std::string& data, + int type); protected: void PlayerPrepared() override; diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 23037c1..9e830c0 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -3423,6 +3423,19 @@ bool EWebView::SetMixedContents(bool allow) { return mixed_content_observer->MixedContentReply(allow); } +void EWebView::NotifyDownloadableFontInfo(const char* scheme_id_uri, + const char* value, + const char* data, + int type) { + LOG(INFO) << "scheme_id_uri:" << scheme_id_uri << ",value:" << value + << ",data:" << data << ",type:" << type; + Ewk_Media_Downloadable_Font_Info* info = + ewkMediaDownloadableFontInfoCreate(scheme_id_uri, value, data, type); + SmartCallback().call( + static_cast(info)); + ewkMediaDownloadableFontInfoDelete(info); +} + void EWebView::NotifyMediaStateChanged(uint32_t device_type, uint32_t previous, uint32_t current) { diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index 055fd05..6cb3204 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -376,6 +376,10 @@ class EWebView { void Stop(); #if BUILDFLAG(IS_TIZEN_TV) void SetFloatVideoWindowState(bool enabled); + void NotifyDownloadableFontInfo(const char* scheme_id_uri, + const char* value, + const char* data, + int type); #endif // IS_TIZEN_TV void SetSessionTimeout(uint64_t timeout); double GetTextZoomFactor() const; diff --git a/tizen_src/ewk/efl_integration/eweb_view_callbacks.h b/tizen_src/ewk/efl_integration/eweb_view_callbacks.h index 8b5b2e2..bd2cc64 100644 --- a/tizen_src/ewk/efl_integration/eweb_view_callbacks.h +++ b/tizen_src/ewk/efl_integration/eweb_view_callbacks.h @@ -114,6 +114,7 @@ enum CallbackType { EdgeTop, EdgeBottom, #if BUILDFLAG(IS_TIZEN_TV) + DownloadableFontInfo, EdgeScrollBottom, EdgeScrollLeft, EdgeScrollRight, @@ -284,6 +285,7 @@ DECLARE_EWK_VIEW_CALLBACK(EdgeTop, "edge,top", void); DECLARE_EWK_VIEW_CALLBACK(EdgeBottom, "edge,bottom", void); DECLARE_EWK_VIEW_CALLBACK(EdgeRight, "edge,right", void); #if BUILDFLAG(IS_TIZEN_TV) +DECLARE_EWK_VIEW_CALLBACK(DownloadableFontInfo, "on,downloadable,font", void*); DECLARE_EWK_VIEW_CALLBACK(EdgeScrollBottom, "edge,scroll,bottom", bool*); DECLARE_EWK_VIEW_CALLBACK(EdgeScrollLeft, "edge,scroll,left", bool*); DECLARE_EWK_VIEW_CALLBACK(EdgeScrollRight, "edge,scroll,right", bool*); diff --git a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc index 4825a63..f8a52dc 100644 --- a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc @@ -786,5 +786,16 @@ void WebContentsDelegateEfl::DidEdgeScrollBy(const gfx::Point& offset, bool WebContentsDelegateEfl::IsHighBitRate() const { return web_view_ ? web_view_->IsHighBitRate() : false; } + +void WebContentsDelegateEfl::NotifyDownloadableFontInfo( + const std::string& scheme_id_uri, + const std::string& value, + const std::string& data, + int type) { + if (!web_view_) + return; + web_view_->NotifyDownloadableFontInfo(scheme_id_uri.c_str(), value.c_str(), + data.c_str(), type); +} #endif } // namespace content diff --git a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h index 55f3d7f..42fb4c7 100644 --- a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h +++ b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.h @@ -77,6 +77,10 @@ class WebContentsDelegateEfl : public WebContentsDelegate { #if BUILDFLAG(IS_TIZEN_TV) //Browser edge scroll void DidEdgeScrollBy(const gfx::Point& offset, bool handled) override; + void NotifyDownloadableFontInfo(const std::string& scheme_id_uri, + const std::string& value, + const std::string& data, + int type) override; #endif void RequestCertificateConfirm( WebContents* web_contents, -- 2.7.4