[M120 Migration][hbbtv] Audio tracks count notification
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / web_contents_delegate_efl.cc
index 425fe6b..01f2d66 100644 (file)
@@ -4,50 +4,73 @@
 
 #include "web_contents_delegate_efl.h"
 
+#include <tuple>
+
 #include "base/strings/utf_string_conversions.h"
-#include "browser/favicon/favicon_database.h"
-#include "browser/inputpicker/color_chooser_efl.h"
+#include "base/trace_event/ttrace.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/renderer_host/render_widget_host_view_efl.h"
+#include "content/browser/manifest/manifest_manager_host.h"
+#include "content/browser/renderer_host/render_widget_host_view_aura.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/cert/x509_certificate.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"
 #include "private/ewk_error_private.h"
 #include "private/ewk_policy_decision_private.h"
 #include "private/ewk_user_media_private.h"
 #include "private/webview_delegate_ewk.h"
 #include "third_party/blink/public/common/input/web_input_event.h"
+#include "third_party/blink/public/common/manifest/manifest_util.h"
+#include "tizen/system_info.h"
 #include "url/gurl.h"
+#include "web_contents_observer_efl.h"
+
+#if BUILDFLAG(IS_TIZEN)
+#include <app_control.h>
+#include <app_manager.h>
+#endif
+
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "browser/mixed_content_observer.h"
+#include "devtools_port_manager.h"
+#endif
 
-#if defined(TIZEN_MULTIMEDIA_SUPPORT)
+#if defined(TIZEN_MULTIMEDIA)
+#include "base/functional/callback.h"
 #include "content/public/browser/media_capture_devices.h"
-#include "media/capture/video/tizen/video_capture_device_tizen.h"
+#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
+#endif
+
+#if defined(TIZEN_AUTOFILL_FW)
+#include "browser/autofill/autofill_request_manager.h"
 #endif
 
-#if defined(TIZEN_AUTOFILL_SUPPORT)
+#if defined(TIZEN_AUTOFILL)
+#include "base/command_line.h"
 #include "browser/autofill/autofill_client_efl.h"
-#include "components/autofill/content/browser/content_autofill_driver_factory.h"
 #include "browser/password_manager/password_manager_client_efl.h"
+#include "components/autofill/content/browser/content_autofill_driver_factory.h"
 #include "components/autofill/core/browser/autofill_client.h"
 #include "components/autofill/core/browser/autofill_manager.h"
+#include "components/autofill/core/common/autofill_switches.h"
 #include "components/web_modal/web_contents_modal_dialog_manager.h"
 
 using autofill::AutofillManager;
@@ -60,60 +83,83 @@ 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;
+#if BUILDFLAG(IS_TIZEN) && defined(TIZEN_MULTIMEDIA)
+static const blink::MediaStreamDevice* GetRequestedAudioDevice(
+    const std::string& device_id) {
+  const blink::MediaStreamDevices& audio_devices =
+      MediaCaptureDevices::GetInstance()->GetAudioCaptureDevices();
+  if (audio_devices.empty())
+    return NULL;
+  if (device_id.length() == 0)
+    return &(*audio_devices.begin());
+
+  for (blink::MediaStreamDevices::const_iterator i = audio_devices.begin();
+       i != audio_devices.end(); i++) {
+    if (i->id.compare(device_id) == 0)
+      return &(*i);
+  }
+
+  NOTREACHED();
+  return nullptr;
 }
 
-#if defined(OS_TIZEN) && defined(TIZEN_MULTIMEDIA_SUPPORT)
-static const MediaStreamDevice* GetRequestedVideoDevice(
+/* LCOV_EXCL_START */
+static const blink::MediaStreamDevice* GetRequestedVideoDevice(
     const std::string& device_id) {
-  const MediaStreamDevices& video_devices =
+  const blink::MediaStreamDevices& video_devices =
       MediaCaptureDevices::GetInstance()->GetVideoCaptureDevices();
   if (video_devices.empty())
-    return NULL;
+    return nullptr;
   if (device_id.length() == 0)
     return &(*video_devices.begin());
-  return video_devices.FindById(device_id);
+
+  for (blink::MediaStreamDevices::const_iterator i = video_devices.begin();
+       i != video_devices.end(); i++) {
+    if (i->id.compare(device_id) == 0)
+      return &(*i);
+  }
+
+  NOTREACHED();
+  return nullptr;
 }
+/* LCOV_EXCL_STOP */
 #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) {
-#if defined(TIZEN_AUTOFILL_SUPPORT)
-  AutofillClientEfl::CreateForWebContents(&web_contents_);
-  AutofillClientEfl* autofill_client =
-      AutofillClientEfl::FromWebContents(&web_contents_);
-  autofill_client->SetEWebView(view);
-  PasswordManagerClientEfl::CreateForWebContentsWithAutofillClient(
-      &web_contents_, autofill_client);
-  ContentAutofillDriverFactory::CreateForWebContentsAndDelegate(
-      &web_contents_, autofill_client, EWebView::GetPlatformLocale(),
-      AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER);
+      contents_observer_(std::make_unique<WebContentsObserverEfl>(view, this)) {
+#if BUILDFLAG(IS_TIZEN_TV)
+  MixedContentObserver::CreateForWebContents(&web_contents_);
+#endif
+#if defined(TIZEN_AUTOFILL)
+  if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+          autofill::switches::kDisableAutofill)) {
+    AutofillClientEfl::CreateForWebContents(&web_contents_);
+    AutofillClientEfl* autofill_client =
+        AutofillClientEfl::FromWebContents(&web_contents_);
+    if (autofill_client)
+      autofill_client->SetEWebView(view);
+    PasswordManagerClientEfl::CreateForWebContentsWithAutofillClient(
+        &web_contents_, autofill_client);
+  }
+#if defined(TIZEN_AUTOFILL_FW)
+  LOG(INFO) << "[Autofill] " << __FUNCTION__ << " Create AutofillRequest";
+  autofill::AutofillRequestManager::GetInstance()->CreateAutofillRequest(
+      view->ewk_view());
+#endif
 #endif
 }
 
 WebContentsDelegateEfl::~WebContentsDelegateEfl() {
   // It's important to delete web_contents_ before dialog_manager_
   // destructor of web contents uses dialog_manager_
+  if (dialog_manager_)
+    delete dialog_manager_;
+}
 
