From 26684ecfbc9b1a83b3a24f76060348abe35eb00f Mon Sep 17 00:00:00 2001 From: v-saha Date: Tue, 31 Jan 2023 20:01:59 +0530 Subject: [PATCH] [M108 Migration] Move codes that handle EWK IPC messages from render frame IPC messages for EWK are currently handled in WebViewBrowserMessageFilter for both render view host messages and render frame host messages. But render frame host messages come from specific render frame, so they should be handled on specific render frame host. WebContentsObserver provides OnMessageReceived function for that. So, this patch moves codes which handle IPC messages for EWk from render frame into WebContentsObserverEfl which is drived from WebContentsObserver. Reference: https://review.tizen.org/gerrit/278453 Change-Id: I13648a043e3931472fbb27f710472b05b9d16e55 Signed-off-by: v-saha --- .../browser/web_view_browser_message_filter.cc | 39 ---------------------- .../efl_integration/web_contents_observer_efl.cc | 37 ++++++++++++++++++++ .../efl_integration/web_contents_observer_efl.h | 8 +++++ 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc b/tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc index 7850c2e..11c52d6 100644 --- a/tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc +++ b/tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc @@ -119,21 +119,6 @@ class WebViewBrowserMessageFilterPrivate web_view_->OnMHTMLContentGet(mhtml_content, callback_id); } - void OnDidChangeMaxScrollOffset(int maxScrollX, int maxScrollY) { - if (web_view_) - web_view_->GetScrollDetector()->SetMaxScroll(maxScrollX, maxScrollY); - } - - void OnDidChangeScrollOffset(int scrollX, int scrollY) { - if (web_view_) - web_view_->GetScrollDetector()->OnChangeScrollOffset(gfx::Vector2d(scrollX, scrollY)); - } - - void OnFormSubmit(const GURL&url) { - if (web_view_) - web_view_->SmartCallback().call(url.GetContent().c_str()); - } - void OnStartContentIntent(const GURL& content_url, bool is_main_frame) { // [M48_2564] Need to apply the new is_main_frame argument in this function // FIXME: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=15388 @@ -141,19 +126,6 @@ class WebViewBrowserMessageFilterPrivate web_view_->ShowContentsDetectedPopup(content_url.spec().c_str()); } - void OnRequestSelectCollectionInformationUpdateACK( - int formElementCount, int currentNodeIndex, - bool prevState, bool nextState) { - if (web_view_) - web_view_->UpdateFormNavigation(formElementCount, - currentNodeIndex, prevState, nextState); - } - - void OnDidNotAllowScript() { - if (web_view_) - web_view_->SmartCallback().call(); - } - void Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) override { #if !defined(EWK_BRINGUP) // FIXME: m94 bringup @@ -214,21 +186,10 @@ bool WebViewBrowserMessageFilter::OnMessageReceived( WebViewBrowserMessageFilterPrivate::OnSelectionTextStyleState) IPC_MESSAGE_FORWARD(EwkHostMsg_ReadMHTMLData, private_, WebViewBrowserMessageFilterPrivate::OnMHTMLContentGet) - IPC_MESSAGE_FORWARD(EwkHostMsg_DidChangeMaxScrollOffset, private_, - WebViewBrowserMessageFilterPrivate::OnDidChangeMaxScrollOffset) - IPC_MESSAGE_FORWARD(EwkHostMsg_DidChangeScrollOffset, private_, - WebViewBrowserMessageFilterPrivate::OnDidChangeScrollOffset) - IPC_MESSAGE_FORWARD(EwkHostMsg_FormSubmit, private_, - WebViewBrowserMessageFilterPrivate::OnFormSubmit) #if !defined(EWK_BRINGUP) // FIXME: m67 bringup IPC_MESSAGE_FORWARD(ViewHostMsg_StartContentIntent, private_, WebViewBrowserMessageFilterPrivate::OnStartContentIntent) #endif - IPC_MESSAGE_FORWARD(EwkHostMsg_RequestSelectCollectionInformationUpdateACK, - private_, WebViewBrowserMessageFilterPrivate::OnRequestSelectCollectionInformationUpdateACK) - IPC_MESSAGE_FORWARD(EwkHostMsg_DidNotAllowScript, private_, - WebViewBrowserMessageFilterPrivate::OnDidNotAllowScript) - IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; diff --git a/tizen_src/ewk/efl_integration/web_contents_observer_efl.cc b/tizen_src/ewk/efl_integration/web_contents_observer_efl.cc index d9d6374..338bd14 100644 --- a/tizen_src/ewk/efl_integration/web_contents_observer_efl.cc +++ b/tizen_src/ewk/efl_integration/web_contents_observer_efl.cc @@ -221,6 +221,14 @@ bool WebContentsObserverEfl::OnMessageReceived( RenderFrameHost* render_frame_host) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebContentsObserverEfl, message) + IPC_MESSAGE_HANDLER(EwkHostMsg_RequestSelectCollectionInformationUpdateACK, + OnRequestSelectCollectionInformationUpdateACK) + IPC_MESSAGE_HANDLER(EwkHostMsg_DidChangeMaxScrollOffset, + OnDidChangeMaxScrollOffset) + IPC_MESSAGE_HANDLER(EwkHostMsg_DidChangeScrollOffset, + OnDidChangeScrollOffset) + IPC_MESSAGE_HANDLER(EwkHostMsg_FormSubmit, OnFormSubmit) + IPC_MESSAGE_HANDLER(EwkHostMsg_DidNotAllowScript, OnDidNotAllowScript) IPC_MESSAGE_HANDLER(EwkHostMsg_DidCreateDocumentElement, OnDidCreateDocumentElement) IPC_MESSAGE_HANDLER(EwkHostMsg_DidPrintPagesToPdf, @@ -301,6 +309,35 @@ void WebContentsObserverEfl::OnWrtPluginSyncMessage( Send(reply); } +void WebContentsObserverEfl::OnRequestSelectCollectionInformationUpdateACK( + int form_element_count, + int current_node_index, + bool prev_state, + bool next_state) { + web_view_->UpdateFormNavigation(form_element_count, current_node_index, + prev_state, next_state); +} + +void WebContentsObserverEfl::OnDidChangeMaxScrollOffset(int max_scroll_x, + int max_scroll_y) { + web_view_->GetScrollDetector()->SetMaxScroll(max_scroll_x, max_scroll_y); +} + +void WebContentsObserverEfl::OnDidChangeScrollOffset(int scroll_x, + int scroll_y) { + web_view_->GetScrollDetector()->OnChangeScrollOffset( + gfx::Vector2d(scroll_x, scroll_y)); +} + +void WebContentsObserverEfl::OnFormSubmit(const GURL& url) { + web_view_->SmartCallback().call( + url.GetContent().c_str()); +} + +void WebContentsObserverEfl::OnDidNotAllowScript() { + web_view_->SmartCallback().call(); +} + void WebContentsObserverEfl::OnDidChangeContentsSize(int width, int height) { web_view_->DidChangeContentsSize(width, height); } diff --git a/tizen_src/ewk/efl_integration/web_contents_observer_efl.h b/tizen_src/ewk/efl_integration/web_contents_observer_efl.h index 95480e0..ac7cb56 100644 --- a/tizen_src/ewk/efl_integration/web_contents_observer_efl.h +++ b/tizen_src/ewk/efl_integration/web_contents_observer_efl.h @@ -68,6 +68,14 @@ class WebContentsObserverEfl : public WebContentsObserver, public IPC::Sender { // IPC message handlers: void OnDidCreateDocumentElement(); void OnPrintedMetafileReceived(const DidPrintPagesParams& params); + void OnRequestSelectCollectionInformationUpdateACK(int form_element_count, + int current_node_index, + bool prev_state, + bool nest_state); + void OnDidChangeMaxScrollOffset(int max_scroll_x, int max_scroll_y); + void OnDidChangeScrollOffset(int scroll_x, int scroll_y); + void OnFormSubmit(const GURL& url); + void OnDidNotAllowScript(); void OnWrtPluginMessage(const Ewk_Wrt_Message_Data& data); void OnWrtPluginSyncMessage(const Ewk_Wrt_Message_Data& data, IPC::Message* reply); -- 2.7.4