[M108 Migration][SAM] Migrate SAM score improvement patches 59/287359/2
authorGajendra N <gajendra.n@samsung.com>
Fri, 27 Jan 2023 06:23:38 +0000 (11:53 +0530)
committerGajendra N <gajendra.n@samsung.com>
Mon, 30 Jan 2023 06:12:26 +0000 (11:42 +0530)
Improves MCD Score from 2.08 to 3.33.
Reduces LOC for WebContentsDelegateEfl by ~280 lines.
Reduces LOC for ContentBrowserClientEfl by ~85 lines.

References:
https://review.tizen.org/gerrit/275891
https://review.tizen.org/gerrit/275576
https://review.tizen.org/gerrit/275660
https://review.tizen.org/gerrit/276084

Change-Id: Ic034b902c7ccf9d74c100641aadbf604763c5f95
Signed-off-by: Gajendra N <gajendra.n@samsung.com>
22 files changed:
tizen_src/ewk/efl_integration/BUILD.gn
tizen_src/ewk/efl_integration/browser/autofill_popup_view_efl.cc [moved from tizen_src/ewk/efl_integration/autofill_popup_view_efl.cc with 100% similarity]
tizen_src/ewk/efl_integration/browser/autofill_popup_view_efl.h [moved from tizen_src/ewk/efl_integration/autofill_popup_view_efl.h with 100% similarity]
tizen_src/ewk/efl_integration/browser/notification/notification_controller_efl.cc
tizen_src/ewk/efl_integration/browser/policy_response_delegate_efl.cc
tizen_src/ewk/efl_integration/browser/web_view_browser_message_filter.cc
tizen_src/ewk/efl_integration/browser_context_efl.h
tizen_src/ewk/efl_integration/content_browser_client_efl.cc
tizen_src/ewk/efl_integration/content_browser_client_efl.h
tizen_src/ewk/efl_integration/context_menu_controller_efl.cc
tizen_src/ewk/efl_integration/download_manager_delegate_efl.cc [moved from tizen_src/ewk/efl_integration/browser/download_manager_delegate_efl.cc with 98% similarity]
tizen_src/ewk/efl_integration/download_manager_delegate_efl.h [moved from tizen_src/ewk/efl_integration/browser/download_manager_delegate_efl.h with 100% similarity]
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/login_delegate_efl.cc [moved from tizen_src/ewk/efl_integration/browser/login_delegate_efl.cc with 100% similarity]
tizen_src/ewk/efl_integration/login_delegate_efl.h [moved from tizen_src/ewk/efl_integration/browser/login_delegate_efl.h with 100% similarity]
tizen_src/ewk/efl_integration/private/ewk_auth_challenge_private.h
tizen_src/ewk/efl_integration/private/ewk_context_form_autofill_profile_private.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.h
tizen_src/ewk/efl_integration/web_contents_observer_efl.cc [new file with mode: 0644]
tizen_src/ewk/efl_integration/web_contents_observer_efl.h [new file with mode: 0644]

