From a46f4d4540151c912d6469e8e2eb6d3d398f6459 Mon Sep 17 00:00:00 2001 From: "ayush.k123" Date: Wed, 8 Feb 2023 15:08:50 +0530 Subject: [PATCH] [M108 Migration] Remove EWK_BRINGUP from ewk_back_forward_list_private This removes EWK_BRIRNGUP from the file and replaces deprecated notification types with methods in WebContentsObserver as per the reference in [1]. NOTIFICATION_NAV_ENTRY_CHANGED -> WebContentsObserver::NavigationEntryChanged NOTIFICATION_NAV_ENTRY_COMMITTED -> WebContentsObserver::NavigationEntryCommitted [1] https://chromium-review.googlesource.com/630420 Reference: https://review.tizen.org/gerrit/283901/ Change-Id: Ib980ae58958b734d3d1b92984095446e6dfb8f3f Signed-off-by: Ayush Kumar --- tizen_src/ewk/efl_integration/eweb_view.cc | 3 +- .../private/ewk_back_forward_list_private.cc | 47 ++++++---------------- .../private/ewk_back_forward_list_private.h | 18 ++++----- 3 files changed, 21 insertions(+), 47 deletions(-) diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 741dce6..9238206 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -2341,8 +2341,7 @@ void EWebView::InitializeContent() { wc_efl->SetEflDelegate(new WebContentsEflDelegateEwk(this)); wcva()->wcva_helper()->SetEflDelegate(wc_efl->GetEflDelegate()); - back_forward_list_.reset( - new _Ewk_Back_Forward_List(web_contents_->GetController())); + back_forward_list_.reset(new _Ewk_Back_Forward_List(web_contents_.get())); permission_popup_manager_.reset(new PermissionPopupManager(evas_object_)); gin_native_bridge_dispatcher_host_.reset( diff --git a/tizen_src/ewk/efl_integration/private/ewk_back_forward_list_private.cc b/tizen_src/ewk/efl_integration/private/ewk_back_forward_list_private.cc index 5f1bdc4..c2396c3 100644 --- a/tizen_src/ewk/efl_integration/private/ewk_back_forward_list_private.cc +++ b/tizen_src/ewk/efl_integration/private/ewk_back_forward_list_private.cc @@ -4,23 +4,13 @@ #include "ewk_back_forward_list_private.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_types.h" #include "content/public/browser/navigation_details.h" +#include "content/public/browser/web_contents.h" _Ewk_Back_Forward_List::_Ewk_Back_Forward_List( - content::NavigationController& controller) - : navigation_controller_(controller) { -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: Removed in upversion. - notification_registrar_.Add( - this, content::NOTIFICATION_NAV_ENTRY_CHANGED, - content::NotificationService::AllBrowserContextsAndSources()); -#endif - notification_registrar_.Add( - this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, - content::NotificationService::AllBrowserContextsAndSources()); -} + content::WebContents* web_contents) + : content::WebContentsObserver(web_contents), + navigation_controller_(web_contents->GetController()) {} int _Ewk_Back_Forward_List::GetCurrentIndex() const { return navigation_controller_.GetCurrentEntryIndex(); @@ -89,27 +79,14 @@ void _Ewk_Back_Forward_List::ClearCache() { cache_.clear(); } -void _Ewk_Back_Forward_List::Observe( - int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - switch (static_cast(type)) { - case content::NOTIFICATION_NAV_ENTRY_COMMITTED: { - content::Details d = details; - NewPageCommited(d->previous_entry_index, d->entry); - break; - } -#if !defined(EWK_BRINGUP) // FIXME: m67 bringup - // FIXME: Removed in upversion. - case content::NOTIFICATION_NAV_ENTRY_CHANGED: { - content::Details d = details; - const content::NavigationEntry* entry = d->changed_entry; - UpdateItemWithEntry(entry); - break; - } -#endif - default: { return; } - } +void _Ewk_Back_Forward_List::NavigationEntryCommitted( + const content::LoadCommittedDetails& load_details) { + NewPageCommited(load_details.previous_entry_index, load_details.entry); +} + +void _Ewk_Back_Forward_List::NavigationEntryChanged( + const content::EntryChangedDetails& change_details) { + UpdateItemWithEntry(change_details.changed_entry); } _Ewk_Back_Forward_List_Item* _Ewk_Back_Forward_List::FindOrCreateItem( diff --git a/tizen_src/ewk/efl_integration/private/ewk_back_forward_list_private.h b/tizen_src/ewk/efl_integration/private/ewk_back_forward_list_private.h index efb7cab..3c92d05 100644 --- a/tizen_src/ewk/efl_integration/private/ewk_back_forward_list_private.h +++ b/tizen_src/ewk/efl_integration/private/ewk_back_forward_list_private.h @@ -9,8 +9,7 @@ #include "base/strings/utf_string_conversions.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" -#include "content/public/browser/notification_observer.h" -#include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_contents_observer.h" #include "private/back_forward_list.h" #include @@ -44,13 +43,13 @@ class _Ewk_Back_Forward_List_Item }; class _Ewk_Back_Forward_List : public back_forward_list::List, - public content::NotificationObserver { + public content::WebContentsObserver { public: typedef std::map> CacheMap; - _Ewk_Back_Forward_List(content::NavigationController& controller); + explicit _Ewk_Back_Forward_List(content::WebContents* web_contents); ~_Ewk_Back_Forward_List() {} int GetCurrentIndex() const override; @@ -64,19 +63,18 @@ class _Ewk_Back_Forward_List : public back_forward_list::List, void UpdateItemWithEntry(content::NavigationEntry* entry); void ClearCache(); - // FIXME: EWK_BRINGUP: Check the need. - void Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details); + // content::WebContentsObserver implementation + void NavigationEntryCommitted( + const content::LoadCommittedDetails& load_details) override; + void NavigationEntryChanged( + const content::EntryChangedDetails& change_details) override; private: _Ewk_Back_Forward_List_Item* FindOrCreateItem(int index) const; void InsertEntryToIndexes(unsigned index, content::NavigationEntry* entry) const; - private: content::NavigationController& navigation_controller_; - content::NotificationRegistrar notification_registrar_; mutable CacheMap cache_; mutable std::vector indexes_; }; -- 2.7.4