[M120 Migration] Add new interface to forward message from mmplayer to hbbtv 36/308436/2
authorzhishun.zhou <zhishun.zhou@samsung.com>
Mon, 25 Mar 2024 12:24:07 +0000 (20:24 +0800)
committerBot Blink <blinkbot@samsung.com>
Tue, 26 Mar 2024 05:02:37 +0000 (05:02 +0000)
Support EWK notify interface:
  DECLARE_EWK_VIEW_CALLBACK(EVENTData, "update,event,data", void*);

Patch from:
https://review.tizen.org/gerrit/#/c/294840/

Change-Id: I7359fd40029e1788fcca0a1c6aaccf0602744d12
Signed-off-by: yangzhiwen <zw714.yang@samsung.com>
Signed-off-by: zhishun.zhou <zhishun.zhou@samsung.com>
content/public/browser/web_contents_delegate.h
tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.cc
tizen_src/chromium_impl/content/browser/media/tizen_renderer_impl.h
tizen_src/chromium_impl/media/filters/media_player_bridge_capi_tv.cc
tizen_src/chromium_impl/media/filters/media_player_tizen.h
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/eweb_view_callbacks.h
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.h

index c561d38..d2d66ab 100644 (file)
@@ -748,6 +748,7 @@ class CONTENT_EXPORT WebContentsDelegate {
                                        uint32_t previous,
                                        uint32_t current) {}
   virtual bool IsHighBitRate() const { return false; }
+  virtual void UpdateEventData(void* data) {}
   virtual void NotifyParentalRatingInfo(const std::string& info,
                                         const std::string& url) {}
   virtual void NotifyDownloadableFontInfo(const std::string& scheme_id_uri,
index 835c40b..a09bc9f 100644 (file)
@@ -414,6 +414,19 @@ void TizenRendererImpl::SetPreferTextLanguage(const std::string& lang) {
   }
   media_player_->SetPreferTextLanguage(lang);
 }
+
+void TizenRendererImpl::UpdateEventData(std::string data) {
+  content::WebContentsDelegate* web_contents_delegate =
+      GetWebContentsDelegate();
+  if (!web_contents_delegate) {
+    LOG_ID(ERROR, player_id_) << "web_contents_delegate is null";
+    return;
+  }
+
+  web_contents_delegate->UpdateEventData(
+      static_cast<void*>(const_cast<char*>(data.c_str())));
+}
+
 content::WebContentsDelegate* TizenRendererImpl::GetWebContentsDelegate()
     const {
   content::WebContents* web_contents = GetWebContents();
index bf9f6ad..8208990 100644 (file)
@@ -188,6 +188,7 @@ class CONTENT_EXPORT TizenRendererImpl
   void SetActiveAudioTrack(int index) override;
   void SetActiveVideoTrack(int index) override;
   void SetPreferTextLanguage(const std::string& lang) override;
+  void UpdateEventData(std::string data);
 #endif
   content::WebContents* GetWebContents() const;
 
index 44e3845..9173530 100644 (file)
@@ -1207,7 +1207,7 @@ void MediaPlayerBridgeCapiTV::OnOtherEvent(int event_type, void* event_data) {
         LOG_ID(INFO, player_id_) << "not supported scheme id uri,uri:" << uri;
         return;
       }
-#if !defined(EWK_BRINGUP)
+
       if (!uri.compare("urn:dvb:css")) {
         LOG_ID(INFO, player_id_) << "event->value:" << eventstream->value
                                  << " evalue " << value.c_str();
@@ -1216,7 +1216,7 @@ void MediaPlayerBridgeCapiTV::OnOtherEvent(int event_type, void* event_data) {
                                       weak_factory_.GetWeakPtr(), value));
         return;
       }
-#endif
+
       const std::string info = uri + " " + value;
       task_runner_->PostTask(
           FROM_HERE,
index 10a5f22..d24ffc6 100644 (file)
@@ -115,6 +115,7 @@ class MEDIA_EXPORT MediaPlayerTizen {
   virtual void SetActiveAudioTrack(int index) {}
   virtual void SetActiveVideoTrack(int index) {}
   virtual void SetPreferTextLanguage(const std::string& lang) {}
+  virtual void UpdateEventData(std::string data) {}
 };
 }  // namespace media
 
index 22539f1..ab7fac0 100644 (file)
@@ -3443,6 +3443,11 @@ void EWebView::UpdateCurrentTime(double current_time) {
   current_time_ = current_time;
 }
 
+void EWebView::UpdateEventData(void* data) {
+  LOG(INFO) << "EWebView::UpdateEventData data:" << (char*)data;
+  SmartCallback<EWebViewCallbacks::EVENTData>().call(data);
+}
+
 void EWebView::NotifyParentalRatingInfo(const char* info, const char* url) {
   LOG(INFO) << "info:" << info << ",url:" << url;
   Ewk_Media_Parental_Rating_Info* data =
index f6bf763..6d7f069 100644 (file)
@@ -820,6 +820,7 @@ class EWebView {
                           const std::string& data,
                           unsigned int size);
   void UpdateCurrentTime(double current_time);
+  void UpdateEventData(void* data);
   double GetCurrentTime() { return current_time_; }
   void GetMediaDeviceList(Ewk_Media_Device_List_Get_Callback callback,
                           void* userData);
index 0128cf1..895d47e 100644 (file)
@@ -138,6 +138,7 @@ enum CallbackType {
   SubtitleNotifyData,
   FirstTimestamp,
   PESData,
+  EVENTData,
 #endif
   OverscrolledLeft,
   OverscrolledRight,
@@ -329,6 +330,7 @@ DECLARE_EWK_VIEW_CALLBACK(SubtitleSeekComplete,
 DECLARE_EWK_VIEW_CALLBACK(SubtitleNotifyData, "on,subtitle,data", void*);
 DECLARE_EWK_VIEW_CALLBACK(FirstTimestamp, "on,dvb,subtitle,timestamp", void*);
 DECLARE_EWK_VIEW_CALLBACK(PESData, "on,dvb,subtitle,data", void*);
+DECLARE_EWK_VIEW_CALLBACK(EVENTData, "update,event,data", void*);
 #endif
 DECLARE_EWK_VIEW_CALLBACK(OverscrolledLeft, "overscrolled,left", void);
 DECLARE_EWK_VIEW_CALLBACK(OverscrolledRight, "overscrolled,right", void);
index 1357ccc..83ecaec 100644 (file)
@@ -774,6 +774,10 @@ void WebContentsDelegateEfl::UpdateCurrentTime(double current_time) {
   web_view_->UpdateCurrentTime(current_time);
 }
 
+void WebContentsDelegateEfl::UpdateEventData(void* data) {
+  web_view_->UpdateEventData(data);
+}
+
 void WebContentsDelegateEfl::NotifySubtitleState(int state, double time_stamp) {
   web_view_->NotifySubtitleState(state, time_stamp);
 }
index a4955c8..68edad2 100644 (file)
@@ -162,6 +162,7 @@ class WebContentsDelegateEfl : public WebContentsDelegate {
                      unsigned int len,
                      int media_position) override;
   void UpdateCurrentTime(double current_time) override;
+  void UpdateEventData(void* data) override;
   void NotifySubtitleState(int state, double time_stamp) override;
   void NotifySubtitlePlay(int active_track_id,
                           const std::string& url,