index bfbb46a..feee814 100755 (executable)
@@ -185,21 +185,17 @@ shared_library("chromium-ewk") {
   sources = [
     "authentication_challenge_popup.cc",
     "authentication_challenge_popup.h",
-    "autofill_popup_view_efl.cc",
-    "autofill_popup_view_efl.h",
+    "browser/autofill_popup_view_efl.cc",
+    "browser/autofill_popup_view_efl.h",
     "browser/background_sync_controller_efl.cc",
     "browser/background_sync_controller_efl.h",
     "browser/browsing_data_remover_efl.cc",
     "browser/browsing_data_remover_efl.h",
-    "browser/download_manager_delegate_efl.cc",
-    "browser/download_manager_delegate_efl.h",
     "browser/intercept_request_params.h",
     "browser/javascript_dialog_manager_efl.cc",
     "browser/javascript_dialog_manager_efl.h",
     "browser/javascript_modal_dialog_efl.cc",
     "browser/javascript_modal_dialog_efl.h",
-    "browser/login_delegate_efl.cc",
-    "browser/login_delegate_efl.h",
     "browser/mime_override_manager_efl.cc",
     "browser/mime_override_manager_efl.h",
     "browser/navigation_policy_handler_efl.cc",
@@ -245,6 +241,8 @@ shared_library("chromium-ewk") {
     "devtools_delegate_efl.h",
     "devtools_manager_delegate_efl.cc",
     "devtools_manager_delegate_efl.h",
+    "download_manager_delegate_efl.cc",
+    "download_manager_delegate_efl.h",
     "efl_webprocess_main.cc",
     "efl_webprocess_main.h",
     "eweb_context.cc",
@@ -260,6 +258,8 @@ shared_library("chromium-ewk") {
     "http_user_agent_settings_efl.h",
     "locale_efl.cc",
     "locale_efl.h",
+    "login_delegate_efl.cc",
+    "login_delegate_efl.h",
     "network_delegate_efl.cc",
     "network_delegate_efl.h",
     "notification_permission_popup.cc",
@@ -578,6 +578,8 @@ shared_library("chromium-ewk") {
     "renderer/render_thread_observer_efl.h",
     "renderer/tizen_extensible.cc",
     "renderer/tizen_extensible.h",
+    "web_contents_observer_efl.cc",
+    "web_contents_observer_efl.h",
     "wrt/dynamicplugin.cc",
     "wrt/dynamicplugin.h",
     "wrt/v8widget.cc",
index fedc587..f88b03c 100644 (file)
@@ -11,6 +11,7 @@
 #include "base/logging.h"
 #include "base/path_service.h"
 #include "base/strings/utf_string_conversions.h"
+#include "browser_context_efl.h"
 #include "common/web_contents_utils.h"
 #include "content/common/paths_efl.h"
 #include "content/public/browser/browser_thread.h"
index 0378c0d..bf8ea0f 100644 (file)
@@ -10,6 +10,7 @@
 #include "browser/mime_override_manager_efl.h"
 #include "browser/network_service/browser_url_loader_throttle_efl.h"
 #include "browser/policy_response_params.h"
+#include "browser_context_efl.h"
 #include "common/web_contents_utils.h"
 #include "content/public/browser/render_frame_host.h"
 #include "eweb_view.h"
@@ -17,7 +18,7 @@
 #include "private/ewk_policy_decision_private.h"
 #include "services/network/public/cpp/data_element.h"
 #include "services/network/public/cpp/features.h"
-#include "services/network/public/mojom/url_response_head.mojom-forward.h"
+#include "services/network/public/mojom/url_response_head.mojom.h"
 
 using web_contents_utils::WebViewFromWebContents;
 
index 3dc018f..7850c2e 100644 (file)
@@ -14,6 +14,7 @@
 #include "content/public/browser/notification_registrar.h"
 #include "content/public/browser/notification_source.h"
 #include "content/public/browser/notification_types.h"
+#include "content/public/browser/render_view_host.h"
 #include "content/public/browser/web_contents.h"
 #include "eweb_view.h"
 #include "ipc_message_start_ewk.h"
index 1f88ac0..bef9a1e 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "base/files/scoped_temp_dir.h"
 #include "base/synchronization/lock.h"
-#include "browser/download_manager_delegate_efl.h"
 #include "browser/geolocation/geolocation_permission_context_efl.h"
 #include "browser/ssl_host_state_delegate_efl.h"
 #include "components/visitedlink/browser/visitedlink_delegate.h"
@@ -17,6 +16,7 @@
 #include "content/public/browser/content_browser_client.h"
 #include "content/public/browser/resource_context.h"
 #include "content/public/browser/storage_partition.h"
+#include "download_manager_delegate_efl.h"
 #include "url_request_context_getter_efl.h"
 
 class CookieManager;
index 23882ee..837b144 100644 (file)
@@ -14,6 +14,7 @@
 #include "browser/quota_permission_context_efl.h"
 #include "browser/render_message_filter_efl.h"
 #include "browser/web_view_browser_message_filter.h"
+#include "browser_context_efl.h"
 #include "browser_main_parts_efl.h"
 #include "command_line_efl.h"
 #include "common/content_switches_efl.h"
@@ -23,6 +24,8 @@
 #include "components/error_page/common/localized_error.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/navigation_handle.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/render_view_host.h"
 #include "content/public/browser/render_widget_host.h"
 #include "content/public/browser/render_widget_host_iterator.h"
 #include "content/public/browser/web_contents.h"
@@ -76,43 +79,8 @@ void PlatformLanguageChanged(keynode_t* keynode, void* data) {
 }
 #endif  // BUILDFLAG(IS_TIZEN)
 
-}  // namespace
-
-ContentBrowserClientEfl::ContentBrowserClientEfl()
-    : browser_main_parts_efl_(nullptr),
-      notification_controller_(new NotificationControllerEfl),
-      accept_langs_(kDefaultAcceptLanguages) {
-#if BUILDFLAG(IS_TIZEN)
-  PlatformLanguageChanged(nullptr, this);
-  vconf_notify_key_changed(VCONFKEY_LANGSET, PlatformLanguageChanged, this);
-#endif
-}
-
-ContentBrowserClientEfl::~ContentBrowserClientEfl() {
-#if BUILDFLAG(IS_TIZEN)
-  vconf_ignore_key_changed(VCONFKEY_LANGSET, PlatformLanguageChanged);
-#endif
-}
-
-void ContentBrowserClientEfl::SetBrowserContext(BrowserContext* context) {
-  browser_context_.reset(context);
-}
-
-void ContentBrowserClientEfl::CleanUpBrowserContext() {
-  browser_context_.reset(nullptr);
-  shutting_down_ = true;
-}
-
-std::unique_ptr<BrowserMainParts>
-ContentBrowserClientEfl::CreateBrowserMainParts(bool is_integration_test) {
-  auto browser_main_parts = std::make_unique<BrowserMainPartsEfl>();
-  browser_main_parts_efl_ = browser_main_parts.get();
-  return browser_main_parts;
-}
-
-void ContentBrowserClientEfl::AppendExtraCommandLineSwitchesInternal(
-    base::CommandLine* command_line,
-    int child_process_id) {
+void AppendExtraCommandLineSwitchesInternal(base::CommandLine* command_line,
+                                            int child_process_id) {
   if (!command_line->HasSwitch(switches::kProcessType))
     return;
 
@@ -159,6 +127,129 @@ void ContentBrowserClientEfl::AppendExtraCommandLineSwitchesInternal(
                                   widget_encoded_bundle);
 }
 
+void DispatchPopupBlockedOnUIThread(int render_process_id,
+                                    const GURL& target_url) {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+  std::unique_ptr<RenderWidgetHostIterator> widgets(
+      RenderWidgetHost::GetRenderWidgetHosts());
+  RenderWidgetHost* widget = NULL;
+
+  while ((widget = widgets->GetNextHost()))
+    if (widget->GetProcess()->GetID() == render_process_id)
+      break;
+
+  // It may happen that this message will be handled on ui thread after view
+  // was closed. In such case ignore do nothing.
+  if (!widget)
+    return;
+  RenderViewHost* vh = RenderViewHost::From(widget);
+  if (!vh)
+    return;
+
+  WebContents* content = WebContents::FromRenderViewHost(vh);
+  if (!content)
+    return;
+
+  EWebView* wv = WebViewFromWebContents(content);
+  wv->SmartCallback<EWebViewCallbacks::PopupBlocked>().call(
+      target_url.spec().c_str());
+}
+
+}  // namespace
+
+AcceptLanguagesHelper::AcceptLanguagesHelper()
+    : accept_langs_(kDefaultAcceptLanguages) {}
+
+AcceptLanguagesHelper::~AcceptLanguagesHelper() {}
+
+std::string AcceptLanguagesHelper::GetAcceptLangs() {
+  if (!preferred_langs_.empty())
+    return preferred_langs_;
+
+  return accept_langs_;
+}
+
+void AcceptLanguagesHelper::SetAcceptLangs(const std::string& accept_langs) {
+  if (accept_langs.empty() || accept_langs_ == accept_langs)
+    return;
+
+  accept_langs_ = accept_langs;
+  if (preferred_langs_.empty())
+    NotifyAcceptLangsChanged();
+}
+
+void AcceptLanguagesHelper::SetPreferredLangs(
+    const std::string& preferred_langs) {
+  if (preferred_langs_ == preferred_langs)
+    return;
+
+  preferred_langs_ = preferred_langs;
+  NotifyAcceptLangsChanged();
+}
+
+void AcceptLanguagesHelper::AddAcceptLangsChangedCallback(
+    AcceptLangsChangedCallback callback) {
+  if (callback)
+    accept_langs_changed_callbacks_.push_back(std::move(callback));
+}
+
+void AcceptLanguagesHelper::RemoveAcceptLangsChangedCallback(
+    AcceptLangsChangedCallback callback) {
+#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
+  for (size_t i = 0; i < accept_langs_changed_callbacks_.size(); ++i) {
+    if (accept_langs_changed_callbacks_[i] == callback) {
+      accept_langs_changed_callbacks_.erase(
+          accept_langs_changed_callbacks_.begin() + i);
+      return;
+    }
+  }
+#endif
+}
+
+void AcceptLanguagesHelper::NotifyAcceptLangsChanged() {
+  std::vector<AcceptLangsChangedCallback> callbacks;
+  callbacks.swap(accept_langs_changed_callbacks_);
+
+  for (auto& callback : callbacks) {
+    if (preferred_langs_.empty())
+      std::move(callback).Run(accept_langs_);
+    else
+      std::move(callback).Run(preferred_langs_);
+  }
+}
+
+ContentBrowserClientEfl::ContentBrowserClientEfl()
+    : notification_controller_(new NotificationControllerEfl),
+      accept_langs_helper_(new AcceptLanguagesHelper) {
+#if BUILDFLAG(IS_TIZEN)
+  PlatformLanguageChanged(nullptr, this);
+  vconf_notify_key_changed(VCONFKEY_LANGSET, PlatformLanguageChanged, this);
+#endif
+}
+
+ContentBrowserClientEfl::~ContentBrowserClientEfl() {
+#if BUILDFLAG(IS_TIZEN)
+  vconf_ignore_key_changed(VCONFKEY_LANGSET, PlatformLanguageChanged);
+#endif
+}
+
+void ContentBrowserClientEfl::SetBrowserContext(BrowserContext* context) {
+  browser_context_.reset(context);
+}
+
+void ContentBrowserClientEfl::CleanUpBrowserContext() {
+  browser_context_.reset(nullptr);
+  shutting_down_ = true;
+}
+
+std::unique_ptr<BrowserMainParts>
+ContentBrowserClientEfl::CreateBrowserMainParts(bool is_integration_test) {
+  auto browser_main_parts = std::make_unique<BrowserMainPartsEfl>();
+  browser_main_parts_efl_ = browser_main_parts.get();
+  return browser_main_parts;
+}
+
 void ContentBrowserClientEfl::AppendExtraCommandLineSwitches(
     base::CommandLine* command_line,
     int child_process_id) {
@@ -192,10 +283,9 @@ bool ContentBrowserClientEfl::CanCreateWindow(
 #if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
   if (!user_gesture) {
     *no_javascript_access = true;
-    BrowserThread::PostTask(
-        BrowserThread::UI, FROM_HERE,
-        base::BindOnce(&ContentBrowserClientEfl::DispatchPopupBlockedOnUIThread,
-                       render_process_id, target_url));
+    BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+                            base::BindOnce(&DispatchPopupBlockedOnUIThread,
+                                           render_process_id, target_url));
     return false;
   }
 #endif
@@ -218,36 +308,6 @@ bool ContentBrowserClientEfl::CanCreateWindow(
   return policy_decision->CanCreateWindow();
 }
 
-void ContentBrowserClientEfl::DispatchPopupBlockedOnUIThread(
-    int render_process_id,
-    const GURL& target_url) {
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-
-  std::unique_ptr<RenderWidgetHostIterator> widgets(
-      RenderWidgetHost::GetRenderWidgetHosts());
-  RenderWidgetHost* widget = NULL;
-
-  while ((widget = widgets->GetNextHost()))
-    if (widget->GetProcess()->GetID() == render_process_id)
-      break;
-
-  // It may happen that this message will be handled on ui thread after view
-  // was closed. In such case ignore do nothing.
-  if (!widget)
-    return;
-  RenderViewHost* vh = RenderViewHost::From(widget);
-  if (!vh)
-    return;
-
-  WebContents* content = WebContents::FromRenderViewHost(vh);
-  if (!content)
-    return;
-
-  EWebView* wv = WebViewFromWebContents(content);
-  wv->SmartCallback<EWebViewCallbacks::PopupBlocked>().call(
-      target_url.spec().c_str());
-}
-
 bool ContentBrowserClientEfl::HasErrorPage(int http_status_code) {
   // Use an internal error page, if we have one for the status code.
   return error_page::LocalizedError::HasStrings(
@@ -287,12 +347,6 @@ void ContentBrowserClientEfl::AllowCertificateError(
 #endif  // !defined(EWK_BRINGUP)
 }
 
-PlatformNotificationService*
-ContentBrowserClientEfl::GetPlatformNotificationService(
-   BrowserContext* browser_context) {
-  return notification_controller_.get();
-}
-
 NotificationControllerEfl* ContentBrowserClientEfl::GetNotificationController()
     const {
   return notification_controller_.get();
@@ -455,61 +509,26 @@ std::string ContentBrowserClientEfl::GetUserAgent() {
 }
 
 std::string ContentBrowserClientEfl::GetAcceptLangs(BrowserContext* context) {
-  if (!preferred_langs_.empty())
-    return preferred_langs_;
-
-  return accept_langs_;
+  return accept_langs_helper_->GetAcceptLangs();
 }
 
 void ContentBrowserClientEfl::SetAcceptLangs(const std::string& accept_langs) {
-  if (accept_langs.empty() || accept_langs_ == accept_langs)
-    return;
-
-  accept_langs_ = accept_langs;
-
-  if (preferred_langs_.empty())
-    NotifyAcceptLangsChanged();
+  accept_langs_helper_->SetAcceptLangs(accept_langs);
 }
 
 void ContentBrowserClientEfl::SetPreferredLangs(
     const std::string& preferred_langs) {
-  if (preferred_langs_ == preferred_langs)
-    return;
-
-  preferred_langs_ = preferred_langs;
-
-  NotifyAcceptLangsChanged();
+  accept_langs_helper_->SetPreferredLangs(preferred_langs);
 }
 
 void ContentBrowserClientEfl::AddAcceptLangsChangedCallback(
-    AcceptLangsChangedCallback callback) {
-  if (callback)
-    accept_langs_changed_callbacks_.push_back(std::move(callback));
+    AcceptLanguagesHelper::AcceptLangsChangedCallback callback) {
+  accept_langs_helper_->AddAcceptLangsChangedCallback(std::move(callback));
 }
 
 void ContentBrowserClientEfl::RemoveAcceptLangsChangedCallback(
-    AcceptLangsChangedCallback callback) {
-#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
-  for (size_t i = 0; i < accept_langs_changed_callbacks_.size(); ++i) {
-    if (accept_langs_changed_callbacks_[i] == callback) {
-      accept_langs_changed_callbacks_.erase(
-          accept_langs_changed_callbacks_.begin() + i);
-      return;
-    }
-  }
-#endif
-}
-
-void ContentBrowserClientEfl::NotifyAcceptLangsChanged() {
-  std::vector<AcceptLangsChangedCallback> callbacks;
-  callbacks.swap(accept_langs_changed_callbacks_);
-
-  for (auto& callback : callbacks) {
-    if (preferred_langs_.empty())
-      std::move(callback).Run(accept_langs_);
-    else
-      std::move(callback).Run(preferred_langs_);
-  }
+    AcceptLanguagesHelper::AcceptLangsChangedCallback callback) {
+  accept_langs_helper_->RemoveAcceptLangsChangedCallback(std::move(callback));
 }
 
 std::unique_ptr<LoginDelegate> ContentBrowserClientEfl::CreateLoginDelegate(
index 7b3f8f1..5ba1b1a 100644 (file)
@@ -21,35 +21,47 @@ namespace content {
 class BrowserMainPartsEfl;
 class NotificationControllerEfl;
 class SharedURLLoaderFactoryEfl;
-
 #if defined(TIZEN_WEB_SPEECH_RECOGNITION)
 class SpeechRecognitionManagerDelegate;
 #endif
-
 class WebContents;
 class WebContentsView;
 
-class ContentBrowserClientEfl : public ContentBrowserClient {
+class AcceptLanguagesHelper {
  public:
-  typedef void (*Notification_Show_Callback)(Ewk_Notification*, void*);
-  typedef void (*Notification_Cancel_Callback)(uint64_t, void*);
+  using AcceptLangsChangedCallback =
+      base::OnceCallback<void(const std::string&)>;
+  AcceptLanguagesHelper();
+  ~AcceptLanguagesHelper();
+
+  void SetAcceptLangs(const std::string& accept_langs);
+  void SetPreferredLangs(const std::string& preferred_langs);
+  std::string GetAcceptLangs();
+  void AddAcceptLangsChangedCallback(AcceptLangsChangedCallback callback);
+  void RemoveAcceptLangsChangedCallback(AcceptLangsChangedCallback callback);
+
+ private:
+  void NotifyAcceptLangsChanged();
 
+  std::string accept_langs_;
+  std::string preferred_langs_;
+  std::vector<AcceptLangsChangedCallback> accept_langs_changed_callbacks_;
+};
+
+class ContentBrowserClientEfl : public ContentBrowserClient {
+ public:
   ContentBrowserClientEfl();
   ~ContentBrowserClientEfl() override;
 
   ContentBrowserClientEfl(const ContentBrowserClientEfl&) = delete;
   ContentBrowserClientEfl& operator=(const ContentBrowserClientEfl&) = delete;
-  typedef base::OnceCallback<void(const std::string&)>
-      AcceptLangsChangedCallback;
 
+  // ContentBrowserClient implementations.
   std::unique_ptr<BrowserMainParts> CreateBrowserMainParts(
       bool is_integration_test) override;
 
-  // Allows the embedder to pass extra command line flags.
-  // switches::kProcessType will already be set at this point.
   void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
                                       int child_process_id) override;
-
   bool CanCreateWindow(RenderFrameHost* opener,
                        const GURL& opener_url,
                        const GURL& opener_top_level_frame_url,
@@ -80,46 +92,29 @@ class ContentBrowserClientEfl : public ContentBrowserClient {
       bool is_main_frame_request,
       bool strict_enforcement,
       base::OnceCallback<void(CertificateRequestResultType)> callback) override;
-
-  PlatformNotificationService* GetPlatformNotificationService(
-      BrowserContext* browser_context);
-
-  NotificationControllerEfl* GetNotificationController() const;
-
   bool AllowGetCookie(const GURL& url,
                       const GURL& first_party,
                       const net::CookieList& cookie_list,
                       ResourceContext* context,
                       int render_process_id,
                       int render_frame_id);
-
   bool AllowSetCookie(const GURL& url,
                       const GURL& first_party,
                       const net::CanonicalCookie& cookie,
                       ResourceContext* context,
                       int render_process_id,
                       int render_frame_id);
-
   void OverrideWebkitPrefs(WebContents* web_contents,
                            blink::web_pref::WebPreferences* prefs);
-
   void RenderProcessWillLaunch(RenderProcessHost* host) override;
-
   void SetCertificatePem(const net::SSLInfo& ssl_info,
                          int render_process_id,
                          int render_view_id);
-
   DevToolsManagerDelegate* GetDevToolsManagerDelegate();
-
   std::string GetApplicationLocale() override;
-
   std::unique_ptr<WebContentsViewDelegate> GetWebContentsViewDelegate(
       WebContents* web_contents) override;
-
-  void SetBrowserContext(BrowserContext* context);
-  void CleanUpBrowserContext();
-
-  virtual std::unique_ptr<LoginDelegate> CreateLoginDelegate(
+  std::unique_ptr<LoginDelegate> CreateLoginDelegate(
       const net::AuthChallengeInfo& auth_info,
       WebContents* web_contents,
       const GlobalRequestID& request_id,
@@ -128,15 +123,17 @@ class ContentBrowserClientEfl : public ContentBrowserClient {
       scoped_refptr<net::HttpResponseHeaders> response_headers,
       bool first_auth_attempt,
       LoginAuthRequiredCallback auth_required_callback) override;
-
   std::string GetProduct() override;
   std::string GetUserAgent() override;
-
-  std::string GetAcceptLangs(BrowserContext* context) override;
+  NotificationControllerEfl* GetNotificationController() const;
+  void SetBrowserContext(BrowserContext* context);
+  void CleanUpBrowserContext();
   void SetAcceptLangs(const std::string& accept_langs);
   void SetPreferredLangs(const std::string& preferred_langs);
-  void AddAcceptLangsChangedCallback(AcceptLangsChangedCallback callback);
-  void RemoveAcceptLangsChangedCallback(AcceptLangsChangedCallback callback);
+  void AddAcceptLangsChangedCallback(
+      AcceptLanguagesHelper::AcceptLangsChangedCallback callback);
+  void RemoveAcceptLangsChangedCallback(
+      AcceptLanguagesHelper::AcceptLangsChangedCallback callback);
   std::vector<std::unique_ptr<NavigationThrottle>> CreateThrottlesForNavigation(
       NavigationHandle* handle) override;
   std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
@@ -146,6 +143,7 @@ class ContentBrowserClientEfl : public ContentBrowserClient {
       const base::RepeatingCallback<content::WebContents*()>& wc_getter,
       content::NavigationUIData* navigation_ui_data,
       int frame_tree_node_id) override;
+  std::string GetAcceptLangs(BrowserContext* context) override;
 
  private:
   bool WillCreateURLLoaderFactory(
@@ -162,33 +160,21 @@ class ContentBrowserClientEfl : public ContentBrowserClient {
       bool* bypass_redirect_checks,
       bool* disable_secure_dns,
       network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
-
   scoped_refptr<network::SharedURLLoaderFactory>
   GetSystemSharedURLLoaderFactory() override;
-
   static void SetCertificatePemOnUIThread(int render_process_id,
                                           int render_view_id,
                                           std::string certificate);
-  static void DispatchPopupBlockedOnUIThread(int render_process_id,
-                                             const GURL& target_url);
-
-  void NotifyAcceptLangsChanged();
-  void AppendExtraCommandLineSwitchesInternal(base::CommandLine* command_line,
-                                              int child_process_id);
-
-  BrowserMainPartsEfl* browser_main_parts_efl_;
-
-  std::unique_ptr<NotificationControllerEfl> notification_controller_;
 
+  BrowserMainPartsEfl* browser_main_parts_efl_ = nullptr;
   std::unique_ptr<content::BrowserContext> browser_context_;
+  std::unique_ptr<NotificationControllerEfl> notification_controller_;
 
   // URLLoaderFactory backed by the NetworkContext returned by GetContext(), so
   // consumers don't all need to create their own factory.
   scoped_refptr<SharedURLLoaderFactoryEfl> shared_url_loader_factory_;
-  std::string accept_langs_;
-  std::string preferred_langs_;
-  std::vector<AcceptLangsChangedCallback> accept_langs_changed_callbacks_;
 
+  std::unique_ptr<AcceptLanguagesHelper> accept_langs_helper_;
   bool shutting_down_ = false;
 };
 }  // namespace content
index ede9214..d44cd99 100644 (file)
 #include "base/files/file_util.h"
 #include "base/path_service.h"
 #include "base/strings/utf_string_conversions.h"
+#include "browser_context_efl.h"
 #include "common/web_contents_utils.h"
 #include "content/browser/selection/selection_controller_efl.h"
 #include "content/common/paths_efl.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/download_manager.h"
 #include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/render_process_host.h"
 #include "context_menu_controller_efl.h"
 #include "eweb_view.h"
 #include "net/base/filename_util.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "private/ewk_context_menu_private.h"
+#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
 #include "ui/base/clipboard/clipboard.h"
 #include "ui/base/clipboard/clipboard_helper_efl.h"
 
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "browser/download_manager_delegate_efl.h"
+#include "download_manager_delegate_efl.h"
 
 #include "base/files/file_path.h"
 #include "base/path_service.h"
index 449ac1b..ead962c 100644 (file)
@@ -14,6 +14,7 @@
 #include "base/logging.h"
 #include "base/pickle.h"
 #include "base/strings/utf_string_conversions.h"
+#include "browser/javascript_dialog_manager_efl.h"
 #include "browser/javascript_interface/gin_native_bridge_dispatcher_host.h"
 #include "browser/navigation_policy_handler_efl.h"
 #include "browser/quota_permission_context_efl.h"
@@ -21,6 +22,7 @@
 #include "browser/selectpicker/popup_menu_item_private.h"
 #include "browser/web_view_browser_message_filter.h"
 #include "browser/web_view_evas_handler.h"
+#include "browser_context_efl.h"
 #include "common/content_client_efl.h"
 #include "common/render_messages_ewk.h"
 #include "common/version_info.h"
index bb7357b..3fd06db 100755 (executable)
@@ -659,7 +659,7 @@ class EWebView {
 
   std::map<int64_t, WebViewAsyncRequestHitTestDataCallback*> hit_test_callback_;
 
-  content::ContentBrowserClientEfl::AcceptLangsChangedCallback
+  content::AcceptLanguagesHelper::AcceptLangsChangedCallback
       accept_langs_changed_callback_;
 
   std::unique_ptr<aura::WindowTreeHost> host_;
index ded617d..c5765e5 100644 (file)
@@ -7,7 +7,7 @@
 
 #include "url/gurl.h"
 #include "net/base/auth.h"
-#include "browser/login_delegate_efl.h"
+#include "login_delegate_efl.h"
 /**
  * @brief  Structure used to send credential for authentication challenge.
  *
index d68fe02..182d00a 100644 (file)
@@ -14,6 +14,7 @@
 #include "base/guid.h"
 #include "base/strings/stringprintf.h"
 #include "browser/autofill/personal_data_manager_factory.h"
+#include "browser_context_efl.h"
 #include "components/autofill/core/browser/personal_data_manager.h"
 #include "eweb_view.h"
 #include "ewk_autofill_profile_private.h"
index 67a2e18..c1d6e59 100644 (file)
@@ -6,28 +6,27 @@
 
 #include "base/strings/utf_string_conversions.h"
 #include "base/trace_event/ttrace.h"
-#include "browser/favicon/favicon_database.h"
 #include "browser/input_picker/color_chooser_efl.h"
 #include "browser/javascript_dialog_manager_efl.h"
 #include "browser/policy_response_delegate_efl.h"
+#include "browser_context_efl.h"
 #include "common/render_messages_ewk.h"
-#include "components/favicon/core/favicon_url.h"
-#include "components/favicon_base/favicon_types.h"
 #include "components/password_manager/core/common/password_manager_pref_names.h"
 #include "components/prefs/pref_service.h"
 #include "content/browser/manifest/manifest_manager_host.h"
+#include "content/browser/web_contents/web_contents_impl.h"
 #include "content/common/content_switches_internal.h"
 #include "content/common/render_messages_efl.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/browser/favicon_status.h"
+#include "content/public/browser/file_select_listener.h"
 #include "content/public/browser/invalidate_type.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/navigation_handle.h"
+#include "content/public/browser/render_view_host.h"
 #include "eweb_view.h"
 #include "eweb_view_callbacks.h"
 #include "net/base/load_states.h"
 #include "net/http/http_response_headers.h"
-#include "printing/metafile_skia.h"
 #include "private/ewk_certificate_private.h"
 #include "private/ewk_console_message_private.h"
 #include "private/ewk_custom_handlers_private.h"
@@ -38,6 +37,7 @@
 #include "third_party/blink/public/common/input/web_input_event.h"
 #include "third_party/blink/public/common/manifest/manifest_util.h"
 #include "url/gurl.h"
+#include "web_contents_observer_efl.h"
 
 #if BUILDFLAG(IS_TIZEN)
 #include <app_control.h>
@@ -68,23 +68,6 @@ using namespace ui;
 
 namespace content {
 
-void WritePdfDataToFile(printing::MetafileSkia* metafile,
-                        const base::FilePath& filename) {
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
-  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
-#endif
-  DCHECK(metafile);
-  base::File file(filename,
-                  base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
-  metafile->SaveTo(&file);
-  file.Close();
-  delete metafile;
-}
-
-static bool IsMainFrame(RenderFrameHost* render_frame_host) {
-  return !render_frame_host->GetParent();
-}
-
 #if BUILDFLAG(IS_TIZEN) && defined(TIZEN_MULTIMEDIA_SUPPORT)
 static const MediaStreamDevice* GetRequestedVideoDevice(
     const std::string& device_id) {
@@ -99,15 +82,9 @@ static const MediaStreamDevice* GetRequestedVideoDevice(
 #endif
 
 WebContentsDelegateEfl::WebContentsDelegateEfl(EWebView* view)
-    : WebContentsObserver(&view->web_contents()),
-      web_view_(view),
-      is_fullscreen_(false),
+    : web_view_(view),
       web_contents_(view->web_contents()),
-      did_render_frame_(false),
-      did_first_visually_non_empty_paint_(false),
-      document_created_(false),
-      dialog_manager_(NULL),
-      weak_ptr_factory_(this) {
+      contents_observer_(std::make_unique<WebContentsObserverEfl>(view, this)) {
 #if defined(TIZEN_AUTOFILL_SUPPORT)
   AutofillClientEfl::CreateForWebContents(&web_contents_);
   AutofillClientEfl* autofill_client =
@@ -198,11 +175,6 @@ void WebContentsDelegateEfl::LoadingStateChanged(WebContents* source,
     web_view_->SmartCallback<EWebViewCallbacks::LoadProgressFinished>().call();
 }
 
-void WebContentsDelegateEfl::LoadProgressChanged(double progress) {
-  web_view_->SetProgressValue(progress);
-  web_view_->SmartCallback<EWebViewCallbacks::LoadProgress>().call(&progress);
-}
-
 void WebContentsDelegateEfl::AddNewContents(
     WebContents* source,
     std::unique_ptr<WebContents> new_contents,
@@ -362,107 +334,6 @@ void WebContentsDelegateEfl::OnAuthRequired(const std::string& realm,
   web_view_->InvokeAuthCallback(login_delegate, url, realm);
 }
 
-void WebContentsDelegateEfl::DidStartNavigation(
-    NavigationHandle* navigation_handle) {
-  if (!navigation_handle->IsInMainFrame())
-    return;
-  web_view_->SmartCallback<EWebViewCallbacks::ProvisionalLoadStarted>().call();
-}
-
-void WebContentsDelegateEfl::DidRedirectNavigation(
-    NavigationHandle* navigation_handle) {
-  if (!navigation_handle->IsInMainFrame())
-    return;
-  web_view_->SmartCallback<EWebViewCallbacks::ProvisionalLoadRedirect>().call();
-}
-
-void WebContentsDelegateEfl::DidFinishNavigation(
-    NavigationHandle* navigation_handle) {
-  if (!navigation_handle->HasCommitted())
-    return;
-
-  if (navigation_handle->IsInMainFrame()) {
-    web_view_->SmartCallback<EWebViewCallbacks::LoadCommitted>().call();
-
-    if (!navigation_handle->IsSameDocument() &&
-        !navigation_handle->IsErrorPage())
-      web_view_->SmartCallback<EWebViewCallbacks::LoadStarted>().call();
-  } else if (!navigation_handle->HasSubframeNavigationEntryCommitted()) {
-    return;
-  }
-
-  if (navigation_handle->ShouldUpdateHistory())
-    static_cast<BrowserContextEfl*>(web_contents_.GetBrowserContext())
-        ->AddVisitedURLs(navigation_handle->GetRedirectChain());
-}
-
-void WebContentsDelegateEfl::DidFinishLoad(RenderFrameHost* render_frame_host,
-                                           const GURL& validated_url) {
-  if (!IsMainFrame(render_frame_host))
-    return;
-  web_view_->SmartCallback<EWebViewCallbacks::LoadFinished>().call();
-
-  web_contents_.Focus();
-}
-
-void WebContentsDelegateEfl::DidFailLoad(RenderFrameHost* render_frame_host,
-                                         const GURL& validated_url,
-                                         int error_code) {
-  if (!IsMainFrame(render_frame_host))
-    return;
-
-  web_view_->InvokeLoadError(validated_url, error_code,
-                             error_code == net::ERR_ABORTED);
-}
-
-void WebContentsDelegateEfl::DidUpdateFaviconURL(
-    RenderFrameHost* render_frame_host,
-    const std::vector<blink::mojom::FaviconURLPtr>& candidates) {
-  // select and set proper favicon
-  for (const auto& favicon : candidates) {
-    if (!favicon->icon_url.is_valid())
-      continue;
-
-    if (favicon->icon_type == blink::mojom::FaviconIconType::kFavicon) {
-      NavigationEntry* entry = web_contents_.GetController().GetVisibleEntry();
-      if (!entry)
-        return;
-      entry->GetFavicon().url = favicon->icon_url;
-      entry->GetFavicon().valid = true;
-
-      // check/update the url and favicon url in favicon database
-      FaviconDatabase::Instance()->SetFaviconURLForPageURL(favicon->icon_url,
-                                                           entry->GetURL());
-
-      // download favicon if there is no such in database
-      if (!FaviconDatabase::Instance()->ExistsForFaviconURL(
-              favicon->icon_url)) {
-        LOG(INFO) << "No favicon in database for URL: "
-                  << favicon->icon_url.spec();
-        favicon_downloader_.reset(new FaviconDownloader(
-            &web_contents_, favicon->icon_url,
-            base::BindOnce(&WebContentsDelegateEfl::DidDownloadFavicon,
-                           weak_ptr_factory_.GetWeakPtr())));
-        favicon_downloader_->Start();
-      } else {
-        web_view_->SmartCallback<EWebViewCallbacks::IconReceived>().call();
-      }
-      return;
-    }
-  }
-}
-
-void WebContentsDelegateEfl::DidDownloadFavicon(bool success,
-                                                const GURL& icon_url,
-                                                const SkBitmap& bitmap) {
-  favicon_downloader_.reset();
-  if (success) {
-    FaviconDatabase::Instance()->SetBitmapForFaviconURL(bitmap, icon_url);
-    // emit "icon,received"
-    web_view_->SmartCallback<EWebViewCallbacks::IconReceived>().call();
-  }
-}
-
 void WebContentsDelegateEfl::RequestCertificateConfirm(
     WebContents* /*web_contents*/,
     int cert_error,
@@ -536,16 +407,7 @@ void WebContentsDelegateEfl::ActivateContents(WebContents* contents) {
 void WebContentsDelegateEfl::SetContentSecurityPolicy(
     const std::string& policy,
     Ewk_CSP_Header_Type header_type) {
-  if (document_created_) {
-#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
-    RenderViewHost* rvh = web_contents_.GetRenderViewHost();
-    rvh->Send(new EwkViewMsg_SetCSP(rvh->GetRoutingID(), policy, header_type));
-#endif
-  } else {
-    DCHECK(!pending_content_security_policy_.get());
-    pending_content_security_policy_.reset(
-        new ContentSecurityPolicy(policy, header_type));
-  }
+  contents_observer_->SetContentSecurityPolicy(policy, header_type);
 }
 
 void WebContentsDelegateEfl::FindReply(WebContents* web_contents,
@@ -596,59 +458,6 @@ void WebContentsDelegateEfl::OnUpdateSettings(const Ewk_Settings* settings) {
 #endif
 }
 
-bool WebContentsDelegateEfl::OnMessageReceived(
-    const IPC::Message& message,
-    RenderFrameHost* render_frame_host) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(WebContentsDelegateEfl, message)
-    IPC_MESSAGE_HANDLER_DELAY_REPLY(EwkHostMsg_GetContentSecurityPolicy,
-                                    OnGetContentSecurityPolicy)
-    IPC_MESSAGE_HANDLER(EwkHostMsg_DidPrintPagesToPdf,
-                        OnPrintedMetafileReceived)
-    IPC_MESSAGE_HANDLER(EwkHostMsg_WrtMessage, OnWrtPluginMessage)
-    IPC_MESSAGE_HANDLER_DELAY_REPLY(EwkHostMsg_WrtSyncMessage,
-                                    OnWrtPluginSyncMessage)
-    IPC_MESSAGE_HANDLER(EwkHostMsg_DidChangeContentsSize,
-                        OnDidChangeContentsSize)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-
-  return handled;
-}
-
-bool WebContentsDelegateEfl::Send(IPC::Message* message) {
-  if (!web_contents_.GetRenderViewHost()) {
-    delete message;
-    return false;
-  }
-#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
-  return web_contents_.GetRenderViewHost()->Send(message);
-#else
-  return false;
-#endif
-}
-
-void WebContentsDelegateEfl::OnWrtPluginMessage(
-    const Ewk_Wrt_Message_Data& data) {
-  std::unique_ptr<Ewk_Wrt_Message_Data> p(new Ewk_Wrt_Message_Data);
-  p->type = data.type;
-  p->value = data.value;
-  p->id = data.id;
-  p->reference_id = data.reference_id;
-
-  web_view_->SmartCallback<EWebViewCallbacks::WrtPluginsMessage>().call(
-      p.get());
-}
-
-void WebContentsDelegateEfl::OnWrtPluginSyncMessage(
-    const Ewk_Wrt_Message_Data& data,
-    IPC::Message* reply) {
-  Ewk_Wrt_Message_Data tmp = data;
-  web_view_->SmartCallback<EWebViewCallbacks::WrtPluginsMessage>().call(&tmp);
-  EwkHostMsg_WrtSyncMessage::WriteReplyParams(reply, tmp.value);
-  Send(reply);
-}
-
 void WebContentsDelegateEfl::DidFirstVisuallyNonEmptyPaint() {
   did_first_visually_non_empty_paint_ = true;
   web_view_->SmartCallback<EWebViewCallbacks::LoadNonEmptyLayoutFinished>()
@@ -659,62 +468,6 @@ void WebContentsDelegateEfl::DidStartLoading() {
   did_render_frame_ = false;
 }
 
-void WebContentsDelegateEfl::OnGetContentSecurityPolicy(
-    IPC::Message* reply_msg) {
-  document_created_ = true;
-  if (!pending_content_security_policy_.get()) {
-    EwkHostMsg_GetContentSecurityPolicy::WriteReplyParams(
-        reply_msg, std::string(), EWK_DEFAULT_POLICY);
-  } else {
-    EwkHostMsg_GetContentSecurityPolicy::WriteReplyParams(
-        reply_msg, pending_content_security_policy_->policy,
-        pending_content_security_policy_->header_type);
-    pending_content_security_policy_.reset();
-  }
-  Send(reply_msg);
-}
-
-void WebContentsDelegateEfl::OnPrintedMetafileReceived(
-    const DidPrintPagesParams& params) {
-#if !defined(EWK_BRINGUP)  // FIXME: m85 bringup
-  base::SharedMemory shared_buf(params.metafile_data_handle, true);
-  if (!shared_buf.Map(params.data_size)) {
-    NOTREACHED() << "couldn't map";
-    return;
-  }
-
-  std::unique_ptr<printing::MetafileSkia> metafile(
-      new printing::MetafileSkia());
-  if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
-    NOTREACHED() << "Invalid metafile header";
-    return;
-  }
-
-  BrowserThread::PostTask(
-      BrowserThread::FILE, FROM_HERE,
-      base::BindOnce(&WritePdfDataToFile, metafile.release(), params.filename));
-#endif
-}
-
-void WebContentsDelegateEfl::NavigationEntryCommitted(
-    const LoadCommittedDetails& load_details) {
-  web_view_->InvokeBackForwardListChangedCallback();
-}
-
-void WebContentsDelegateEfl::RenderViewCreated(
-    RenderViewHost* render_view_host) {
-  web_view_->RenderViewCreated(render_view_host);
-}
-
-void WebContentsDelegateEfl::RenderProcessGone(base::TerminationStatus status) {
-  // See RenderWidgetHostViewEfl::RenderProcessGone.
-  if (status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
-      status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ||
-      status == base::TERMINATION_STATUS_PROCESS_CRASHED) {
-    web_view_->HandleRendererProcessCrash();
-  }
-}
-
 bool WebContentsDelegateEfl::DidAddMessageToConsole(
     WebContents* source,
     blink::mojom::ConsoleMessageLevel level,
@@ -780,11 +533,6 @@ bool WebContentsDelegateEfl::PreHandleGestureEvent(
   return false;
 }
 
-void WebContentsDelegateEfl::TitleWasSet(NavigationEntry* entry) {
-  if (entry)
-    web_view_->GetBackForwardList()->UpdateItemWithEntry(entry);
-}
-
 void WebContentsDelegateEfl::RequestManifestInfo(
     Ewk_View_Request_Manifest_Callback callback,
     void* user_data) {
@@ -814,12 +562,4 @@ void WebContentsDelegateEfl::OnDidGetManifest(
   }
 }
 
-void WebContentsDelegateEfl::OnPageScaleFactorChanged(float page_scale_factor) {
-  web_view_->DidChangePageScaleFactor(page_scale_factor);
-}
-
-void WebContentsDelegateEfl::OnDidChangeContentsSize(int width, int height) {
-  web_view_->DidChangeContentsSize(width, height);
-}
-
 }  // namespace content
index ba107b6..add0161 100644 (file)
@@ -2,39 +2,26 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef WEB_CONTENTS_DELEGATE_EFL
-#define WEB_CONTENTS_DELEGATE_EFL
-
-#include <deque>
-
-#include "browser/favicon/favicon_downloader.h"
-#include "browser/javascript_dialog_manager_efl.h"
-#include "browser_context_efl.h"
-#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/web_contents.h"
+#ifndef WEB_CONTENTS_DELEGATE_EFL_H_
+#define WEB_CONTENTS_DELEGATE_EFL_H_
+
 #include "content/public/browser/web_contents_delegate.h"
-#include "content/public/browser/web_contents_observer.h"
 #include "eweb_view.h"
 #include "private/ewk_manifest_private.h"
 #include "public/ewk_view_internal.h"
 #include "third_party/blink/public/mojom/manifest/manifest.mojom.h"
 #include "ui/base/ime/text_input_type.h"
-#include "url/gurl.h"
 
-class DidPrintPagesParams;
-class Ewk_Wrt_Message_Data;
 class JavaScriptDialogManagerEfl;
 
 namespace content {
 
-class WebContentsDelegateEfl : public WebContentsDelegate,
-                               public WebContentsObserver,
-                               public IPC::Sender {
+class WebContentsObserverEfl;
+
+class WebContentsDelegateEfl : public WebContentsDelegate {
  public:
   WebContentsDelegateEfl(EWebView*);
-  ~WebContentsDelegateEfl() override;
+  ~WebContentsDelegateEfl();
 
   WebContentsDelegateEfl(const WebContentsDelegateEfl&) = delete;
   WebContentsDelegateEfl& operator=(const WebContentsDelegateEfl&) = delete;
@@ -71,22 +58,6 @@ class WebContentsDelegateEfl : public WebContentsDelegate,
   void ExitFullscreenModeForTab(WebContents* web_contents) override;
   bool IsFullscreenForTabOrPending(const WebContents* web_contents) override;
 
-#if defined(TIZEN_MULTIMEDIA_SUPPORT)
-  virtual bool CheckMediaAccessPermission(WebContents* web_contents,
-                                          const GURL& security_origin,
-                                          MediaStreamType type) override;
-
-  virtual void RequestMediaAccessPermission(
-      WebContents* web_contents,
-      const MediaStreamRequest& request,
-      MediaResponseCallback callback) override;
-
-  void RequestMediaAccessAllow(const MediaStreamRequest& request,
-                               MediaResponseCallback callback);
-
-  void RequestMediaAccessDeny(const MediaStreamRequest& request,
-                              MediaResponseCallback callback);
-#endif
   void RegisterProtocolHandler(RenderFrameHost* host,
                                const std::string& protocol,
                                const GURL& url,
@@ -101,9 +72,7 @@ class WebContentsDelegateEfl : public WebContentsDelegate,
                  const gfx::Rect& selection_rect,
                  int active_match_ordinal,
                  bool final_update) override;
-
   void DidRenderFrame() override;
-
   void RequestCertificateConfirm(
       WebContents* web_contents,
       int cert_error,
@@ -115,23 +84,14 @@ class WebContentsDelegateEfl : public WebContentsDelegate,
 
   JavaScriptDialogManager* GetJavaScriptDialogManager(
       WebContents* source) override;
-
   void ActivateContents(WebContents* contents) override;
-
   void OnUpdateSettings(const Ewk_Settings* settings);
   void SetContentSecurityPolicy(const std::string& policy,
                                 Ewk_CSP_Header_Type header_type);
 
-  void DidFirstVisuallyNonEmptyPaint() override;
-  void DidStartLoading() override;
+  void DidFirstVisuallyNonEmptyPaint();
+  void DidStartLoading();
 
-  bool OnMessageReceived(const IPC::Message& message,
-                         RenderFrameHost* render_frame_host) override;
-  void OnPrintedMetafileReceived(const DidPrintPagesParams& params);
-  void NavigationEntryCommitted(
-      const LoadCommittedDetails& load_details) override;
-  void RenderViewCreated(RenderViewHost* render_view_host);
-  void RenderProcessGone(base::TerminationStatus status);
   bool DidAddMessageToConsole(WebContents* source,
                               blink::mojom::ConsoleMessageLevel level,
                               const std::u16string& message,
@@ -143,8 +103,7 @@ class WebContentsDelegateEfl : public WebContentsDelegate,
   std::unique_ptr<ColorChooser> OpenColorChooser(
       WebContents* web_contents,
       SkColor color,
-      const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions)
-      override;
+      const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions);
 #if !defined(EWK_BRINGUP)  // FIXME: m76 bringup
   void OpenDateTimeDialog(ui::TextInputType dialog_type,
                           double dialog_value,
@@ -155,53 +114,31 @@ class WebContentsDelegateEfl : public WebContentsDelegate,
 #endif
   bool PreHandleGestureEvent(WebContents* source,
                              const blink::WebGestureEvent& event) override;
+  EWebView* web_view() const { return web_view_; }
+  WebContents& web_contents() const { return web_contents_; }
 
-  // WebContentsObserver---------------------------------------------------
-  void DidStartNavigation(NavigationHandle* navigation_handle) override;
-
-  void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
-
-  void DidFinishNavigation(NavigationHandle* navigation_handle) override;
-
-  void LoadProgressChanged(double progress) override;
-  void DidFinishLoad(RenderFrameHost* render_frame_host,
-                     const GURL& validated_url) override;
-  void OnPageScaleFactorChanged(float page_scale_factor) override;
-
-  void DidFailLoad(RenderFrameHost* render_frame_host,
-                   const GURL& validated_url,
-                   int error_code) override;
-
-  void DidUpdateFaviconURL(
-      RenderFrameHost* render_frame_host,
-      const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
-
-  void TitleWasSet(content::NavigationEntry* entry) override;
-
+  void RequestManifestInfo(Ewk_View_Request_Manifest_Callback callback,
+                           void* user_data);
   void OnAuthRequired(const std::string& realm,
                       const GURL& url,
                       LoginDelegateEfl* login_delegate);
 
-  // IPC::Sender-----------------------------------------------------------
-  bool Send(IPC::Message* message) override;
-
-  void DidDownloadFavicon(bool success,
-                          const GURL& icon_url,
-                          const SkBitmap& bitmap);
-
-  EWebView* web_view() const { return web_view_; }
-  WebContents& web_contents() const { return web_contents_; }
+#if defined(TIZEN_MULTIMEDIA_SUPPORT)
+  virtual bool CheckMediaAccessPermission(WebContents* web_contents,
+                                          const GURL& security_origin,
+                                          MediaStreamType type) override;
 
-  void RequestManifestInfo(Ewk_View_Request_Manifest_Callback callback,
-                           void* user_data);
+  virtual void RequestMediaAccessPermission(
+      WebContents* web_contents,
+      const MediaStreamRequest& request,
+      MediaResponseCallback callback) override;
+  void RequestMediaAccessAllow(const MediaStreamRequest& request,
+                               MediaResponseCallback callback);
+  void RequestMediaAccessDeny(const MediaStreamRequest& request,
+                              MediaResponseCallback callback);
+#endif
 
  private:
-  void OnGetContentSecurityPolicy(IPC::Message* reply_msg);
-  void OnWrtPluginMessage(const Ewk_Wrt_Message_Data& data);
-  void OnWrtPluginSyncMessage(const Ewk_Wrt_Message_Data& data,
-                              IPC::Message* reply);
-  void OnDidChangeContentsSize(int width, int height);
-
   void OnDidGetManifest(Ewk_View_Request_Manifest_Callback callback,
                         void* user_data,
                         const GURL& manifest_url,
@@ -211,26 +148,18 @@ class WebContentsDelegateEfl : public WebContentsDelegate,
   bool is_fullscreen_;
   WebContents& web_contents_;
 
-  bool did_render_frame_;
-  bool did_first_visually_non_empty_paint_;
-
-  struct ContentSecurityPolicy {
-    ContentSecurityPolicy(const std::string& p, Ewk_CSP_Header_Type type)
-        : policy(p), header_type(type) {}
-    std::string policy;
-    Ewk_CSP_Header_Type header_type;
-  };
+  bool did_render_frame_ = false;
+  bool did_first_visually_non_empty_paint_ = false;
 
+  std::unique_ptr<WebContentsObserverEfl> contents_observer_;
+  void* ime_window_ = nullptr;
   GURL last_visible_url_;
 
-  std::unique_ptr<ContentSecurityPolicy> pending_content_security_policy_;
-  bool document_created_;
   JavaScriptDialogManagerEfl* dialog_manager_ = nullptr;
-  std::unique_ptr<FaviconDownloader> favicon_downloader_;
-  base::WeakPtrFactory<WebContentsDelegateEfl> weak_ptr_factory_;
+  int rotation_ = -1;
   std::unique_ptr<_Ewk_Certificate_Policy_Decision>
       certificate_policy_decision_;
 };
 }
 
-#endif
+#endif  // WEB_CONTENTS_DELEGATE_EFL_H_
diff --git a/tizen_src/ewk/efl_integration/web_contents_observer_efl.cc b/tizen_src/ewk/efl_integration/web_contents_observer_efl.cc
new file mode 100644 (file)
index 0000000..537b761
--- /dev/null
@@ -0,0 +1,318 @@
+// Copyright 2022 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "web_contents_observer_efl.h"
+
+#include "base/task/bind_post_task.h"
+#include "browser/favicon/favicon_database.h"
+#include "browser/favicon/favicon_downloader.h"
+#include "browser_context_efl.h"
+#include "common/print_pages_params.h"
+#include "common/render_messages_ewk.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/browser/favicon_status.h"
+#include "content/public/browser/file_select_listener.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/navigation_handle.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
+#include "eweb_view_callbacks.h"
+#include "ipc/ipc_message_macros.h"
+#include "printing/metafile_skia.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/size.h"
+#include "url/gurl.h"
+
+#if defined(OS_TIZEN_TV_PRODUCT)
+#if !defined(EWK_BRINGUP)
+#include "devtools_port_manager.h"
+#endif
+#include "private/ewk_context_private.h"
+#endif
+
+#if defined(TIZEN_AUTOFILL_SUPPORT)
+#include "browser/autofill/autofill_client_efl.h"
+using autofill::AutofillClientEfl;
+#endif
+
+namespace content {
+
+static bool IsMainFrame(RenderFrameHost* render_frame_host) {
+  return !render_frame_host->GetParent();
+}
+
+WebContentsObserverEfl::WebContentsObserverEfl(EWebView* view,
+                                               WebContentsDelegateEfl* delegate)
+    : WebContentsObserver(&view->web_contents()),
+      web_view_(view),
+      web_contents_(view->web_contents()),
+      web_contents_delegate_(delegate),
+      weak_ptr_factory_(this) {}
+
+WebContentsObserverEfl::~WebContentsObserverEfl() = default;
+
+void WebContentsObserverEfl::SetContentSecurityPolicy(
+    const std::string& policy,
+    Ewk_CSP_Header_Type header_type) {
+  if (document_created_) {
+#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
+    RenderViewHost* rvh = web_contents_.GetRenderViewHost();
+    rvh->Send(new EwkViewMsg_SetCSP(rvh->GetRoutingID(), policy, header_type));
+#endif
+  } else {
+    DCHECK(!pending_content_security_policy_.get());
+    pending_content_security_policy_.reset(
+        new ContentSecurityPolicy(policy, header_type));
+  }
+}
+
+void WebContentsObserverEfl::DidStartNavigation(
+    NavigationHandle* navigation_handle) {
+  if (!navigation_handle->IsInMainFrame())
+    return;
+  web_view_->SmartCallback<EWebViewCallbacks::ProvisionalLoadStarted>().call();
+}
+
+void WebContentsObserverEfl::DidRedirectNavigation(
+    NavigationHandle* navigation_handle) {
+  if (!navigation_handle->IsInMainFrame())
+    return;
+  web_view_->SmartCallback<EWebViewCallbacks::ProvisionalLoadRedirect>().call();
+}
+
+void WebContentsObserverEfl::DidFinishNavigation(
+    NavigationHandle* navigation_handle) {
+  if (!navigation_handle->HasCommitted())
+    return;
+
+  if (navigation_handle->IsInMainFrame()) {
+    web_view_->SmartCallback<EWebViewCallbacks::LoadCommitted>().call();
+
+    if (!navigation_handle->IsSameDocument() &&
+        !navigation_handle->IsErrorPage())
+      web_view_->SmartCallback<EWebViewCallbacks::LoadStarted>().call();
+  } else if (!navigation_handle->HasSubframeNavigationEntryCommitted()) {
+    return;
+  }
+
+  if (navigation_handle->ShouldUpdateHistory())
+    static_cast<BrowserContextEfl*>(web_contents_.GetBrowserContext())
+        ->AddVisitedURLs(navigation_handle->GetRedirectChain());
+}
+
+void WebContentsObserverEfl::LoadProgressChanged(double progress) {
+  web_view_->SetProgressValue(progress);
+  web_view_->SmartCallback<EWebViewCallbacks::LoadProgress>().call(&progress);
+}
+
+void WebContentsObserverEfl::DidFinishLoad(RenderFrameHost* render_frame_host,
+                                           const GURL& validated_url) {
+  if (!IsMainFrame(render_frame_host))
+    return;
+  web_view_->SmartCallback<EWebViewCallbacks::LoadFinished>().call();
+
+  web_contents_.Focus();
+}
+
+void WebContentsObserverEfl::DidFailLoad(RenderFrameHost* render_frame_host,
+                                         const GURL& validated_url,
+                                         int error_code) {
+  if (!IsMainFrame(render_frame_host))
+    return;
+
+  web_view_->InvokeLoadError(validated_url, error_code,
+                             error_code == net::ERR_ABORTED);
+}
+
+void WebContentsObserverEfl::TitleWasSet(NavigationEntry* entry) {
+  if (entry)
+    web_view_->GetBackForwardList()->UpdateItemWithEntry(entry);
+}
+
+void WebContentsObserverEfl::OnPageScaleFactorChanged(float page_scale_factor) {
+  web_view_->DidChangePageScaleFactor(page_scale_factor);
+}
+
+void WebContentsObserverEfl::DidFirstVisuallyNonEmptyPaint() {
+  web_contents_delegate_->DidFirstVisuallyNonEmptyPaint();
+}
+
+void WebContentsObserverEfl::DidStartLoading() {
+  web_contents_delegate_->DidStartLoading();
+}
+
+void WebContentsObserverEfl::NavigationEntryCommitted(
+    const LoadCommittedDetails& load_details) {
+  web_view_->InvokeBackForwardListChangedCallback();
+}
+
+void WebContentsObserverEfl::PrimaryMainFrameRenderProcessGone(
+    base::TerminationStatus status) {
+  if (status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
+      status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ||
+      status == base::TERMINATION_STATUS_PROCESS_CRASHED) {
+    web_view_->HandleRendererProcessCrash();
+  }
+}
+
+void WebContentsObserverEfl::RenderViewCreated(
+    RenderViewHost* render_view_host) {
+  web_view_->RenderViewCreated(render_view_host);
+}
+
+void WebContentsObserverEfl::DidUpdateFaviconURL(
+    RenderFrameHost* render_frame_host,
+    const std::vector<blink::mojom::FaviconURLPtr>& candidates) {
+  // select and set proper favicon
+  for (const auto& favicon : candidates) {
+    if (!favicon->icon_url.is_valid())
+      continue;
+
+    if (favicon->icon_type == blink::mojom::FaviconIconType::kFavicon) {
+      NavigationEntry* entry = web_contents_.GetController().GetVisibleEntry();
+      if (!entry)
+        return;
+      entry->GetFavicon().url = favicon->icon_url;
+      entry->GetFavicon().valid = true;
+
+      // check/update the url and favicon url in favicon database
+      FaviconDatabase::Instance()->SetFaviconURLForPageURL(favicon->icon_url,
+                                                           entry->GetURL());
+
+      // download favicon if there is no such in database
+      if (!FaviconDatabase::Instance()->ExistsForFaviconURL(
+              favicon->icon_url)) {
+        LOG(INFO) << "No favicon in database for URL: "
+                  << favicon->icon_url.spec();
+        favicon_downloader_.reset(new FaviconDownloader(
+            &web_contents_, favicon->icon_url,
+            base::BindOnce(&WebContentsObserverEfl::DidDownloadFavicon,
+                           weak_ptr_factory_.GetWeakPtr())));
+        favicon_downloader_->Start();
+      } else {
+        web_view_->SmartCallback<EWebViewCallbacks::IconReceived>().call();
+      }
+      return;
+    }
+  }
+}
+
+bool WebContentsObserverEfl::OnMessageReceived(
+    const IPC::Message& message,
+    RenderFrameHost* render_frame_host) {
+  bool handled = true;
+  IPC_BEGIN_MESSAGE_MAP(WebContentsObserverEfl, message)
+    IPC_MESSAGE_HANDLER_DELAY_REPLY(EwkHostMsg_GetContentSecurityPolicy,
+                                    OnGetContentSecurityPolicy)
+    IPC_MESSAGE_HANDLER(EwkHostMsg_DidPrintPagesToPdf,
+                        OnPrintedMetafileReceived)
+    IPC_MESSAGE_HANDLER(EwkHostMsg_WrtMessage, OnWrtPluginMessage)
+    IPC_MESSAGE_HANDLER_DELAY_REPLY(EwkHostMsg_WrtSyncMessage,
+                                    OnWrtPluginSyncMessage)
+    IPC_MESSAGE_HANDLER(EwkHostMsg_DidChangeContentsSize,
+                        OnDidChangeContentsSize)
+    IPC_MESSAGE_UNHANDLED(handled = false)
+  IPC_END_MESSAGE_MAP()
+
+  return handled;
+}
+
+bool WebContentsObserverEfl::Send(IPC::Message* message) {
+  if (!web_contents_.GetRenderViewHost()) {
+    delete message;
+    return false;
+  }
+#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
+  return web_contents_.GetRenderViewHost()->Send(message);
+#else
+  return false;
+#endif
+}
+
+void WebContentsObserverEfl::OnGetContentSecurityPolicy(
+    IPC::Message* reply_msg) {
+  document_created_ = true;
+  if (!pending_content_security_policy_.get()) {
+    EwkHostMsg_GetContentSecurityPolicy::WriteReplyParams(
+        reply_msg, std::string(), EWK_DEFAULT_POLICY);
+  } else {
+    EwkHostMsg_GetContentSecurityPolicy::WriteReplyParams(
+        reply_msg, pending_content_security_policy_->policy,
+        pending_content_security_policy_->header_type);
+    pending_content_security_policy_.reset();
+  }
+  Send(reply_msg);
+}
+
+void WebContentsObserverEfl::OnPrintedMetafileReceived(
+    const DidPrintPagesParams& params) {
+#if !defined(EWK_BRINGUP)  // FIXME: m85 bringup
+  base::SharedMemory shared_buf(params.metafile_data_handle, true);
+  if (!shared_buf.Map(params.data_size)) {
+    NOTREACHED() << "couldn't map";
+    return;
+  }
+
+  std::unique_ptr<printing::MetafileSkia> metafile(
+      new printing::MetafileSkia());
+  if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
+    NOTREACHED() << "Invalid metafile header";
+    return;
+  }
+
+  BrowserThread::PostTask(
+      BrowserThread::FILE, FROM_HERE,
+      base::BindOnce(&WritePdfDataToFile, metafile.release(), params.filename));
+#endif
+}
+
+void WebContentsObserverEfl::OnWrtPluginMessage(
+    const Ewk_Wrt_Message_Data& data) {
+  std::unique_ptr<Ewk_Wrt_Message_Data> p(new Ewk_Wrt_Message_Data);
+  p->type = data.type;
+  p->value = data.value;
+  p->id = data.id;
+  p->reference_id = data.reference_id;
+
+  web_view_->SmartCallback<EWebViewCallbacks::WrtPluginsMessage>().call(
+      p.get());
+}
+
+void WebContentsObserverEfl::OnWrtPluginSyncMessage(
+    const Ewk_Wrt_Message_Data& data,
+    IPC::Message* reply) {
+  Ewk_Wrt_Message_Data tmp = data;
+  web_view_->SmartCallback<EWebViewCallbacks::WrtPluginsMessage>().call(&tmp);
+  EwkHostMsg_WrtSyncMessage::WriteReplyParams(reply, tmp.value);
+  Send(reply);
+}
+
+void WebContentsObserverEfl::OnDidChangeContentsSize(int width, int height) {
+  web_view_->DidChangeContentsSize(width, height);
+}
+
+void WebContentsObserverEfl::OnDidChangeFocusedNodeBounds(
+    const gfx::RectF& focused_node_bounds) {
+#if defined(TIZEN_AUTOFILL_SUPPORT)
+  if (AutofillClientEfl* autofill_client =
+          AutofillClientEfl::FromWebContents(&web_contents_)) {
+    autofill_client->DidChangeFocusedNodeBounds(focused_node_bounds);
+  }
+#endif
+}
+
+void WebContentsObserverEfl::DidDownloadFavicon(bool success,
+                                                const GURL& icon_url,
+                                                const SkBitmap& bitmap) {
+  favicon_downloader_.reset();
+  if (success) {
+    FaviconDatabase::Instance()->SetBitmapForFaviconURL(bitmap, icon_url);
+    // emit "icon,received"
+    web_view_->SmartCallback<EWebViewCallbacks::IconReceived>().call();
+  }
+}
+
+}  // namespace content
diff --git a/tizen_src/ewk/efl_integration/web_contents_observer_efl.h b/tizen_src/ewk/efl_integration/web_contents_observer_efl.h
new file mode 100644 (file)
index 0000000..b870fa6
--- /dev/null
@@ -0,0 +1,99 @@
+// Copyright 2022 Samsung Electronics. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEB_CONTENTS_OBSERVER_EFL_H_
+#define WEB_CONTENTS_OBSERVER_EFL_H_
+
+#include <string>
+
+#include "base/memory/weak_ptr.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "eweb_view.h"
+
+class DidPrintPagesParams;
+class Ewk_Wrt_Message_Data;
+class FaviconDownloader;
+class GURL;
+class SkBitmap;
+
+namespace gfx {
+class Rect;
+}
+
+namespace content {
+
+class WebContentsDelegateEfl;
+
+class WebContentsObserverEfl : public WebContentsObserver, public IPC::Sender {
+ public:
+  explicit WebContentsObserverEfl(EWebView* view,
+                                  WebContentsDelegateEfl* delegate);
+  WebContentsObserverEfl(const WebContentsObserverEfl&) = delete;
+  WebContentsObserverEfl& operator=(const WebContentsObserverEfl&) = delete;
+  ~WebContentsObserverEfl() override;
+
+  void SetContentSecurityPolicy(const std::string& policy,
+                                Ewk_CSP_Header_Type header_type);
+
+  // IPC::Sender-----------------------------------------------------------
+  bool Send(IPC::Message* message) override;
+
+ private:
+  // WebContentsObserver overrides:
+  void DidStartNavigation(NavigationHandle* navigation_handle) override;
+  void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
+  void DidFinishNavigation(NavigationHandle* navigation_handle) override;
+  void LoadProgressChanged(double progress) override;
+  void DidFinishLoad(RenderFrameHost* render_frame_host,
+                     const GURL& validated_url) override;
+  void DidFailLoad(RenderFrameHost* render_frame_host,
+                   const GURL& validated_url,
+                   int error_code) override;
+  void TitleWasSet(NavigationEntry* entry) override;
+  void OnPageScaleFactorChanged(float page_scale_factor) override;
+  void DidFirstVisuallyNonEmptyPaint() override;
+  void DidStartLoading() override;
+  void NavigationEntryCommitted(
+      const LoadCommittedDetails& load_details) override;
+  void PrimaryMainFrameRenderProcessGone(
+      base::TerminationStatus status) override;
+  void RenderViewCreated(RenderViewHost* render_view_host);
+  void DidUpdateFaviconURL(
+      RenderFrameHost* render_frame_host,
+      const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
+  bool OnMessageReceived(const IPC::Message& message,
+                         RenderFrameHost* render_frame_host) override;
+
+  // IPC message handlers:
+  void OnGetContentSecurityPolicy(IPC::Message* reply_msg);
+  void OnPrintedMetafileReceived(const DidPrintPagesParams& params);
+  void OnWrtPluginMessage(const Ewk_Wrt_Message_Data& data);
+  void OnWrtPluginSyncMessage(const Ewk_Wrt_Message_Data& data,
+                              IPC::Message* reply);
+  void OnDidChangeContentsSize(int width, int height);
+  void OnDidChangeFocusedNodeBounds(const gfx::RectF& focused_node_bounds);
+
+  void DidDownloadFavicon(bool success,
+                          const GURL& icon_url,
+                          const SkBitmap& bitmap);
+
+  struct ContentSecurityPolicy {
+    ContentSecurityPolicy(const std::string& p, Ewk_CSP_Header_Type type)
+        : policy(p), header_type(type) {}
+    std::string policy;
+    Ewk_CSP_Header_Type header_type;
+  };
+
+  bool document_created_ = false;
+  EWebView* web_view_;
+  WebContents& web_contents_;
+  std::unique_ptr<ContentSecurityPolicy> pending_content_security_policy_;
+  std::unique_ptr<FaviconDownloader> favicon_downloader_;
+  WebContentsDelegateEfl* web_contents_delegate_ = nullptr;
+  base::WeakPtrFactory<WebContentsObserverEfl> weak_ptr_factory_;
+};
+
+}  // namespace content
+
+#endif  // WEB_CONTENTS_OBSERVER_EFL_H_