-  delete dialog_manager_;
+static bool IsMainFrame(RenderFrameHost* render_frame_host) {
+  return !render_frame_host->GetParent();
 }
 
 WebContents* WebContentsDelegateEfl::OpenURLFromTab(
@@ -134,14 +180,23 @@ WebContents* WebContentsDelegateEfl::OpenURLFromTab(
       disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB ||
       disposition == WindowOpenDisposition::OFF_THE_RECORD) {
     Evas_Object* new_object = NULL;
-    web_view_->SmartCallback<EWebViewCallbacks::CreateNewWindow>().call(
-        &new_object);
+    if (IsMobileProfile() &&
+        disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB) {
+      web_view_->SmartCallback<EWebViewCallbacks::CreateNewBackgroundWindow>()
+          .call(&new_object);
+    } else {
+      web_view_->SmartCallback<EWebViewCallbacks::CreateNewWindow>().call(
+          &new_object);
+    }
 
     if (!new_object)
       return NULL;
 
+    if (disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB)
+      ActivateContents(source);
+
     EWebView* wv =
-        WebViewDelegateEwk::GetInstance().GetWebViewFromEvasObject(new_object);
+        WebViewDelegateEwk::GetInstance().GetEWebViewFromEwkView(new_object);
     DCHECK(wv);
     wv->SetURL(url);
     return NULL;
@@ -153,8 +208,32 @@ WebContents* WebContentsDelegateEfl::OpenURLFromTab(
   return source;
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebContentsDelegateEfl::NotifyMediaStateChanged(uint32_t type,
+                                                     uint32_t previous,
+                                                     uint32_t current) {
+  if (!web_view_) {
+    LOG(ERROR) << "web_view_ is null";
+    return;
+  }
+
+  web_view_->NotifyMediaStateChanged(type, previous, current);
+}
+
+void WebContentsDelegateEfl::GetMediaDeviceList(EnumerationCallback cb) {
+  MediaCaptureDevices::GetInstance()->GetMediaDeviceList(std::move(cb));
+}
+#endif
+
 void WebContentsDelegateEfl::NavigationStateChanged(
     WebContents* source, InvalidateTypes changed_flags) {
+  // We always notfiy clients about title invalidation, even if its text
+  // didn't actually change. This is to maintain EWK API consistency.
+  if (changed_flags & INVALIDATE_TYPE_TITLE) {
+    web_view_->SmartCallback<EWebViewCallbacks::TitleChange>().call(
+        base::UTF16ToUTF8(source->GetTitle()).c_str());
+  }
+
   // We only notify clients if visible url actually changed, because on some
   // pages we would get notifications with flag INVALIDATE_TYPE_URL even when
   // visible url did not change.
@@ -165,36 +244,43 @@ void WebContentsDelegateEfl::NavigationStateChanged(
 
     web_view_->SmartCallback<EWebViewCallbacks::URLChanged>().call(url);
     web_view_->SmartCallback<EWebViewCallbacks::URIChanged>().call(url);
+    web_view_->ResetContextMenuController();
+    auto rwhva = static_cast<RenderWidgetHostViewAura*>(
+        web_contents_.GetRenderWidgetHostView());
+    if (rwhva && rwhva->offscreen_helper()) {
+      if (auto selection_controller =
+              rwhva->offscreen_helper()->GetSelectionController()) {
+        selection_controller->ClearSelection();
+      }
+    }
   }
 }
 
-void WebContentsDelegateEfl::LoadingStateChanged(WebContents* source,
-                                                 bool to_different_document) {
-  if (source->IsLoading())
-    web_view_->SmartCallback<EWebViewCallbacks::LoadProgressStarted>().call();
-  else
-    web_view_->SmartCallback<EWebViewCallbacks::LoadProgressFinished>().call();
-}
-
-void WebContentsDelegateEfl::LoadProgressChanged(double progress) {
-  web_view_->SetProgressValue(progress);
-  web_view_->SmartCallback<EWebViewCallbacks::LoadProgress>().call(&progress);
-}
-
-void WebContentsDelegateEfl::DidStartNavigation(
-    NavigationHandle* navigation_handle) {
-  if (!navigation_handle->IsInMainFrame())
-    return;
-  web_view_->SmartCallback<EWebViewCallbacks::ProvisionalLoadStarted>().call();
+void WebContentsDelegateEfl::AddNewContents(
+    WebContents* source,
+    std::unique_ptr<WebContents> new_contents,
+    const GURL& target_url,
+    WindowOpenDisposition disposition,
+    const blink::mojom::WindowFeatures& window_features,
+    bool user_gesture,
+    bool* was_blocked) {
+  // Initialize the delegate for the new contents here using source's delegate
+  // as it will be needed to create a new window with the pre-created
+  // new contents in case the opener is suppressed. Otherwise, the delegate
+  // had already been initialized in EWebView::InitializeContent()
+  if (!new_contents->GetDelegate())
+    new_contents->SetDelegate(this);
+
+  // EWebView takes the ownership of new WebContents in
+  // EWebView::InitializeContent(). So, we can release the ownership of new
+  // WebContents here.
+  std::ignore = new_contents.release();
 }
 
 bool WebContentsDelegateEfl::ShouldCreateWebContents(
     WebContents* web_contents,
     RenderFrameHost* opener,
     SiteInstance* source_site_instance,
-    int32_t route_id,
-    int32_t main_frame_route_id,
-    int32_t main_frame_widget_route_id,
     mojom::WindowContainerType window_container_type,
     const GURL& opener_url,
     const std::string& frame_name,
@@ -229,71 +315,65 @@ bool WebContentsDelegateEfl::IsFullscreenForTabOrPending(
   return is_fullscreen_;
 }
 
-void WebContentsDelegateEfl::RegisterProtocolHandler(
-    RenderFrameHost* host,
-    const std::string& protocol,
-    const GURL& url,
-    bool user_gesture) {
-  Ewk_Custom_Handlers_Data protocol_data(protocol.c_str(), url.host().c_str(),
-                                         url.spec().c_str());
-  web_view_->SmartCallback<EWebViewCallbacks::RegisterProtocolHandler>().call(
-      &protocol_data);
-}
-
-void WebContentsDelegateEfl::UnregisterProtocolHandler(
-    RenderFrameHost* host,
-    const std::string& protocol,
-    const GURL& url,
-    bool user_gesture) {
-  Ewk_Custom_Handlers_Data protocol_data(protocol.c_str(), url.host().c_str(),
-                                         url.spec().c_str());
-  web_view_->SmartCallback<EWebViewCallbacks::UnregisterProtocolHandler>().call(
-      &protocol_data);
-}
-
-#if defined(TIZEN_MULTIMEDIA_SUPPORT)
+#if defined(TIZEN_MULTIMEDIA)
+/* LCOV_EXCL_START */
 void WebContentsDelegateEfl::RequestMediaAccessAllow(
     const MediaStreamRequest& request,
     MediaResponseCallback callback) {
-  MediaStreamDevices devices;
-
-  if (request.audio_type == MEDIA_DEVICE_AUDIO_CAPTURE) {
-    devices.push_back(
-        MediaStreamDevice(request.audio_type, "default", "Default"));
+  blink::mojom::StreamDevicesSet stream_devices_set;
+  stream_devices_set.stream_devices.emplace_back(
+      blink::mojom::StreamDevices::New());
+  blink::mojom::StreamDevices& stream_devices =
+      *stream_devices_set.stream_devices[0];
+
+  if (request.audio_type ==
+      blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE) {
+    const blink::MediaStreamDevice* audio_device =
+        GetRequestedAudioDevice(request.requested_audio_device_id);
+    if (audio_device) {
+      stream_devices.audio_device = *audio_device;
+    } else {
+      std::move(callback).Run(
+          blink::mojom::StreamDevicesSet(),
+          blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED,
+          std::unique_ptr<MediaStreamUI>());
+      return;
+    }
   }
 
-  if (request.video_type == MEDIA_DEVICE_VIDEO_CAPTURE) {
-#if defined(OS_TIZEN)
-    const MediaStreamDevice* video_device =
+  if (request.video_type ==
+      blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE) {
+    const blink::MediaStreamDevice* video_device =
         GetRequestedVideoDevice(request.requested_video_device_id);
     if (video_device) {
-      devices.push_back(*video_device);
+      stream_devices.video_device = *video_device;
     } else {
-      std::move(callback).Run(MediaStreamDevices(), MEDIA_DEVICE_NOT_SUPPORTED,
-                              std::unique_ptr<MediaStreamUI>());
+      std::move(callback).Run(
+          blink::mojom::StreamDevicesSet(),
+          blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED,
+          std::unique_ptr<MediaStreamUI>());
+      return;
     }
-#else
-    devices.push_back(
-        MediaStreamDevice(request.video_type, "/dev/video0", "1"));
-#endif
   }
 
-  std::move(callback).Run(devices, MEDIA_DEVICE_OK,
+  std::move(callback).Run(stream_devices_set,
+                          blink::mojom::MediaStreamRequestResult::OK,
                           std::unique_ptr<MediaStreamUI>());
 }
+/* LCOV_EXCL_STOP */
 
 void WebContentsDelegateEfl::RequestMediaAccessDeny(
     const MediaStreamRequest& request,
     MediaResponseCallback callback) {
-  LOG(ERROR) << __FUNCTION__ << " Decline request with empty list";
-  std::move(callback).Run(MediaStreamDevices(), MEDIA_DEVICE_NOT_SUPPORTED,
+  std::move(callback).Run(blink::mojom::StreamDevicesSet(),
+                          blink::mojom::MediaStreamRequestResult::NOT_SUPPORTED,
                           std::unique_ptr<MediaStreamUI>());
 }
 
 bool WebContentsDelegateEfl::CheckMediaAccessPermission(
-    WebContents* web_contents,
+    RenderFrameHost* render_frame_host,
     const GURL& security_origin,
-    MediaStreamType type) {
+    blink::mojom::MediaStreamType type) {
   return true;
 }
 
@@ -308,172 +388,178 @@ void WebContentsDelegateEfl::RequestMediaAccessPermission(
   Eina_Bool callback_result = EINA_FALSE;
   if (!web_view_->InvokeViewUserMediaPermissionCallback(
           media_permission_request.get(), &callback_result)) {
-    web_view_->SmartCallback<EWebViewCallbacks::UserMediaPermission>().call(
-        media_permission_request.get());
+    web_view_->SmartCallback<EWebViewCallbacks::UserMediaPermission>()
+        .call(  // LCOV_EXCL_LINE
+            media_permission_request.get());
   }
 
   // if policy is suspended, the API takes over the policy object lifetime
   // and policy will be deleted after decision is made
   if (media_permission_request->IsSuspended())
-    ignore_result(media_permission_request.release());
-  else if (!media_permission_request->IsDecided()) {
-    callback.Run(MediaStreamDevices(), MEDIA_DEVICE_NOT_SUPPORTED,
-                 std::unique_ptr<MediaStreamUI>());
-  }
+    std::ignore = media_permission_request.release();
+  /* LCOV_EXCL_START */
+  else if (!media_permission_request->IsDecided())
+    media_permission_request->ProceedPermissionCallback(false);
+  /* LCOV_EXCL_STOP */
 }
 #endif
 
-void WebContentsDelegateEfl::OnAuthRequired(net::URLRequest* request,
-                                            const std::string& realm,
+void WebContentsDelegateEfl::OnAuthRequired(const std::string& realm,
+                                            const GURL& url,
                                             LoginDelegateEfl* login_delegate) {
-  web_view_->InvokeAuthCallback(login_delegate, request->url(), realm);
+  web_view_->InvokeAuthCallback(login_delegate, url, realm);
 }
 
-void WebContentsDelegateEfl::DidStartProvisionalLoadForFrame(
-    RenderFrameHost* render_frame_host,
-    const GURL& validated_url,
-    bool is_error_page,
-    bool is_iframe_srcdoc) {
-  web_view_->SmartCallback<EWebViewCallbacks::ProvisionalLoadStarted>().call();
-}
-
-void WebContentsDelegateEfl::DidCommitProvisionalLoadForFrame(
-    RenderFrameHost* render_frame_host,
+void WebContentsDelegateEfl::RequestCertificateConfirm(
+    WebContents* /*web_contents*/,
+    int cert_error,
+    const net::SSLInfo& ssl_info,
     const GURL& url,
-    ui::PageTransition transition_type) {
-  web_view_->SmartCallback<EWebViewCallbacks::LoadCommitted>().call();
-}
-
-void WebContentsDelegateEfl::DidNavigateMainFrame(
-    const LoadCommittedDetails& details) {
-  // The condition checks whether the main frame navigated to a different page,
-  // not scrolled to a fragment inside the current page.
-  if (details.is_navigation_to_different_page())
-    web_view_->SmartCallback<EWebViewCallbacks::LoadStarted>().call();
-}
-
-void WebContentsDelegateEfl::DocumentOnLoadCompletedInMainFrame() {
-  web_view_->SmartCallback<EWebViewCallbacks::LoadFinished>().call();
-}
-
-#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
-void WebContentsDelegateEfl::DidNavigateAnyFrame(
-    RenderFrameHost* render_frame_host,
-    const LoadCommittedDetails& details,
-    const FrameNavigateParams& params) {
-  web_view_->SmartCallback<EWebViewCallbacks::ProvisionalLoadRedirect>().call();
-  static_cast<BrowserContextEfl*>(web_contents_.GetBrowserContext())
-      ->AddVisitedURLs(params.redirects);
-}
-#endif
-
-void WebContentsDelegateEfl::DidFinishLoad(RenderFrameHost* render_frame_host,
-                                           const GURL& validated_url) {
-  if (render_frame_host->GetParent())
+    bool is_main_frame_request,
+    bool /*strict_enforcement*/,
+    base::OnceCallback<void(CertificateRequestResultType)> callback) {
+  std::string pem_certificate;
+  const GURL request_url(url);
+  if (!net::X509Certificate::GetPEMEncoded(ssl_info.cert->cert_buffer(),
+                                           &pem_certificate)) {
+    LOG(INFO) << "Certificate for URL: " << request_url.spec()
+              << " could not be opened";
+    std::move(callback).Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
     return;
+  }
+  certificate_policy_decision_.reset(new _Ewk_Certificate_Policy_Decision(
+      request_url, pem_certificate, is_main_frame_request, cert_error,
+      std::move(callback)));
 
-  NavigationEntry* entry = web_contents().GetController().GetVisibleEntry();
-  if (!entry)
-    return;
+  web_view_->SmartCallback<EWebViewCallbacks::RequestCertificateConfirm>().call(
+      certificate_policy_decision_.get());
+  LOG(INFO) << "Certificate policy decision called for URL: "
+            << request_url.spec() << " with cert_error: " << cert_error;
 
-  FaviconStatus& favicon = entry->GetFavicon();
-
-  if (favicon.valid) {
-    // check/update the url and favicon url in favicon database
-    FaviconDatabase::Instance()->SetFaviconURLForPageURL(favicon.url,
-                                                         validated_url);
-
-    // download favicon if there is no such in database
-    if (!FaviconDatabase::Instance()->ExistsForFaviconURL(favicon.url)) {
-      LOG(ERROR) << "[DidFinishLoad] :: no favicon in database for URL: "
-                 << favicon.url.spec();
-      favicon_downloader_.reset(new FaviconDownloader(
-          &web_contents_, favicon.url,
-          base::BindOnce(&WebContentsDelegateEfl::DidDownloadFavicon,
-                         weak_ptr_factory_.GetWeakPtr())));
-      favicon_downloader_->Start();
+  // if policy is suspended, the API takes over the policy object lifetime
+  // and policy will be deleted after decision is made
+  if (certificate_policy_decision_->IsSuspended()) {
+    std::ignore = certificate_policy_decision_.release();
+  } else if (!certificate_policy_decision_->IsDecided()) {
+    // When the embeder neither suspended certificate decision nor handled it
+    // inside the smart callback by calling
+    // ewk_certificate_policy_decision_allowed_set
+    // this means the embeder let chromium decide what to do.
+    if (!is_main_frame_request) {
+      // A sub-resource has a certificate error. The user doesn't really
+      // have a context for making the right decision, so block the
+      // request hard.
+      std::move(certificate_policy_decision_->Callback())
+          .Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY);
     } else {
-      web_view_->SmartCallback<EWebViewCallbacks::IconReceived>().call();
+      // By default chromium-efl allows page to be opened with certificate
+      // compromise.
+      certificate_policy_decision_->SetDecision(true);
+      LOG(WARNING) << "Certificate for " << request_url.spec()
+                   << " was compromised";
     }
   }
-
-  web_contents_.Focus();
 }
 
-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_type == blink::mojom::FaviconIconType::kFavicon &&
-        !favicon->icon_url.is_valid()) {
-      NavigationEntry* entry = web_contents_.GetController().GetVisibleEntry();
-      if (!entry)
-        return;
-      entry->GetFavicon().url = favicon->icon_url;
-      entry->GetFavicon().valid = true;
+void WebContentsDelegateEfl::VisibleSecurityStateChanged(WebContents* source) {
+  std::unique_ptr<_Ewk_Certificate_Info> certificate_info;
+  std::string pem_certificate;
+  SSLStatus ssl_status = source->GetController().GetVisibleEntry()->GetSSL();
+  scoped_refptr<net::X509Certificate> cert = ssl_status.certificate;
+
+  if (!cert) {
+    LOG(ERROR) << "Unable to get certificate!";
+    certificate_info.reset(new _Ewk_Certificate_Info(nullptr, false));
+  } else {
+    if (!net::X509Certificate::GetPEMEncoded(cert->cert_buffer(),
+                                             &pem_certificate)) {
+      LOG(ERROR) << "Unable to get encoded PEM!";
       return;
     }
+    // Note: The implementation below is a copy of the one in
+    // ChromeAutofillClient::IsContextSecure, and should be kept in sync
+    // until crbug.com/505388 gets implemented.
+    bool is_context_secure =
+        ssl_status.certificate &&
+        !net::IsCertStatusError(ssl_status.cert_status) &&
+        !(ssl_status.content_status & content::SSLStatus::RAN_INSECURE_CONTENT);
+
+    certificate_info.reset(
+        new _Ewk_Certificate_Info(pem_certificate.c_str(), is_context_secure));
   }
+  web_view_->SmartCallback<EWebViewCallbacks::SSLCertificateChanged>().call(
+      certificate_info.get());
 }
 
-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::ActivateContents(WebContents* contents) {
+#if BUILDFLAG(IS_TIZEN)
+  app_control_h app_control = nullptr;
+  int ret = app_control_create(&app_control);
+  if (ret != APP_CONTROL_ERROR_NONE) {
+    LOG(ERROR) << "app_control_create is failed with err " << ret;
+    return;
   }
-}
 
-void WebContentsDelegateEfl::RequestCertificateConfirm(
-    WebContents* /*web_contents*/,
-    int cert_error,
-    const net::SSLInfo& ssl_info,
-    const GURL& url,
-    bool /*overridable*/,
-    bool /*strict_enforcement*/,
-    base::OnceCallback<void(CertificateRequestResultType)> callback) {
-#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
-  // FIXME: EWK_BRINGUP definition should be removed.
-  DCHECK(result);
-  std::string pem_certificate;
-  if (!net::X509Certificate::GetPEMEncoded(ssl_info.cert->os_cert_handle(),
-                                           &pem_certificate)) {
-    *result = CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL;
+  std::unique_ptr<std::remove_pointer<app_control_h>::type,
+                  decltype(app_control_destroy)*>
+      auto_release{app_control, app_control_destroy};
+
+  char* app_id = nullptr;
+  ret = app_manager_get_app_id(getpid(), &app_id);
+  if (ret != APP_MANAGER_ERROR_NONE) {
+    LOG(ERROR) << "app_manager_get_app_id is failed with err " << ret;
     return;
   }
-  certificate_policy_decision_.reset(new _Ewk_Certificate_Policy_Decision(
-      url, pem_certificate, cert_error, std::move(callback)));
-#endif  // !defined(EWK_BRINGUP)
-  web_view_->SmartCallback<EWebViewCallbacks::RequestCertificateConfirm>().call(
-      certificate_policy_decision_.get());
 
-  // if policy is suspended, the API takes over the policy object lifetime
-  // and policy will be deleted after decision is made
-  if (certificate_policy_decision_->isSuspended()) {
-    ignore_result(certificate_policy_decision_.release());
-  } else {
-    certificate_policy_decision_->setDecision(true);
+  ret = app_control_set_app_id(app_control, app_id);
+  if (app_id)
+    free(app_id);
+  if (ret != APP_CONTROL_ERROR_NONE) {
+    LOG(ERROR) << "app_control_set_app_id is failed with err " << ret;
+    return;
   }
+
+  ret = app_control_send_launch_request(app_control, nullptr, nullptr);
+  if (ret != APP_CONTROL_ERROR_NONE) {
+    LOG(ERROR) << "app_control_send_launch_request is failed with err " << ret;
+    return;
+  }
+#endif
 }
 
 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));
+  contents_observer_->SetContentSecurityPolicy(policy, header_type);
+}
+
+#if defined(TIZEN_AUTOFILL)
+void WebContentsDelegateEfl::UpdateAutofillIfRequired() {
+  if (AutofillClientEfl* autofill_client =
+          AutofillClientEfl::FromWebContents(&web_contents_)) {
+    autofill_client->UpdateAutofillIfRequired();
+  }
+}
 #endif
-  } else {
-    DCHECK(!pending_content_security_policy_.get());
-    pending_content_security_policy_.reset(
-        new ContentSecurityPolicy(policy, header_type));
+
+void WebContentsDelegateEfl::OnDidChangeFocusedNodeBounds(
+    const gfx::RectF& focused_node_bounds) {
+#if defined(TIZEN_AUTOFILL)
+  if (AutofillClientEfl* autofill_client =
+          AutofillClientEfl::FromWebContents(&web_contents_)) {
+    autofill_client->DidChangeFocusedNodeBounds(focused_node_bounds);
+  }
+#endif
+}
+
+#if defined(TIZEN_AUTOFILL_FW)
+void WebContentsDelegateEfl::ResetLastInteractedElements() {
+  if (AutofillClientEfl* autofill_client =
+          AutofillClientEfl::FromWebContents(&web_contents_)) {
+    autofill_client->ResetLastInteractedElements();
   }
 }
+#endif
 
 void WebContentsDelegateEfl::FindReply(WebContents* web_contents,
                                        int request_id,
@@ -489,15 +575,20 @@ void WebContentsDelegateEfl::FindReply(WebContents* web_contents,
   }
 }
 
+#if defined(TIZEN_TBM_SUPPORT)
+void WebContentsDelegateEfl::DidRenderOffscreenFrame(void* buffer) {
+  web_view_->SmartCallback<EWebViewCallbacks::OffscreenFrameRendered>().call(
+      buffer);
+}
+#endif
+
 void WebContentsDelegateEfl::DidRenderFrame() {
   // Call FrameRendered callback when loading and first layout is finished.
   if (!did_render_frame_ && did_first_visually_non_empty_paint_ &&
       (web_view_->GetProgressValue() > 0.1)) {
     did_first_visually_non_empty_paint_ = false;
     did_render_frame_ = true;
-#if defined(USE_TTRACE)
     TTRACE_WEB("WebContentsDelegateEfl::DidRenderFrame");
-#endif
     LOG(INFO) << "WebContentsDelegateEfl::DidRenderFrame";
 
     // "frame,rendered" message is triggered as soon as rendering of a frame
@@ -506,6 +597,10 @@ void WebContentsDelegateEfl::DidRenderFrame() {
   }
 }
 
+void WebContentsDelegateEfl::DidChangeInputType(bool is_password_input) {
+  web_view_->UpdateContextMenu(is_password_input);
+}
+
 JavaScriptDialogManager* WebContentsDelegateEfl::GetJavaScriptDialogManager(
     WebContents* source) {
   if (!dialog_manager_)
@@ -514,85 +609,17 @@ JavaScriptDialogManager* WebContentsDelegateEfl::GetJavaScriptDialogManager(
 }
 
 void WebContentsDelegateEfl::OnUpdateSettings(const Ewk_Settings* settings) {
-#if defined(TIZEN_AUTOFILL_SUPPORT)
+#if defined(TIZEN_AUTOFILL)
   PasswordManagerClientEfl* client =
       PasswordManagerClientEfl::FromWebContents(&web_contents_);
   if (client) {
     PrefService* prefs = client->GetPrefs();
-    prefs->SetBoolean(password_manager::prefs::kPasswordManagerSavingEnabled,
+    prefs->SetBoolean(password_manager::prefs::kCredentialsEnableService,
                       settings->autofillPasswordForm());
   }
 #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_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-
-  return handled;
-}
-
-void WebContentsDelegateEfl::DidFailProvisionalLoad(
-    RenderFrameHost* render_frame_host,
-    const GURL& validated_url,
-    int error_code,
-    const std::u16string& error_description,
-    bool /*was_ignored_by_handler*/) {
-  DidFailLoad(render_frame_host, validated_url, error_code);
-}
-
-void WebContentsDelegateEfl::DidFailLoad(RenderFrameHost* render_frame_host,
-                                         const GURL& validated_url,
-                                         int error_code) {
-  bool is_main_frame = !render_frame_host->GetParent();
-  web_view_->InvokeLoadError(validated_url, error_code, std::string(),
-                             is_main_frame);
-}
-
-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>()
@@ -603,85 +630,26 @@ 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,
     const std::u16string& message,
     int32_t line_no,
     const std::u16string& source_id) {
-#if !defined(EWK_BRINGUP)  // FIXME: m76 bringup
   std::unique_ptr<_Ewk_Console_Message> console_message(
-      new _Ewk_Console_Message(level, base::UTF16ToUTF8(message).c_str(),
-                               line_no, base::UTF16ToUTF8(source_id).c_str()));
+      new _Ewk_Console_Message(static_cast<unsigned>(level),
+                               base::UTF16ToUTF8(message).c_str(), line_no,
+                               base::UTF16ToUTF8(source_id).c_str()));
   web_view_->SmartCallback<EWebViewCallbacks::ConsoleMessage>().call(
       console_message.get());
   return true;
-#else
-  return false;
-#endif
 }
 
 void WebContentsDelegateEfl::RunFileChooser(
     RenderFrameHost* render_frame_host,
     scoped_refptr<FileSelectListener> listener,
     const blink::mojom::FileChooserParams& params) {
-  web_view_->ShowFileChooser(render_frame_host, params);
+  web_view_->ShowFileChooser(std::move(listener), params);
 }
 
 std::unique_ptr<ColorChooser> WebContentsDelegateEfl::OpenColorChooser(
@@ -693,18 +661,6 @@ std::unique_ptr<ColorChooser> WebContentsDelegateEfl::OpenColorChooser(
   return std::make_unique<ColorChooserEfl>(*web_contents);
 }
 
-#if !defined(EWK_BRINGUP)  // FIXME: m76 bringup
-void WebContentsDelegateEfl::OpenDateTimeDialog(
-    ui::TextInputType dialog_type,
-    double dialog_value,
-    double min,
-    double max,
-    double step,
-    const std::vector<DateTimeSuggestion>& suggestions) {
-  web_view_->InputPickerShow(dialog_type, dialog_value);
-}
-#endif
-
 bool WebContentsDelegateEfl::PreHandleGestureEvent(
     WebContents* source,
     const blink::WebGestureEvent& event) {
@@ -727,10 +683,246 @@ bool WebContentsDelegateEfl::PreHandleGestureEvent(
   return false;
 }
 
-void WebContentsDelegateEfl::TitleWasSet(NavigationEntry* entry,
-                                         bool /*explicit_set*/) {
-  if (entry)
-    web_view_->GetBackForwardList()->UpdateItemWithEntry(entry);
+void WebContentsDelegateEfl::BackgroundColorReceived(int callback_id,
+                                                     SkColor bg_color) {
+  web_view_->OnGetBackgroundColor(callback_id, bg_color);
 }
 
+void WebContentsDelegateEfl::RequestManifestInfo(
+    Ewk_View_Request_Manifest_Callback callback,
+    void* user_data) {
+  WebContentsImpl* wci = static_cast<WebContentsImpl*>(&web_contents_);
+  ManifestManagerHost* manifest_manager_host =
+      ManifestManagerHost::GetOrCreateForPage(wci->GetPrimaryPage());
+  if (!manifest_manager_host) {
+    web_view_->DidRespondRequestManifest(nullptr, callback, user_data);
+    return;
+  }
+
+  manifest_manager_host->GetManifest(
+      base::BindOnce(&WebContentsDelegateEfl::OnDidGetManifest,
+                     base::Unretained(this), callback, user_data));
+}
+
+void WebContentsDelegateEfl::OnDidGetManifest(
+    Ewk_View_Request_Manifest_Callback callback,
+    void* user_data,
+    const GURL& manifest_url,
+    blink::mojom::ManifestPtr manifest) {
+  if (blink::IsEmptyManifest(*manifest)) {
+    web_view_->DidRespondRequestManifest(nullptr, callback, user_data);
+  } else {
+    _Ewk_View_Request_Manifest ewk_manifest(std::move(manifest));
+    web_view_->DidRespondRequestManifest(&ewk_manifest, callback, user_data);
+  }
+}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebContentsDelegateEfl::ShowInspectorPortInfo() {
+  std::string mappingInfo;
+  devtools_http_handler::DevToolsPortManager::GetInstance()->GetMappingInfo(
+      mappingInfo);
+  if (web_view_->UseEarlyRWI()) {
+    mappingInfo.append(
+        "\r\nFast RWI is used, [about:blank] is loaded fist instead of \r\n[");
+    mappingInfo.append(web_view_->RWIURL().spec());
+    mappingInfo.append(
+        "]\r\nClick OK button will start the real loading.\r\nNotes:\r\nPlease "
+        "connect to RWI in PC before click OK button.\r\nThen you can get "
+        "network log from the initial loading.\r\nPlease click Record button "
+        "in Timeline panel in PC before click OK button,\r\nThen you can get "
+        "profile log from the initial loading.");
+  }
+  LOG(INFO) << "[RWI] WebContentsDelegateEfl::ShowPortInfo mappingInfo = "
+            << mappingInfo.c_str();
+
+  if (!mappingInfo.empty()) {
+    const GURL kGURL("");
+    WebContentsImpl* wci = static_cast<WebContentsImpl*>(&web_contents_);
+    auto dialog_closed_callback =
+        base::BindOnce([](JavaScriptDialogManager* manager, bool success,
+                          const std::u16string& response) {},
+                       dialog_manager_);
+    wci->RunJavaScriptDialog(
+        wci->GetPrimaryMainFrame(), base::ASCIIToUTF16(mappingInfo),
+        base::ASCIIToUTF16(base::StringPiece("OK")),
+        JAVASCRIPT_DIALOG_TYPE_ALERT, false, std::move(dialog_closed_callback));
+  }
+}
+#endif
+
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebContentsDelegateEfl::UpdateTargetURL(WebContents* /*source*/,
+                                             const GURL& url) {
+  std::string absolute_link_url(url.spec());
+  if (absolute_link_url == last_hovered_url_)
+    return;
+
+  if (absolute_link_url.empty()) {
+    // If length is 0, it is not link. send "hover,out,link" callback with the
+    // original hovered URL.
+    web_view_->SmartCallback<EWebViewCallbacks::HoverOutLink>().call(
+        last_hovered_url_.c_str());
+  } else {
+    web_view_->SmartCallback<EWebViewCallbacks::HoverOverLink>().call(
+        absolute_link_url.c_str());
+  }
+
+  // Update latest hovered url.
+  last_hovered_url_ = absolute_link_url;
+}
+
+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);
+}
+
+void WebContentsDelegateEfl::NotifySubtitlePlay(int active_track_id,
+                                                const std::string& url,
+                                                const std::string& lang) {
+  web_view_->NotifySubtitlePlay(active_track_id, url.c_str(), lang.c_str());
+}
+
+void WebContentsDelegateEfl::NotifySubtitleData(int track_id,
+                                                double time_stamp,
+                                                const std::string& data,
+                                                unsigned int size) {
+  web_view_->NotifySubtitleData(track_id, time_stamp, data, size);
+}
+
+void WebContentsDelegateEfl::NotifyFirstTimeStamp(unsigned long long timestamp,
+                                                  int time_base_num,
+                                                  int time_base_den) {
+  return web_view_->NotifyFirstTimeStamp(timestamp, time_base_num,
+                                         time_base_den);
+}
+
+void WebContentsDelegateEfl::NotifyPESData(const std::string& buf,
+                                           unsigned int len,
+                                           int media_position) {
+  return web_view_->NotifyPESData(buf, len, media_position);
+}
+#endif
+
+void WebContentsDelegateEfl::OnGetMainFrameScrollbarVisible(int callback_id,
+                                                            bool visible) {
+  web_view_->InvokeMainFrameScrollbarVisibleCallback(callback_id, visible);
+}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebContentsDelegateEfl::DidEdgeScrollBy(const gfx::Point& offset,
+    bool handled) {
+  if (web_view_)
+    web_view_->InvokeEdgeScrollByCallback(offset, handled);
+}
+
+void WebContentsDelegateEfl::MoveFocusToBrowser(int direction) {
+  if (web_view_) {
+    web_view_->SmartCallback<EWebViewCallbacks::AtkKeyEventNotHandled>().call(
+        &direction);
+  }
+}
+
+void WebContentsDelegateEfl::WillDraw(int new_rotation,
+                                      gfx::Size frame_data_output_size) {
+  if (web_view_) {
+    if (web_view_->GetRotationChanged()) {
+      web_view_->SetRotationChanged(false);
+      LOG(ERROR) << __func__ << " frame_data_output_size "
+                 << frame_data_output_size.ToString() << " new rotation "
+                 << new_rotation;
+      web_view_->SmartCallback<EWebViewCallbacks::RotatePrepared>().call(0);
+    }
+  }
+}
+
+bool WebContentsDelegateEfl::IsHighBitRate() const {
+  return web_view_ ? web_view_->IsHighBitRate() : false;
+}
+
+void WebContentsDelegateEfl::NotifyParentalRatingInfo(const std::string& info,
+                                                      const std::string& url) {
+  if (web_view_)
+    web_view_->NotifyParentalRatingInfo(info.c_str(), url.c_str());
+  else
+    LOG(ERROR) << "web_view_ is null";
+}
+
+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);
+}
+
+void WebContentsDelegateEfl::NotifyPlaybackState(int state,
+                                                 int player_id,
+                                                 const std::string& url,
+                                                 const std::string& mime_type,
+                                                 bool* media_resource_acquired,
+                                                 std::string* translated_url,
+                                                 std::string* drm_info) {
+  if (!web_view_)
+    return;
+  std::vector<std::string> data = web_view_->NotifyPlaybackState(
+      state, player_id, url.empty() ? "" : url.c_str(),
+      mime_type.empty() ? "" : mime_type.c_str());
+  if (data.size()) {
+    if (media_resource_acquired)
+      *media_resource_acquired = !data.at(0).empty() ? true : false;
+    if (translated_url)
+      *translated_url = data.at(1);
+    if (drm_info)
+      *drm_info = data.at(2);
+  }
+}
+
+void WebContentsDelegateEfl::NotifyAudioTracksCount(
+    int player_id,
+    unsigned audio_tracks_count) {
+  if (web_view_)
+    web_view_->NotifyAudioTracksCount(player_id, audio_tracks_count);
+  else
+    LOG(INFO) << "web_view_ is null";
+}
+
+void WebContentsDelegateEfl::OnIsVideoPlayingGet(bool is_playing,
+                                                 int callback_id) {
+  if (web_view_)
+    web_view_->InvokeIsVideoPlayingCallback(is_playing, callback_id);
+  else
+    LOG(INFO) << "web_view_ is null";
+}
+
+void WebContentsDelegateEfl::VideoPlayingStatusReceived(bool is_playing,
+                                                        int callback_id) {
+  if (web_view_)
+    web_view_->InvokeIsVideoPlayingCallback(is_playing, callback_id);
+  else
+    LOG(INFO) << "web_view_ is null";
+}
+#endif
+
+void WebContentsDelegateEfl::UpdateTooltipUnderCursor(
+    const std::u16string& text) {
+  std::string tooltip = base::UTF16ToUTF8(text);
+  LOG(INFO) << __func__ << " " << tooltip.c_str();
+  if (tooltip.empty()) {
+    web_view_->SmartCallback<EWebViewCallbacks::TooltipTextUnset>().call();
+  } else {
+    web_view_->SmartCallback<EWebViewCallbacks::TooltipTextSet>().call(
+        tooltip.c_str());
+  }
+}
 }  // namespace content