[M120 Migration][VD] Support EWK Scroll API for TV WebBrowser
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / eweb_view.cc
index d7a964d..ce6088c 100644 (file)
@@ -8,25 +8,22 @@
 #include <Eina.h>
 #include <Elementary.h>
 
-#include "base/bind.h"
 #include "base/command_line.h"
-#include "base/files/file_path.h"
 #include "base/files/file_util.h"
+#include "base/functional/bind.h"
 #include "base/json/json_string_value_serializer.h"
 #include "base/logging.h"
 #include "base/pickle.h"
 #include "base/strings/escape.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/task/task_runner_util.h"
+#include "base/task/thread_pool.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"
 #include "browser/scoped_allow_wait_for_legacy_web_view_api.h"
 #include "browser/select_picker/select_picker_mobile.h"
 #include "browser/select_picker/select_picker_tv.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"
@@ -85,7 +82,7 @@
 #include "ui/ozone/platform/efl/efl_event_handler.h"
 #include "ui/platform_window/platform_window_init_properties.h"
 #include "web_contents_delegate_efl.h"
-#include "web_contents_efl_delegate_ewk.h"
+#include "webview_delegate_efl.h"
 
 #include <iostream>
 
 #endif
 
 #if BUILDFLAG(IS_TIZEN_TV)
+#include "browser/mixed_content_observer.h"
 #include "common/application_type.h"
 #include "devtools_port_manager.h"
+#include "private/ewk_file_chooser_request_private.h"
 #include "public/ewk_media_downloadable_font_info.h"
-#include "browser/mixed_content_observer.h"
+#include "public/ewk_media_parental_rating_info.h"
+#include "public/ewk_media_playback_info_product.h"
+#include "public/ewk_media_subtitle_info_product.h"
+#include "public/ewk_user_media_internal.h"
+#include "third_party/blink/public/platform/web_media_player.h"
 #endif
 
 #if defined(TIZEN_PEPPER_EXTENSIONS)
@@ -167,6 +170,21 @@ void GetEinaRectFromGfxRect(const gfx::Rect& gfx_rect,
 #if BUILDFLAG(IS_TIZEN)
 static Eina_Bool RotateWindowCb(void* data, int type, void* event) {
   auto wv = static_cast<EWebView*>(data);
+#if defined(TIZEN_TBM_SUPPORT)
+  if (wv->rwhva() && wv->rwhva()->GetCompositor() &&
+      wv->rwhva()->GetCompositor()->use_tbm_surface_for_offscreen_rendering()) {
+    Ecore_Wl2_Event_Window_Rotation* rotateEvent =
+        static_cast<Ecore_Wl2_Event_Window_Rotation*>(event);
+    if (rotateEvent != nullptr) {
+      LOG(INFO) << "For NUI app, new ori " << rotateEvent->angle;
+      wv->SetOrientation(rotateEvent->angle);
+    }
+    return ECORE_CALLBACK_PASS_ON;
+  }
+#endif
+  LOG(INFO) << "New ori "
+            << ecore_evas_rotation_get(
+                   ecore_evas_ecore_evas_get(wv->GetEvas()));
   wv->SetOrientation(
       ecore_evas_rotation_get(ecore_evas_ecore_evas_get(wv->GetEvas())));
   return ECORE_CALLBACK_PASS_ON;
@@ -267,7 +285,7 @@ class WebViewAsyncRequestHitTestDataUserCallback
 
   void Run(_Ewk_Hit_Test* hit_test, EWebView* web_view) override {
     DCHECK(callback_);
-    callback_(web_view->evas_object(), GetX(), GetY(), GetMode(), hit_test,
+    callback_(web_view->ewk_view(), GetX(), GetY(), GetMode(), hit_test,
               user_data_);
   }
 
@@ -297,28 +315,21 @@ class EWebAccessibilityObserver : public EWebAccessibility::Observer {
 #endif
 
 int EWebView::find_request_id_counter_ = 0;
-content::WebContentsEflDelegate::WebContentsCreateCallback
+content::WebViewDelegate::WebContentsCreateCallback
     EWebView::create_new_window_web_contents_cb_ =
         base::BindRepeating(&NullCreateWebContents);
 
-EWebView* EWebView::FromEvasObject(Evas_Object* eo) {
-  return WebViewDelegateEwk::GetInstance().GetWebViewFromEvasObject(eo);
-}
-
-void EWebView::OnViewFocusIn(void* data, Evas*, Evas_Object*, void*) {
-  auto view = static_cast<EWebView*>(data);
-  view->SetFocus(EINA_TRUE);
-}
-
-void EWebView::OnViewFocusOut(void* data, Evas*, Evas_Object*, void*) {
-  auto view = static_cast<EWebView*>(data);
-  view->SetFocus(EINA_FALSE);
+EWebView* EWebView::FromEwkView(Evas_Object* ewk_view) {
+  return WebViewDelegateEwk::GetInstance().GetEWebViewFromEwkView(ewk_view);
 }
 
 void EWebView::VisibleContentChangedCallback(void* user_data,
                                              Evas_Object* /*object*/,
                                              void* event_info) {
   auto view = static_cast<EWebView*>(user_data);
+  if (!view->GetSelectionController()) {
+    return;
+  }
   auto rect = static_cast<Eina_Rectangle*>(event_info);
   view->GetSelectionController()->SetCustomVisibleViewRect(
       gfx::Rect(rect->x, rect->y, rect->w, rect->h));
@@ -340,10 +351,10 @@ void EWebView::OnCustomScrollEndCallback(void* user_data,
     selection_controller->SetControlsTemporarilyHidden(false,true);
 }
 
-EWebView::EWebView(Ewk_Context* context, Evas_Object* object)
+EWebView::EWebView(Ewk_Context* context, Evas_Object* ewk_view)
     : context_(context),
-      evas_object_(object),
-      native_view_(object),
+      ewk_view_(ewk_view),
+      efl_main_layout_(ewk_view),
       mouse_events_enabled_(false),
       text_zoom_factor_(1.0),
       current_find_request_id_(find_request_id_counter_++),
@@ -358,21 +369,19 @@ EWebView::EWebView(Ewk_Context* context, Evas_Object* object)
       use_early_rwi_(false),
       rwi_info_showed_(false),
 #endif
+#if defined(TIZEN_PEPPER_EXTENSIONS)
+      render_frame_id_{0, 0},
+#endif
       is_initialized_(false) {
   LOG(INFO) << "EWebView: " << this;
-  if (evas_object_) {
-    evas_object_smart_callback_add(evas_object_,
-                                    kVisibleContentChangedSignalName,
-                                    VisibleContentChangedCallback, this);
-
-    evas_object_smart_callback_add(evas_object_, kCustomScrollBeginSignalName,
-                                    OnCustomScrollBeginCallback, this);
-    evas_object_smart_callback_add(evas_object_, kCustomScrollEndSignalName,
-                                    OnCustomScrollEndCallback, this);
-    evas_object_event_callback_add(evas_object_, EVAS_CALLBACK_FOCUS_IN,
-                                    OnViewFocusIn, this);
-    evas_object_event_callback_add(evas_object_, EVAS_CALLBACK_FOCUS_OUT,
-                                  OnViewFocusOut, this);
+  if (ewk_view_) {
+    evas_object_smart_callback_add(ewk_view_, kVisibleContentChangedSignalName,
+                                   VisibleContentChangedCallback, this);
+
+    evas_object_smart_callback_add(ewk_view_, kCustomScrollBeginSignalName,
+                                   OnCustomScrollBeginCallback, this);
+    evas_object_smart_callback_add(ewk_view_, kCustomScrollEndSignalName,
+                                   OnCustomScrollEndCallback, this);
 #if BUILDFLAG(IS_TIZEN)
     window_rotate_handler_ = ecore_event_handler_add(
       ECORE_WL2_EVENT_WINDOW_ROTATE, RotateWindowCb, this);
@@ -387,8 +396,6 @@ void EWebView::Initialize() {
 
   InitializeContent();
 
-  evas_event_handler_ = new WebViewEvasEventHandler(this);
-
   scroll_detector_.reset(new ScrollDetector(this));
 
 #if defined(TIZEN_PEPPER_EXTENSIONS)
@@ -397,13 +404,13 @@ void EWebView::Initialize() {
   DCHECK(web_contents_->GetRenderViewHost());
   // Settings (content::WebPreferences) will be initalized by
   // RenderViewHostImpl::ComputeWebkitPrefs() based on command line switches.
-  settings_.reset(new Ewk_Settings(evas_object_,
-                                   web_contents_->GetOrCreateWebPreferences()));
+  settings_.reset(
+      new Ewk_Settings(ewk_view_, web_contents_->GetOrCreateWebPreferences()));
 #if defined(TIZEN_ATK_SUPPORT)
   std::unique_ptr<EWebAccessibilityObserver> observer(
       new EWebAccessibilityObserver(this));
   eweb_accessibility_.reset(new EWebAccessibility(
-      evas_object_, web_contents_.get(), std::move(observer)));
+      ewk_view_, web_contents_.get(), std::move(observer)));
   lazy_initialize_atk_ = true;
 #endif
 
@@ -422,19 +429,18 @@ void EWebView::Initialize() {
       blink::UserAgentOverride::UserAgentOnly(user_agent),
       false /* override_in_new_tabs */);
 
-  elm_object_tree_focus_allow_set(native_view_, EINA_TRUE);
+  elm_object_tree_focus_allow_set(efl_main_layout_, EINA_TRUE);
   is_initialized_ = true;
-  evas_object_event_callback_add(native_view_, EVAS_CALLBACK_RESIZE,
+  evas_object_event_callback_add(efl_main_layout_, EVAS_CALLBACK_RESIZE,
                                  EWebView::NativeViewResize, this);
 
   auto cbce = static_cast<ContentBrowserClientEfl*>(
       content::GetContentClientExport()->browser());
   // Initialize accept languages
   SyncAcceptLanguages(cbce->GetAcceptLangs(nullptr));
-  accept_langs_changed_callback_ =
-      base::BindOnce(&EWebView::SyncAcceptLanguages, base::Unretained(this));
-  cbce->AddAcceptLangsChangedCallback(
-      std::move(accept_langs_changed_callback_));
+  accept_langs_changed_callback_ = base::BindRepeating(
+      &EWebView::SyncAcceptLanguages, base::Unretained(this));
+  cbce->AddAcceptLangsChangedCallback(accept_langs_changed_callback_);
 
   // If EWebView is created by window.open, RenderView is already created
   // before initializing WebContents. So we should manually invoke
@@ -447,17 +453,15 @@ void EWebView::Initialize() {
 
 EWebView::~EWebView() {
   LOG(INFO) << "EWebView: " << this;
+  weak_factory_.InvalidateWeakPtrs();
   auto cbce = static_cast<ContentBrowserClientEfl*>(
       content::GetContentClientExport()->browser());
-#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
-  cbce->RemoveAcceptLangsChangedCallback(
-      std::move(accept_langs_changed_callback_));
-#endif
+  cbce->RemoveAcceptLangsChangedCallback(accept_langs_changed_callback_);
 #if defined(TIZEN_PEPPER_EXTENSIONS)
   UnregisterPepperExtensionDelegate();
 #endif
 
-  evas_object_event_callback_del(native_view_, EVAS_CALLBACK_RESIZE,
+  evas_object_event_callback_del(efl_main_layout_, EVAS_CALLBACK_RESIZE,
                                  EWebView::NativeViewResize);
 #if defined(USE_WAYLAND)
   if (GetSettings()->getClipboardEnabled())
@@ -489,14 +493,16 @@ EWebView::~EWebView() {
 #if defined(TIZEN_AUTOFILL_FW)
   if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
           autofill::switches::kDisableAutofill)) {
-    autofill::AutofillRequestManager::GetInstance()->RemoveRequest(
-        evas_object());
+    autofill::AutofillRequestManager::GetInstance()->RemoveRequest(ewk_view());
   }
 #endif
 
   select_picker_.reset();
   context_menu_.reset();
   mhtml_callback_map_.Clear();
+#if BUILDFLAG(IS_TIZEN_TV)
+  is_video_playing_callback_map_.Clear();
+#endif
 
   compositor_observer_.reset();
 
@@ -514,17 +520,12 @@ EWebView::~EWebView() {
 
   gin_native_bridge_dispatcher_host_.reset();
 
-  if (evas_object_) {
-    evas_object_event_callback_del(evas_object_, EVAS_CALLBACK_FOCUS_IN,
-                                   OnViewFocusIn);
-    evas_object_event_callback_del(evas_object_, EVAS_CALLBACK_FOCUS_OUT,
-                                   OnViewFocusOut);
-    evas_object_smart_callback_del(evas_object_,
-                                   kVisibleContentChangedSignalName,
+  if (ewk_view_) {
+    evas_object_smart_callback_del(ewk_view_, kVisibleContentChangedSignalName,
                                    VisibleContentChangedCallback);
-    evas_object_smart_callback_del(evas_object_, kCustomScrollBeginSignalName,
+    evas_object_smart_callback_del(ewk_view_, kCustomScrollBeginSignalName,
                                    OnCustomScrollBeginCallback);
-    evas_object_smart_callback_del(evas_object_, kCustomScrollEndSignalName,
+    evas_object_smart_callback_del(ewk_view_, kCustomScrollEndSignalName,
                                    OnCustomScrollEndCallback);
 #if BUILDFLAG(IS_TIZEN)
     if (window_rotate_handler_)
@@ -550,12 +551,9 @@ void EWebView::NativeViewResize(void* data,
   auto thiz = static_cast<EWebView*>(data);
   if (!thiz->context_menu_)
     return;
-  int native_view_x, native_view_y, native_view_width, native_view_height;
-  evas_object_geometry_get(obj, &native_view_x, &native_view_y,
-                           &native_view_width, &native_view_height);
-  gfx::Rect webview_rect(native_view_x, native_view_y, native_view_width,
-                         native_view_height);
-  thiz->context_menu_->Resize(webview_rect);
+  int x, y, width, height;
+  evas_object_geometry_get(obj, &x, &y, &width, &height);
+  thiz->context_menu_->Resize(gfx::Rect(x, y, width, height));
 }
 
 void EWebView::ResetContextMenuController() {
@@ -564,19 +562,23 @@ void EWebView::ResetContextMenuController() {
 
 #if BUILDFLAG(IS_TIZEN_TV)
 void EWebView::RunPendingSetFocus(Eina_Bool focus) {
-  if (!web_contents_ || !rwhva() || (HasFocus() == focus))
+  SetFocusInternal(focus);
+}
+
+void EWebView::SetFocusInternal(Eina_Bool focus) {
+  if (!rwhva() || !rwhva()->offscreen_helper() || (HasFocus() == focus))
     return;
   rwhva()->offscreen_helper()->Focus(focus);
 }
 #endif
 
 void EWebView::SetFocus(Eina_Bool focus) {
-  if (!web_contents_ || !rwhva() || (HasFocus() == focus))
+  if (!web_contents_)
     return;
 
 #if BUILDFLAG(IS_TIZEN_TV)
   if (web_contents_->GetPrimaryMainFrame()->IsRenderFrameLive()) {
-    rwhva()->offscreen_helper()->Focus(focus);
+    SetFocusInternal(focus);
 
     if (pending_setfocus_closure_)
       pending_setfocus_closure_.Reset();
@@ -591,7 +593,7 @@ void EWebView::SetFocus(Eina_Bool focus) {
 }
 
 Eina_Bool EWebView::HasFocus() const {
-  if (!rwhva())
+  if (!rwhva() || !rwhva()->offscreen_helper())
     return EINA_FALSE;
 
   return rwhva()->offscreen_helper()->HasFocus() ? EINA_TRUE : EINA_FALSE;
@@ -633,7 +635,10 @@ bool EWebView::SetPageVisibility(
 }
 
 bool EWebView::CreateNewWindow(
-    content::WebContentsEflDelegate::WebContentsCreateCallback cb) {
+    content::WebViewDelegate::WebContentsCreateCallback cb) {
+#if BUILDFLAG(IS_TIZEN_TV)
+  LOG(INFO) << __FUNCTION__;
+#endif
   create_new_window_web_contents_cb_ = cb;
   Evas_Object* new_object = NULL;
   SmartCallback<EWebViewCallbacks::CreateNewWindow>().call(&new_object);
@@ -645,11 +650,11 @@ bool EWebView::CreateNewWindow(
 // static
 Evas_Object* EWebView::GetHostWindowDelegate(const content::WebContents* wc) {
   EWebView* thiz = WebViewFromWebContents(wc);
-  DCHECK(thiz->evas_object_);
-  Evas_Object* parent = evas_object_above_get(thiz->evas_object_);
+  DCHECK(thiz->ewk_view_);
+  Evas_Object* parent = evas_object_above_get(thiz->ewk_view_);
   if (!parent) {
     LOG(WARNING) << "Could not find and visual parents for EWK smart object!.";
-    return thiz->evas_object_;
+    return thiz->ewk_view_;
   }
 
   if (elm_object_widget_check(parent)) {
@@ -660,11 +665,11 @@ Evas_Object* EWebView::GetHostWindowDelegate(const content::WebContents* wc) {
   }
 
   LOG(WARNING) << "Could not find elementary parent for WebView object!";
-  return thiz->evas_object_;
+  return thiz->ewk_view_;
 }
 
 Evas_Object* EWebView::GetElmWindow() const {
-  Evas_Object* parent = elm_object_parent_widget_get(evas_object_);
+  Evas_Object* parent = elm_object_parent_widget_get(ewk_view_);
   return parent ? elm_object_top_widget_get(parent) : nullptr;
 }
 
@@ -745,46 +750,56 @@ void EWebView::Stop() {
 }
 
 void EWebView::Suspend() {
-  CHECK(web_contents_);
 #if BUILDFLAG(IS_TIZEN)
+  CHECK(web_contents_);
   if (IsMobileProfile() && web_contents_->IsFullscreen())
     web_contents_->ExitFullscreen(true);
-#endif
   RenderViewHost* rvh = web_contents_->GetRenderViewHost();
   RenderFrameHost* rfh = web_contents_->GetPrimaryMainFrame();
   CHECK(rvh);
   CHECK(rfh);
-#if !defined(EWK_BRINGUP)  // FIXME: m69 bringup
-  rfh->BlockRequestsForFrame();
-#endif
-#if 0
-  content::GetIOThreadTaskRunner({})->PostTask(FROM_HERE, base::BindOnce(
-      &content::ResourceDispatcherHost::BlockRequestsForFrameFromUI, rfh));
-
-  if (rvh)
-    rvh->Send(new EwkViewMsg_SuspendScheduledTask(rvh->GetRoutingID()));
+  if (rvh->IsRenderViewLive()) {
+    RenderWidgetHostImpl* rwhi = static_cast<RenderWidgetHostImpl*>(rvh->GetWidget());
+    rwhi->PauseScheduledTasks();
+  }
 #endif
 }
 
 void EWebView::Resume() {
+#if BUILDFLAG(IS_TIZEN)
   CHECK(web_contents_);
   RenderViewHost* rvh = web_contents_->GetRenderViewHost();
   RenderFrameHost* rfh = web_contents_->GetPrimaryMainFrame();
   CHECK(rvh);
   CHECK(rfh);
-#if !defined(EWK_BRINGUP)  // FIXME: m69 bringup
-  rfh->ResumeBlockedRequestsForFrame();
+  if (rvh->IsRenderViewLive() && rwhva())
+    rwhva()->host()->UnPauseScheduledTasks();
 #endif
-#if 0
-  content::GetIOThreadTaskRunner({})->PostTask(FROM_HERE, base::BindOnce(
-      &content::ResourceDispatcherHost::ResumeBlockedRequestsForFrameFromUI,
-      rfh));
+}
 
-  if (rvh)
-    rvh->Send(new EwkViewMsg_ResumeScheduledTasks(rvh->GetRoutingID()));
-#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+void EWebView::SetFloatVideoWindowState(bool enabled) {
+  RenderWidgetHostImpl* rwhi = static_cast<RenderWidgetHostImpl*>(
+      web_contents_->GetRenderViewHost()->GetWidget());
+
+    rwhi->SetFloatVideoWindowState(enabled);
 }
 
+void EWebView::SuspendNetworkLoading() {
+  RenderWidgetHostImpl* rwhi = static_cast<RenderWidgetHostImpl*>(
+      web_contents_->GetRenderViewHost()->GetWidget());
+
+  rwhi->SuspendNetworkLoading();
+}
+
+void EWebView::ResumeNetworkLoading() {
+  RenderWidgetHostImpl* rwhi = static_cast<RenderWidgetHostImpl*>(
+      web_contents_->GetRenderViewHost()->GetWidget());
+
+  rwhi->ResumeNetworkLoading();
+}
+#endif // IS_TIZEN_TV
+
 double EWebView::GetTextZoomFactor() const {
   if (text_zoom_factor_ < 0.0)
     return -1.0;
@@ -824,10 +839,11 @@ void EWebView::ExecuteEditCommand(const char* command, const char* value) {
     optional_value = absl::make_optional(base::ASCIIToUTF16(value));
 
   WebContentsImpl* wc = static_cast<WebContentsImpl*>(web_contents_.get());
-  if (wc && wc->GetFocusedFrameWidgetInputHandler()) {
-    wc->GetFocusedFrameWidgetInputHandler()->ExecuteEditCommand(
-        std::string(command), optional_value);
-  }
+  if (!wc || !wc->GetFocusedFrameWidgetInputHandler())
+    return;
+
+  wc->GetFocusedFrameWidgetInputHandler()->ExecuteEditCommand(
+      std::string(command), optional_value);
 }
 
 #if BUILDFLAG(IS_TIZEN)
@@ -840,18 +856,27 @@ void EWebView::EnterDragState() {
 #endif
 
 void EWebView::SetOrientation(int orientation) {
+  LOG(INFO) << "New ori " << orientation << " GetOrientation "
+            << GetOrientation();
   if (GetOrientation() == orientation)
     return;
+  SetRotationChanged(true);
 
   if (orientation == 0 || orientation == 90 || orientation == 180 ||
       orientation == 270) {
 #if !defined(USE_AURA)
     GetWebContentsViewEfl()->SetOrientation(orientation);
+#else
+#if BUILDFLAG(IS_TIZEN)
+    TRACE_EVENT2("viz", "EWebView::SetOrientation", "orientation", orientation,
+                 "this", (void*)this);
+    wcva()->SetOrientation(orientation);
+#endif
 #endif
     int width = 0;
     int height = 0;
     const Ecore_Evas* ee =
-        ecore_evas_ecore_evas_get(evas_object_evas_get(evas_object_));
+        ecore_evas_ecore_evas_get(evas_object_evas_get(ewk_view_));
     ecore_evas_screen_geometry_get(ee, nullptr, nullptr, &width, &height);
     if (orientation == 90 || orientation == 270)
       std::swap(width, height);
@@ -867,18 +892,22 @@ int EWebView::GetOrientation() {
 #if !defined(USE_AURA)
   return GetWebContentsViewEfl()->GetOrientation();
 #else
+#if BUILDFLAG(IS_TIZEN)
+  return wcva()->GetOrientation();
+#else
   return 0;
 #endif
+#endif
 }
 
 void EWebView::Show() {
-  evas_object_show(native_view_);
+  evas_object_show(efl_main_layout_);
   web_contents_->WasShown();
 }
 
 void EWebView::Hide() {
   LOG(INFO) << "EWebView: " << this;
-  evas_object_hide(native_view_);
+  evas_object_hide(efl_main_layout_);
   if (!web_contents_)
     return;
   web_contents_->WasHidden();
@@ -895,7 +924,7 @@ void EWebView::InvokeAuthCallback(LoginDelegateEfl* login_delegate,
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
   auth_challenge_.reset(new _Ewk_Auth_Challenge(login_delegate, url, realm));
-  authentication_cb_.Run(evas_object_, auth_challenge_.get());
+  authentication_cb_.Run(ewk_view_, auth_challenge_.get());
 
   if (!auth_challenge_->is_decided && !auth_challenge_->is_suspended) {
     auth_challenge_->is_decided = true;
@@ -970,8 +999,7 @@ void EWebView::HandleTouchEvents(Ewk_Touch_Event_Type type,
       pt.y = point->y;
 
       int delta_y = 0;
-      evas_object_geometry_get(evas_object(), nullptr, &delta_y, nullptr,
-                               nullptr);
+      evas_object_geometry_get(ewk_view(), nullptr, &delta_y, nullptr, nullptr);
       ui::TouchEvent touch_event =
           ui::MakeTouchEvent(pt, point->state, point->id, 0, delta_y);
       rwhva()->OnTouchEvent(&touch_event);
@@ -1023,6 +1051,31 @@ void EWebView::SetMouseEventsEnabled(bool enabled) {
   rwhva()->offscreen_helper()->SetTouchEventsEnabled(!enabled);
 }
 
+bool EWebView::SetKeyEventsEnabled(bool enabled) {
+  if (!rwhva() || !rwhva()->aura_efl_helper()) {
+    LOG(WARNING) << "RWHV is not created yet!";
+    return false;
+  }
+
+  if (key_events_enabled_ == enabled)
+    return true;
+
+  key_events_enabled_ = enabled;
+  rwhva()->aura_efl_helper()->SetKeyEventsEnabled(enabled);
+  return true;
+}
+
+void EWebView::SendKeyEvent(Evas_Object* ewk_view,
+                            void* key_event,
+                            bool is_press) {
+  if (!rwhva() || !rwhva()->aura_efl_helper()) {
+    LOG(WARNING) << "RWHV is not created yet!";
+    return;
+  }
+
+  rwhva()->aura_efl_helper()->SendKeyEvent(ewk_view, key_event, is_press);
+}
+
 namespace {
 
 class JavaScriptCallbackDetails {
@@ -1084,7 +1137,7 @@ bool EWebView::ExecuteJavaScript(const char* script,
   base::UTF8ToUTF16(script, strlen(script), &js_script);
   if (callback) {
     JavaScriptCallbackDetails* script_callback_data =
-        new JavaScriptCallbackDetails(callback, userdata, evas_object_);
+        new JavaScriptCallbackDetails(callback, userdata, ewk_view_);
     RenderFrameHost::JavaScriptResultCallback js_callback =
         base::BindOnce(&JavaScriptComplete, base::Owned(script_callback_data));
     // In M47, it isn't possible anymore to execute javascript in the generic
@@ -1282,19 +1335,17 @@ void EWebView::SetViewLoadErrorPageCallback(
 }
 
 // Remove below code while ewk_error_cancellation_get has been implemented.
-const char* EWebView::InvokeViewLoadErrorPageCallback(
-    const GURL& url,
-    int error_code,
-    const std::string& error_description) {
-  std::unique_ptr<_Ewk_Error> err(
-      new _Ewk_Error(error_code, url.possibly_invalid_spec().c_str(),
-                     error_description.c_str()));
+const char* EWebView::InvokeViewLoadErrorPageCallback(const GURL& url,
+                                                      int error_code,
+                                                      bool is_cancellation) {
+  std::unique_ptr<_Ewk_Error> err(new _Ewk_Error(
+      error_code, is_cancellation, url.possibly_invalid_spec().c_str()));
   _Ewk_Error_Page error_page;
 
   LOG(INFO) << "EWebView::InvokeLoadErrorPageCallback url: "
             << url.spec().c_str() << ", error_code: " << error_code;
 
-  load_error_page_cb_.Run(evas_object_, err.get(), &error_page);
+  load_error_page_cb_.Run(ewk_view_, err.get(), &error_page);
   return error_page.content;
 }
 
@@ -1357,16 +1408,17 @@ void EWebView::HandleLongPressGesture(
   convertedParams.y = convertedPoint.y();
 
   Evas_Coord x, y;
-  evas_object_geometry_get(evas_object(), &x, &y, 0, 0);
+  evas_object_geometry_get(ewk_view(), &x, &y, 0, 0);
   convertedParams.x += x;
   convertedParams.y += y;
 
+  bool show_context_menu_now = true;
   if (GetSelectionController() && GetSelectionController()->GetLongPressed()) {
-    bool show_context_menu_now =
-        !GetSelectionController()->HandleLongPressEvent(convertedPoint,
-                                                        convertedParams);
-    if (show_context_menu_now)
-      ShowContextMenuInternal(convertedParams);
+    show_context_menu_now = !GetSelectionController()->HandleLongPressEvent(
+        convertedPoint, convertedParams);
+  }
+  if (show_context_menu_now) {
+    ShowContextMenuInternal(convertedParams);
   }
 }
 
@@ -1385,7 +1437,7 @@ void EWebView::ShowContextMenu(const content::ContextMenuParams& params) {
   convertedParams.y = convertedPoint.y();
 
   Evas_Coord x, y;
-  evas_object_geometry_get(evas_object(), &x, &y, 0, 0);
+  evas_object_geometry_get(ewk_view(), &x, &y, 0, 0);
   convertedParams.x += x;
   convertedParams.y += y;
 
@@ -1423,8 +1475,8 @@ void EWebView::ShowContextMenuInternal(
 
 void EWebView::UpdateContextMenu(bool is_password_input) {
   if (is_password_input) {
-    saved_context_menu_params_.input_field_type =
-        blink::mojom::ContextMenuDataInputFieldType::kPassword;
+    saved_context_menu_params_.form_control_type =
+        blink::mojom::FormControlType::kInputPassword;
   }
   UpdateContextMenuWithParams(saved_context_menu_params_);
 }
@@ -1452,7 +1504,7 @@ void EWebView::UpdateContextMenuWithParams(
 }
 
 Eina_Bool EWebView::DelayedPopulateAndShowContextMenu(void* data) {
-  if (IsMobileProfile) {
+  if (IsMobileProfile()) {
     EWebView* view = static_cast<EWebView*>(data);
     if (view) {
       if (view->context_menu_ &&
@@ -1657,6 +1709,10 @@ SelectionControllerEfl* EWebView::GetSelectionController() const {
 }
 
 void EWebView::SelectFocusedLink() {
+  if (!rwhva()) {
+    return;
+  }
+
   rwhva()->host()->SelectFocusedLink();
 }
 
@@ -1840,6 +1896,10 @@ void EWebView::OnFocusIn() {
 }
 
 void EWebView::OnFocusOut() {
+#if defined(TIZEN_ATK_SUPPORT)
+  if (IsMobileProfile())
+    eweb_accessibility_->OnFocusOut();
+#endif
   SmartCallback<EWebViewCallbacks::FocusOut>().call();
 #if defined(USE_WAYLAND)
   if (GetSettings()->getClipboardEnabled())
@@ -1882,13 +1942,14 @@ void EWebView::SetQuotaPermissionRequestCallback(
   quota_request_callback_.Set(callback, user_data);
 }
 
+#if !defined(EWK_BRINGUP)  // FIXME: m114 bringup
 void EWebView::InvokeQuotaPermissionRequest(
     _Ewk_Quota_Permission_Request* request,
     content::QuotaPermissionContext::PermissionCallback cb) {
   quota_permission_request_map_[request] = std::move(cb);
-  request->setView(evas_object());
+  request->setView(ewk_view());
   if (quota_request_callback_.IsCallbackSet())
-    quota_request_callback_.Run(evas_object(), request);
+    quota_request_callback_.Run(ewk_view(), request);
   else
     QuotaRequestCancel(request);
 }
@@ -1918,6 +1979,7 @@ void EWebView::QuotaRequestCancel(
   quota_permission_request_map_.erase(request);
   delete request;
 }
+#endif
 
 bool EWebView::GetLinkMagnifierEnabled() const {
 #if !defined(EWK_BRINGUP)  // FIXME: m71 bringup
@@ -2086,7 +2148,7 @@ bool EWebView::IsNotificationPermissionCallbackSet() const {
 bool EWebView::InvokeNotificationPermissionCallback(
     Ewk_Notification_Permission_Request* request) {
   Eina_Bool ret = EINA_FALSE;
-  notification_permission_callback_.Run(evas_object_, request, &ret);
+  notification_permission_callback_.Run(ewk_view_, request, &ret);
   return ret;
 }
 
@@ -2114,7 +2176,7 @@ void EWebView::InvokePlainTextGetCallback(const std::string& content_text,
                                           int plain_text_get_callback_id) {
   EwkViewPlainTextGetCallback* view_plain_text_callback_invoke_ptr =
       plain_text_get_callback_map_.Lookup(plain_text_get_callback_id);
-  view_plain_text_callback_invoke_ptr->Run(evas_object(), content_text.c_str());
+  view_plain_text_callback_invoke_ptr->Run(ewk_view(), content_text.c_str());
   plain_text_get_callback_map_.Remove(plain_text_get_callback_id);
 }
 
@@ -2127,7 +2189,7 @@ void EWebView::SetViewGeolocationPermissionCallback(
 bool EWebView::InvokeViewGeolocationPermissionCallback(
     _Ewk_Geolocation_Permission_Request* permission_context,
     Eina_Bool* callback_result) {
-  return geolocation_permission_cb_.Run(evas_object_, permission_context,
+  return geolocation_permission_cb_.Run(ewk_view_, permission_context,
                                         callback_result);
 }
 
@@ -2140,7 +2202,7 @@ void EWebView::SetViewUserMediaPermissionCallback(
 bool EWebView::InvokeViewUserMediaPermissionCallback(
     _Ewk_User_Media_Permission_Request* permission_context,
     Eina_Bool* callback_result) {
-  return user_media_permission_cb_.Run(evas_object_, permission_context,
+  return user_media_permission_cb_.Run(ewk_view_, permission_context,
                                        callback_result);
 }
 
@@ -2153,7 +2215,7 @@ void EWebView::SetViewUserMediaPermissionQueryCallback(
 Ewk_User_Media_Permission_Query_Result
 EWebView::InvokeViewUserMediaPermissionQueryCallback(
     _Ewk_User_Media_Permission_Query* permission_context) {
-  return user_media_permission_query_cb_.Run(evas_object_, permission_context);
+  return user_media_permission_query_cb_.Run(ewk_view_, permission_context);
 }
 
 void EWebView::SetViewUnfocusAllowCallback(
@@ -2164,7 +2226,7 @@ void EWebView::SetViewUnfocusAllowCallback(
 
 bool EWebView::InvokeViewUnfocusAllowCallback(Ewk_Unfocus_Direction direction,
                                               Eina_Bool* callback_result) {
-  return unfocus_allow_cb_.Run(evas_object_, direction, callback_result);
+  return unfocus_allow_cb_.Run(ewk_view_, direction, callback_result);
 }
 
 void EWebView::StopFinding() {
@@ -2197,9 +2259,9 @@ bool EWebView::GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback,
   if (!render_view_host)
     return false;
 
+#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
   MHTMLCallbackDetails* callback_details = new MHTMLCallbackDetails;
   callback_details->Set(callback, user_data);
-#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
   int mhtml_callback_id = mhtml_callback_map_.Add(callback_details);
   return render_view_host->Send(new EwkViewMsg_GetMHTMLData(
       render_view_host->GetRoutingID(), mhtml_callback_id));
@@ -2212,7 +2274,7 @@ void EWebView::OnMHTMLContentGet(const std::string& mhtml_content,
                                  int callback_id) {
   MHTMLCallbackDetails* callback_details =
       mhtml_callback_map_.Lookup(callback_id);
-  callback_details->Run(evas_object(), mhtml_content.c_str());
+  callback_details->Run(ewk_view(), mhtml_content.c_str());
   mhtml_callback_map_.Remove(callback_id);
 }
 
@@ -2226,16 +2288,15 @@ bool EWebView::SavePageAsMHTML(const std::string& path,
   std::u16string title(web_contents_->GetTitle());
 
   // Post function that has file access to blocking task runner.
-  return base::PostTaskAndReplyWithResult(
-      base::ThreadPool::CreateSequencedTaskRunner(
-          {base::MayBlock(), base::TaskPriority::BEST_EFFORT,
-           base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})
-          .get(),
+  base::ThreadPool::PostTaskAndReplyWithResult(
       FROM_HERE,
+      {base::MayBlock(), base::TaskPriority::BEST_EFFORT,
+       base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
       base::BindOnce(&GenerateMHTMLFilePath, url, base::UTF16ToUTF8(title),
                      path),
       base::BindOnce(&EWebView::GenerateMHTML, base::Unretained(this), callback,
                      user_data));
+  return true;
 }
 
 void EWebView::GenerateMHTML(Ewk_View_Save_Page_Callback callback,
@@ -2243,7 +2304,7 @@ void EWebView::GenerateMHTML(Ewk_View_Save_Page_Callback callback,
                              const base::FilePath& file_path) {
   if (file_path.empty()) {
     LOG(ERROR) << "Generating file path was failed";
-    callback(evas_object_, nullptr, user_data);
+    callback(ewk_view_, nullptr, user_data);
     return;
   }
 
@@ -2257,7 +2318,7 @@ void EWebView::MHTMLGenerated(Ewk_View_Save_Page_Callback callback,
                               void* user_data,
                               const base::FilePath& file_path,
                               int64_t file_size) {
-  callback(evas_object_, file_size > 0 ? file_path.value().c_str() : nullptr,
+  callback(ewk_view_, file_size > 0 ? file_path.value().c_str() : nullptr,
            user_data);
 }
 
@@ -2281,7 +2342,7 @@ void EWebView::OnGetBackgroundColor(int callback_id, SkColor bg_color) {
   if (!cb)
     return;
 
-  cb->Run(evas_object(), SkColorGetR(bg_color), SkColorGetG(bg_color),
+  cb->Run(ewk_view(), SkColorGetR(bg_color), SkColorGetG(bg_color),
           SkColorGetB(bg_color), SkColorGetA(bg_color));
   background_color_get_callback_map_.Remove(callback_id);
 }
@@ -2306,7 +2367,7 @@ void EWebView::DidChangePageScaleFactor(double scale_factor) {
   SetScaledContentsSize();
 
   // Notify app about the scale change.
-  scale_changed_cb_.Run(evas_object_, scale_factor);
+  scale_changed_cb_.Run(ewk_view_, scale_factor);
 }
 
 inline JavaScriptDialogManagerEfl* EWebView::GetJavaScriptDialogManagerEfl() {
@@ -2351,20 +2412,77 @@ void EWebView::JavaScriptPromptReply(const char* result) {
 }
 
 void EWebView::GetPageScaleRange(double* min_scale, double* max_scale) {
-  auto prefs = web_contents_->GetOrCreateWebPreferences();
+  auto& prefs = web_contents_->GetOrCreateWebPreferences();
   if (min_scale)
     *min_scale = prefs.default_minimum_page_scale_factor;
   if (max_scale)
     *max_scale = prefs.default_maximum_page_scale_factor;
 }
 
-void EWebView::SetDrawsTransparentBackground(bool enabled) {
+content::WebContentsViewAura* EWebView::GetWebContentsViewAura() const {
+  WebContentsImpl* wc = static_cast<WebContentsImpl*>(web_contents_.get());
+  return static_cast<WebContentsViewAura*>(wc->GetView());
+}
+
+bool EWebView::SetDrawsTransparentBackground(bool enabled) {
+#if BUILDFLAG(IS_TIZEN)
   RenderViewHost* render_view_host = web_contents_->GetRenderViewHost();
-  if (!render_view_host)
-    return;
-#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
-  render_view_host->Send(new EwkViewMsg_SetDrawsTransparentBackground(
-      render_view_host->GetRoutingID(), enabled));
+  if (!render_view_host || !rwhva())
+    return false;
+
+  if (!rwhva()->offscreen_helper())
+    return false;
+  elm_object_style_set(rwhva()->offscreen_helper()->content_image_elm_host(),
+                       enabled ? "transparent" : "default");
+  evas_object_image_alpha_set(rwhva()->offscreen_helper()->content_image(),
+                              enabled);
+  GetWebContentsViewAura()->SetBackgroundColor(enabled ? SK_ColorTRANSPARENT
+                                                       : SK_ColorWHITE);
+  static_cast<RenderViewHostImpl*>(render_view_host)
+      ->GetWidget()
+      ->GetAssociatedFrameWidget()
+      ->SetDrawsTransparentBackground(enabled);
+  rwhva()->SetBackgroundColor(enabled ? SK_ColorTRANSPARENT : SK_ColorWHITE);
+  return true;
+#else
+  return false;
+#endif
+}
+
+bool EWebView::GetDrawsTransparentBackground() {
+#if BUILDFLAG(IS_TIZEN)
+  return GetWebContentsViewAura()->GetBackgroundColor() == SK_ColorTRANSPARENT;
+#else
+  return false;
+#endif
+}
+
+bool EWebView::SetBackgroundColor(int red, int green, int blue, int alpha) {
+#if BUILDFLAG(IS_TIZEN)
+  if (!alpha)
+    return SetDrawsTransparentBackground(true);
+
+  RenderViewHost* render_view_host = web_contents_->GetRenderViewHost();
+  if (!render_view_host || !rwhva())
+    return false;
+
+  if (!rwhva()->offscreen_helper())
+    return false;
+  elm_object_style_set(rwhva()->offscreen_helper()->content_image_elm_host(),
+                       alpha < 255 ? "transparent" : "default");
+  evas_object_image_alpha_set(rwhva()->offscreen_helper()->content_image(),
+                              alpha < 255);
+  GetWebContentsViewAura()->SetBackgroundColor(
+      SkColorSetARGB(alpha, red, green, blue));
+  static_cast<RenderViewHostImpl*>(render_view_host)
+      ->GetWidget()
+      ->GetAssociatedFrameWidget()
+      ->SetBackgroundColor(red, green, blue, alpha);
+  rwhva()->SetBackgroundColor(SkColorSetARGB(alpha, red, green, blue));
+
+  return true;
+#else
+  return false;
 #endif
 }
 
@@ -2457,28 +2575,20 @@ bool EWebView::IsDragging() const {
   return wcva()->wcva_helper()->IsDragging();
 }
 
-void EWebView::ShowFileChooser(content::RenderFrameHost* render_frame_host,
-                               const blink::mojom::FileChooserParams& params) {
+void EWebView::ShowFileChooser(
+    scoped_refptr<content::FileSelectListener> listener,
+    const blink::mojom::FileChooserParams& params) {
+#if BUILDFLAG(IS_TIZEN_TV)
+  LOG(INFO) << "File chooser request callback.";
+  file_chooser_request_.reset(new _Ewk_File_Chooser_Request(
+      std::move(listener), params.accept_types, params.mode));
+  SmartCallback<EWebViewCallbacks::FileChooserRequest>().call(
+      file_chooser_request_.get());
+#else
   if (!IsMobileProfile() && !IsWearableProfile())
     return;
-
-#if !defined(EWK_BRINGUP)  // FIXME: m71 bringup
-  if (params.capture) {
-    const std::string capture_types[] = {"video/*", "audio/*", "image/*"};
-    unsigned int capture_types_num =
-        sizeof(capture_types) / sizeof(*capture_types);
-    for (unsigned int i = 0; i < capture_types_num; ++i) {
-      for (unsigned int j = 0; j < params.accept_types.size(); ++j) {
-        if (UTF16ToUTF8(params.accept_types[j]) == capture_types[i]) {
-          filechooser_mode_ = params.mode;
-          LaunchCamera(params.accept_types[j]);
-          return;
-        }
-      }
-    }
-  }
   file_chooser_.reset(
-      new content::FileChooserControllerEfl(render_frame_host, &params));
+      new content::FileChooserControllerEfl(std::move(listener), params));
   file_chooser_->Open();
 #endif
 }
@@ -2509,8 +2619,7 @@ void EWebView::ShowContentsDetectedPopup(const char* message) {
 }
 
 void EWebView::RequestColorPicker(int r, int g, int b, int a) {
-  input_picker_.reset(
-      new InputPicker(this, web_contents_.get(), evas_object()));
+  input_picker_.reset(new InputPicker(this, web_contents_.get(), ewk_view()));
   input_picker_->ShowColorPicker(r, g, b, a);
 }
 
@@ -2524,7 +2633,7 @@ bool EWebView::SetColorPickerColor(int r, int g, int b, int a) {
 void EWebView::InputPickerShow(ui::TextInputType input_type,
                                double input_value,
                                content::DateTimeChooserEfl* date_time_chooser) {
-  input_picker_.reset(new InputPicker(this, web_contents_.get(), evas_object(),
+  input_picker_.reset(new InputPicker(this, web_contents_.get(), ewk_view(),
                                       date_time_chooser));
   input_picker_->ShowDatePicker(input_type, input_value);
 }
@@ -2633,7 +2742,7 @@ void EWebView::GetMousePosition(gfx::Point& mouse_position) {
   int mouse_x, mouse_y;
   evas_pointer_output_xy_get(GetEvas(), &mouse_x, &mouse_y);
   Evas_Coord x, y, width, height;
-  evas_object_geometry_get(evas_object(), &x, &y, &width, &height);
+  evas_object_geometry_get(ewk_view(), &x, &y, &width, &height);
 
   if (mouse_y < y)
     mouse_y = y + 1;
@@ -2672,6 +2781,17 @@ void EWebView::InvokeEdgeScrollByCallback(const gfx::Point& offset,
 }
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void EWebView::InvokeScrollbarThumbFocusChangedCallback(
+    Ewk_Scrollbar_Orientation orientation,
+    bool focused) {
+  Ewk_Scrollbar_Data data;
+  data.orientation = orientation;
+  data.focused = focused;
+  SmartCallback<EWebViewCallbacks::DidChagneScrollbarsThumbFocus>().call(&data);
+}
+#endif
+
 void EWebView::HandleRendererProcessCrash() {
   content::GetUIThreadTaskRunner({})->PostTask(FROM_HERE,
       base::BindOnce(&EWebView::InvokeWebProcessCrashedCallback,
@@ -2733,24 +2853,29 @@ void EWebView::InitializeContent() {
           << "Aborting execution ...";
     }
   }
+
   web_contents_delegate_.reset(new WebContentsDelegateEfl(this));
   web_contents_->SetDelegate(web_contents_delegate_.get());
+
+  // EWebView's delegate. Calls to WebContentsImplEfl and
+  // WebContentsViewAuraHelperEfl are delegated to this class.
+  // For more details, refer commit message of patch 301647.
+  webview_delegate_.reset(new WebViewDelegateEfl(this));
   WebContentsImplEfl* wc_efl =
       static_cast<WebContentsImplEfl*>(web_contents_.get());
-  wc_efl->SetEflDelegate(new WebContentsEflDelegateEwk(this));
-  wcva()->wcva_helper()->SetEflDelegate(wc_efl->GetEflDelegate());
+  wc_efl->SetWebviewDelegate(webview_delegate_.get());
+  wcva()->wcva_helper()->SetWebviewDelegate(webview_delegate_.get());
 
   back_forward_list_.reset(new _Ewk_Back_Forward_List(web_contents_.get()));
 
-  permission_popup_manager_.reset(new PermissionPopupManager(evas_object_));
+  permission_popup_manager_.reset(new PermissionPopupManager(ewk_view_));
   gin_native_bridge_dispatcher_host_.reset(
       new content::GinNativeBridgeDispatcherHost(web_contents_.get()));
 
-  native_view_ =
-      static_cast<WebContentsImplEfl*>(web_contents_.get())->GetEflNativeView();
-  evas_object_smart_member_add(native_view_, evas_object_);
-  static_cast<WebContentsImpl*>(web_contents_.get())
-      ->set_ewk_view(evas_object_);
+  efl_main_layout_ =
+      static_cast<WebContentsImplEfl*>(web_contents_.get())->GetEflMainLayout();
+  evas_object_smart_member_add(efl_main_layout_, ewk_view_);
+  static_cast<WebContentsImpl*>(web_contents_.get())->set_ewk_view(ewk_view_);
   InitializeWindowTreeHost();
 }
 
@@ -2791,7 +2916,7 @@ void EWebView::InitializeWindowTreeHost() {
 
   int x, y, width, height;
   Ecore_Evas* ee =
-      ecore_evas_ecore_evas_get(evas_object_evas_get(native_view_));
+      ecore_evas_ecore_evas_get(evas_object_evas_get(efl_main_layout_));
   ecore_evas_geometry_get(ee, &x, &y, &width, &height);
 
   gfx::Rect bounds(x, y, width, height);
@@ -2821,71 +2946,6 @@ void EWebView::InitializeWindowTreeHost() {
     host_view->SetSize(bounds.size());
 }
 
-#if BUILDFLAG(IS_TIZEN) && !defined(EWK_BRINGUP)
-void EWebView::cameraResultCb(service_h request,
-                              service_h reply,
-                              service_result_e result,
-                              void* data) {
-  if (!IsMobileProfile() && !IsWearableProfile())
-    return;
-
-  EWebView* webview = static_cast<EWebView*>(data);
-  RenderViewHost* render_view_host =
-      webview->web_contents_->GetRenderViewHost();
-  if (result == SERVICE_RESULT_SUCCEEDED) {
-    int ret = -1;
-    char** filesarray;
-    int number;
-    ret = service_get_extra_data_array(reply, SERVICE_DATA_SELECTED,
-                                       &filesarray, &number);
-    if (filesarray) {
-      for (int i = 0; i < number; i++) {
-        std::vector<ui::SelectedFileInfo> files;
-        if (!render_view_host) {
-          return;
-        }
-        if (filesarray[i]) {
-          GURL url(filesarray[i]);
-          if (!url.is_valid()) {
-            base::FilePath path(url.SchemeIsFile() ? url.path()
-                                                   : filesarray[i]);
-            files.push_back(ui::SelectedFileInfo(path, base::FilePath()));
-          }
-        }
-        render_view_host->FilesSelectedInChooser(files,
-                                                 webview->filechooser_mode_);
-      }
-    }
-  } else {
-    std::vector<ui::SelectedFileInfo> files;
-    if (render_view_host) {
-      render_view_host->FilesSelectedInChooser(files,
-                                               webview->filechooser_mode_);
-    }
-  }
-}
-
-bool EWebView::LaunchCamera(std::u16string mimetype) {
-  service_h svcHandle = 0;
-  if (service_create(&svcHandle) < 0 || !svcHandle) {
-    LOG(ERROR) << __FUNCTION__ << " Service Creation Failed ";
-    return false;
-  }
-  service_set_operation(svcHandle, SERVICE_OPERATION_CREATE_CONTENT);
-  service_set_mime(svcHandle, UTF16ToUTF8(mimetype).c_str());
-  service_add_extra_data(svcHandle, "CALLER", "Browser");
-
-  int ret = service_send_launch_request(svcHandle, cameraResultCb, this);
-  if (ret != SERVICE_ERROR_NONE) {
-    LOG(ERROR) << __FUNCTION__ << " Service Launch Failed ";
-    service_destroy(svcHandle);
-    return false;
-  }
-  service_destroy(svcHandle);
-  return true;
-}
-#endif
-
 void EWebView::UrlRequestSet(
     const char* url,
     content::NavigationController::LoadURLType loadtype,
@@ -2937,13 +2997,16 @@ void EWebView::EnableVideoHoleSupport() {
 void EWebView::EnableVideoHoleSupportInternal() {
   if (settings_->getPreferences().video_hole_enabled)
     return;
+
   settings_->getPreferences().video_hole_enabled = true;
-  UpdateWebKitPreferences();
+  WebContentsImpl* wc = static_cast<WebContentsImpl*>(web_contents_.get());
+  if (wc)
+    wc->EnableVideoHole();
 }
 #endif
 
 bool EWebView::HandleShow() {
-  if (!native_view_)
+  if (!efl_main_layout_)
     return false;
 
   Show();
@@ -2951,7 +3014,7 @@ bool EWebView::HandleShow() {
 }
 
 bool EWebView::HandleHide() {
-  if (!native_view_)
+  if (!efl_main_layout_)
     return false;
 
   Hide();
@@ -2959,13 +3022,13 @@ bool EWebView::HandleHide() {
 }
 
 bool EWebView::HandleMove(int x, int y) {
-  if (!native_view_)
+  if (!efl_main_layout_)
     return false;
-  evas_object_move(native_view_, x, y);
-
-#if defined(TIZEN_VIDEO_HOLE) && !defined(EWK_BRINGUP)
+  evas_object_move(efl_main_layout_, x, y);
+  LOG(INFO) << "Move x " << x << " y " << y;
+#if defined(TIZEN_VIDEO_HOLE)
   if (rwhva())
-    rwhva()->offscreen_helper()->DidMoveWebView();
+    rwhva()->DidMoveWebView();
 #endif
 
   if (context_menu_)
@@ -2975,9 +3038,15 @@ bool EWebView::HandleMove(int x, int y) {
 }
 
 bool EWebView::HandleResize(int width, int height) {
-  if (!native_view_)
+  if (!efl_main_layout_)
     return false;
-  evas_object_resize(native_view_, width, height);
+  evas_object_resize(efl_main_layout_, width, height);
+
+#if defined(TIZEN_VIDEO_HOLE)
+  LOG(INFO) << __func__ << " new size " << width << "*" << height;
+  if (rwhva())
+    rwhva()->DidMoveWebView();
+#endif
 
   if (select_picker_) {
     AdjustViewPortHeightToPopupMenu(true /* is_popup_menu_visible */);
@@ -2987,7 +3056,7 @@ bool EWebView::HandleResize(int width, int height) {
 #if defined(USE_AURA) && BUILDFLAG(IS_TIZEN_TV)
   if (host_) {
     int x, y;
-    evas_object_geometry_get(native_view_, &x, &y, nullptr, nullptr);
+    evas_object_geometry_get(efl_main_layout_, &x, &y, nullptr, nullptr);
     gfx::Rect bounds(x, y, width, height);
     host_->SetBoundsInPixels(bounds);
   }
@@ -3059,6 +3128,11 @@ void EWebView::SendDelayedMessages(RenderViewHost* render_view_host) {
     return;
   }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  if (pending_setfocus_closure_)
+    std::move(pending_setfocus_closure_).Run();
+#endif
+
   for (auto iter = delayed_messages_.begin(); iter != delayed_messages_.end();
        ++iter) {
     IPC::Message* message = *iter;
@@ -3112,7 +3186,7 @@ void EWebView::InvokeMainFrameScrollbarVisibleCallback(int callback_id,
     return;
 
   main_frame_scrollbar_visible_callback_map_.Remove(callback_id);
-  callback->Run(evas_object(), visible);
+  callback->Run(ewk_view(), visible);
   main_frame_scrollbar_visible_callback_map_.Remove(callback_id);
 }
 
@@ -3140,7 +3214,7 @@ void EWebView::SetDidChangeThemeColorCallback(
 }
 
 void EWebView::DidChangeThemeColor(const SkColor& color) {
-  did_change_theme_color_callback_.Run(evas_object_, color);
+  did_change_theme_color_callback_.Run(ewk_view_, color);
 }
 
 #if BUILDFLAG(IS_TIZEN_TV)
@@ -3150,13 +3224,48 @@ void EWebView::DrawLabel(Evas_Object* image, Eina_Rectangle rect) {
 }
 
 void EWebView::DeactivateAtk(bool deactivated) {
+#if defined(TIZEN_ATK_SUPPORT)
   EWebAccessibilityUtil::GetInstance()->Deactivate(deactivated);
+#endif
 }
 
 void EWebView::ClearLabels() {
   if (rwhva())
     rwhva()->offscreen_helper()->ClearLabels();
 }
+
+void EWebView::SetTranslatedURL(const char* url) {
+  if (!rwhva() || !rwhva()->aura_efl_helper())
+    return;
+  rwhva()->aura_efl_helper()->SetTranslatedURL(std::string(url));
+  LOG(INFO) << "translate_url:" << url;
+}
+
+bool EWebView::IsVideoPlaying(Ewk_Is_Video_Playing_Callback callback,
+                              void* user_data) {
+  IsVideoPlayingCallback* cb = new IsVideoPlayingCallback(callback, user_data);
+  int callback_id = is_video_playing_callback_map_.Add(cb);
+
+  if (!rwhva() || !rwhva()->aura_efl_helper()) {
+    LOG(ERROR) << "rwhva() or rwhva()->aura_efl_helper() is false";
+    return false;
+  }
+  rwhva()->aura_efl_helper()->RequestVideoPlaying(callback_id);
+  return true;
+}
+
+void EWebView::InvokeIsVideoPlayingCallback(bool is_playing, int callback_id) {
+  IsVideoPlayingCallback* callback =
+      is_video_playing_callback_map_.Lookup(callback_id);
+  if (!callback) {
+    LOG(INFO) << "callback is null";
+    return;
+  }
+
+  LOG(INFO) << __func__ << " ; is_playing : " << is_playing;
+  callback->Run(ewk_view(), is_playing);
+  is_video_playing_callback_map_.Remove(callback_id);
+}
 #endif
 
 void EWebView::RequestManifest(Ewk_View_Request_Manifest_Callback callback,
@@ -3168,7 +3277,7 @@ void EWebView::DidRespondRequestManifest(
     _Ewk_View_Request_Manifest* manifest,
     Ewk_View_Request_Manifest_Callback callback,
     void* user_data) {
-  callback(evas_object_, manifest, user_data);
+  callback(ewk_view_, manifest, user_data);
 }
 
 void EWebView::SetSessionTimeout(uint64_t timeout) {
@@ -3198,11 +3307,8 @@ EwkExtensionSystemDelegate* EWebView::GetExtensionDelegate() {
   if (!render_frame_host)
     return nullptr;
 
-  ExtensionSystemDelegateManager::RenderFrameID id;
-  id.render_process_id = render_frame_host->GetProcess()->GetID();
-  id.render_frame_id = render_frame_host->GetRoutingID();
   return static_cast<EwkExtensionSystemDelegate*>(
-      ExtensionSystemDelegateManager::GetInstance()->GetDelegateForFrame(id));
+      ExtensionSystemDelegateManager::GetInstance()->GetDelegateForFrame(render_frame_id_));
 }
 
 void EWebView::SetWindowId() {
@@ -3246,13 +3352,12 @@ void EWebView::RegisterPepperExtensionDelegate() {
     return;
   }
 
-  ExtensionSystemDelegateManager::RenderFrameID id;
-  id.render_process_id = render_frame_host->GetProcess()->GetID();
-  id.render_frame_id = render_frame_host->GetRoutingID();
+  render_frame_id_.render_process_id = render_frame_host->GetProcess()->GetID();
+  render_frame_id_.render_frame_id = render_frame_host->GetRoutingID();
 
   EwkExtensionSystemDelegate* delegate = new EwkExtensionSystemDelegate;
   ExtensionSystemDelegateManager::GetInstance()->RegisterDelegate(
-      id, std::unique_ptr<EwkExtensionSystemDelegate>{delegate});
+      render_frame_id_, std::unique_ptr<EwkExtensionSystemDelegate>{delegate});
 }
 
 void EWebView::UnregisterPepperExtensionDelegate() {
@@ -3260,17 +3365,7 @@ void EWebView::UnregisterPepperExtensionDelegate() {
     LOG(WARNING) << "web_contents_ is nullptr, can't unregister delegate";
     return;
   }
-  RenderFrameHost* render_frame_host = web_contents_->GetPrimaryMainFrame();
-  if (!render_frame_host) {
-    LOG(WARNING) << "render_frame_host is nullptr, can't unregister delegate";
-    return;
-  }
-
-  ExtensionSystemDelegateManager::RenderFrameID id;
-  id.render_process_id = render_frame_host->GetProcess()->GetID();
-  id.render_frame_id = render_frame_host->GetRoutingID();
-
-  if (!ExtensionSystemDelegateManager::GetInstance()->UnregisterDelegate(id))
+  if (!ExtensionSystemDelegateManager::GetInstance()->UnregisterDelegate(render_frame_id_))
     LOG(WARNING) << "Unregistering pepper extension delegate failed";
 }
 #endif  // defined(TIZEN_PEPPER_EXTENSIONS)
@@ -3302,7 +3397,7 @@ void EWebView::InvokeExceededIndexedDatabaseQuotaCallback(
   CHECK(!exceeded_indexed_db_quota_origin_.get());
   exceeded_indexed_db_quota_origin_.reset(new Ewk_Security_Origin(origin));
   exceeded_indexed_db_quota_callback_.Run(
-      evas_object_, exceeded_indexed_db_quota_origin_.get(), current_quota);
+      ewk_view_, exceeded_indexed_db_quota_origin_.get(), current_quota);
 }
 
 void EWebView::ExceededIndexedDatabaseQuotaReply(bool allow) {
@@ -3341,6 +3436,116 @@ void EWebView::AddDynamicCertificatePath(const std::string& host,
                                          const std::string& cert_path) {
   web_contents_->AddDynamicCertificatePath(host, cert_path);
 }
+
+void EWebView::NotifySubtitleState(int state, double time_stamp) {
+  LOG(INFO) << "subtitle state: " << state
+            << ",(0-Play : 1-Pause : 2-SeekStart : 3-SeekComplete : 4-Stop "
+               ":5-Resume)";
+  switch (state) {
+    case blink::WebMediaPlayer::kSubtitlePause:
+      SmartCallback<EWebViewCallbacks::SubtitlePause>().call();
+      break;
+    case blink::WebMediaPlayer::kSubtitleStop:
+      SmartCallback<EWebViewCallbacks::SubtitleStop>().call();
+      break;
+    case blink::WebMediaPlayer::kSubtitleResume:
+      SmartCallback<EWebViewCallbacks::SubtitleResume>().call();
+      break;
+    case blink::WebMediaPlayer::kSubtitleSeekStart: {
+      double ts = time_stamp;
+      SmartCallback<EWebViewCallbacks::SubtitleSeekStart>().call(&ts);
+    } break;
+    case blink::WebMediaPlayer::kSubtitleSeekComplete:
+      SmartCallback<EWebViewCallbacks::SubtitleSeekComplete>().call();
+      break;
+    default:
+      NOTREACHED();
+      break;
+  }
+}
+
+void EWebView::NotifySubtitlePlay(int active_track_id,
+                                  const char* url,
+                                  const char* lang) {
+  LOG(INFO) << "id:" << active_track_id << ",url:" << url << ",lang:" << lang;
+  Ewk_Media_Subtitle_Info* subtitle_info =
+      ewkMediaSubtitleInfoCreate(active_track_id, url, lang, 0);
+  SmartCallback<EWebViewCallbacks::SubtitlePlay>().call(
+      static_cast<void*>(subtitle_info));
+  ewkMediaSubtitleInfoDelete(subtitle_info);
+}
+
+void EWebView::NotifySubtitleData(int track_id,
+                                  double time_stamp,
+                                  const std::string& data,
+                                  unsigned int size) {
+  const void* buffer = static_cast<const void*>(data.c_str());
+  Ewk_Media_Subtitle_Data* subtitle_data =
+      ewkMediaSubtitleDataCreate(track_id, time_stamp, buffer, size);
+  SmartCallback<EWebViewCallbacks::SubtitleNotifyData>().call(
+      static_cast<void*>(subtitle_data));
+  ewkMediaSubtitleDataDelete(subtitle_data);
+}
+
+void EWebView::UpdateCurrentTime(double current_time) {
+  current_time_ = current_time;
+}
+
+void EWebView::UpdateEventData(void* data) {
+  LOG(INFO) << "EWebView::UpdateEventData data:" << (char*)data;
+  SmartCallback<EWebViewCallbacks::EVENTData>().call(data);
+}
+
+void EWebView::NotifyParentalRatingInfo(const char* info, const char* url) {
+  LOG(INFO) << "info:" << info << ",url:" << url;
+  Ewk_Media_Parental_Rating_Info* data =
+      ewkMediaParentalRatingInfoCreate(info, url);
+  SmartCallback<EWebViewCallbacks::ParentalRatingInfo>().call(
+      static_cast<void*>(data));
+  ewkMediaParentalRatingInfoDelete(data);
+}
+
+void EWebView::SetParentalRatingResult(const char* url, bool is_pass) {
+  LOG(INFO) << "SetParentalRatingResult,url:" << url
+            << ",pass:" << std::boolalpha << is_pass;
+
+  if (!rwhva() || !rwhva()->aura_efl_helper()){
+    LOG(ERROR) << "rwhva() or rwhva()->aura_efl_helper() is false";
+    return;
+  }
+  rwhva()->aura_efl_helper()->SetParentalRatingResult(
+      static_cast<std::string>(url), is_pass);
+}
+void EWebView::NotifyFirstTimeStamp(unsigned long long timestamp,
+                                    int time_base_num,
+                                    int time_base_den) {
+  Ewk_First_Timestamp_Info* info =
+      ewkFirstTimeStampInfoCreate(timestamp, time_base_num, time_base_den);
+  SmartCallback<EWebViewCallbacks::FirstTimestamp>().call(
+      static_cast<void*>(info));
+  ewkFirstTimeStampInfoDelete(info);
+}
+
+void EWebView::NotifyPESData(const std::string& buf,
+                             unsigned int len,
+                             int media_position) {
+  const void* data = static_cast<const void*>(buf.c_str());
+  Ewk_PES_Info* info = ewkPESInfoCreate(data, len, media_position);
+  SmartCallback<EWebViewCallbacks::PESData>().call(static_cast<void*>(info));
+  ewkPESInfoDelete(info);
+}
+
+void EWebView::SetPreferSubtitleLang(const char* lang_list) {
+  LOG(INFO) << "SetPreferSubtitleLang: " << lang_list;
+  const std::string lang(lang_list ? lang_list : "");
+
+  if (!rwhva()) {
+    LOG(ERROR) << "rwhva() is null";
+    return;
+  }
+
+  rwhva()->aura_efl_helper()->SetPreferSubtitleLang(lang);
+}
 #endif
 
 bool EWebView::SetVisibility(bool enable) {
@@ -3398,7 +3603,9 @@ void EWebView::UpdateAccessibilityStatus(Eina_Bool enable) {
 }
 
 void EWebView::InitAtk() {
+#if defined(TIZEN_ATK_SUPPORT)
   EWebAccessibilityUtil::GetInstance()->ToggleAtk(lazy_initialize_atk_);
+#endif
 }
 
 /* LCOV_EXCL_START */
@@ -3417,4 +3624,157 @@ bool EWebView::SetMixedContents(bool allow) {
       MixedContentObserver::FromWebContents(web_contents_.get());
   return mixed_content_observer->MixedContentReply(allow);
 }
+
+void EWebView::NotifyDownloadableFontInfo(const char* scheme_id_uri,
+                                          const char* value,
+                                          const char* data,
+                                          int type) {
+  LOG(INFO) << "scheme_id_uri:" << scheme_id_uri << ",value:" << value
+            << ",data:" << data << ",type:" << type;
+  Ewk_Media_Downloadable_Font_Info* info =
+      ewkMediaDownloadableFontInfoCreate(scheme_id_uri, value, data, type);
+  SmartCallback<EWebViewCallbacks::DownloadableFontInfo>().call(
+      static_cast<void*>(info));
+  ewkMediaDownloadableFontInfoDelete(info);
+}
+
+std::vector<std::string> EWebView::NotifyPlaybackState(int state,
+                                                       int player_id,
+                                                       const char* url,
+                                                       const char* mime_type) {
+  std::vector<std::string> data;
+  Ewk_Media_Playback_Info* playback_info =
+      ewkMediaPlaybackInfoCreate(player_id, url, mime_type);
+
+  LOG(INFO)
+      << "player_id:" << player_id << ",state: " << state
+      << "(0-load : 1-videoready : 2-ready : 3-start : 4-finish : 5-stop)";
+  switch (state) {
+    case kPlaybackLoad:
+      SmartCallback<EWebViewCallbacks::PlaybackLoad>().call(
+          static_cast<void*>(playback_info));
+      break;
+    case kPlaybackReady:
+      SmartCallback<EWebViewCallbacks::PlaybackReady>().call(
+          static_cast<void*>(playback_info));
+      break;
+    case kPlaybackStart:
+      SmartCallback<EWebViewCallbacks::PlaybackStart>().call(
+          static_cast<void*>(playback_info));
+      break;
+    case kPlaybackFinish:
+      SmartCallback<EWebViewCallbacks::PlaybackFinish>().call(
+          static_cast<void*>(playback_info));
+      break;
+    case kPlaybackStop:
+      SmartCallback<EWebViewCallbacks::PlaybackStop>().call(
+          static_cast<void*>(playback_info));
+      break;
+    default:
+      NOTREACHED();
+      data.push_back("");
+      ewkMediaPlaybackInfoDelete(playback_info);
+      return data;
+  }
+
+  bool media_resource_acquired =
+      ewk_media_playback_info_media_resource_acquired_get(playback_info)
+          ? true
+          : false;
+  data.push_back(media_resource_acquired ? "mediaResourceAcquired" : "");
+  const char* translated_url =
+      ewk_media_playback_info_translated_url_get(playback_info);
+  data.push_back(translated_url ? std::string(translated_url) : "");
+  const char* drm_info = ewk_media_playback_info_drm_info_get(playback_info);
+  data.push_back(drm_info ? std::string(drm_info) : "");
+
+  LOG(INFO) << "evasObject: " << ewk_view_
+            << ", media_resource_acquired :" << media_resource_acquired
+            << ", translated_url:" << translated_url
+            << ", drm_info:" << drm_info;
+  ewkMediaPlaybackInfoDelete(playback_info);
+  return data;
+}
+
+void EWebView::NotifyMediaStateChanged(uint32_t device_type,
+                                       uint32_t previous,
+                                       uint32_t current) {
+  LOG(INFO) << "NotifyMediaStateChanged type : " << device_type
+            << " ;previous: " << previous << " ; current: " << current;
+  Ewk_User_Media_State_Info* user_media_state_info =
+      new _Ewk_User_Media_State_Info;
+  user_media_state_info->device_type =
+      static_cast<Ewk_User_Media_Device_Type>(device_type);
+  user_media_state_info->previous_state = previous;
+  user_media_state_info->current_state = current;
+  SmartCallback<EWebViewCallbacks::UserMediaState>().call(
+      static_cast<void*>(user_media_state_info));
+
+  delete user_media_state_info;
+}
+
+void EWebView::SetHighBitRate(Eina_Bool high_bitrate) {
+  LOG(INFO) << "high_bitrate: " << std::boolalpha << high_bitrate;
+  is_high_bitrate_ = high_bitrate;
+}
+
+void EWebView::OnDeviceListed(const MediaDeviceEnumeration& devices) {
+  int device_count = 0;
+  EwkMediaDeviceInfo* device_list = nullptr;
+  for (const auto& device : devices)
+    device_count += device.size();
+
+  device_list =
+      (EwkMediaDeviceInfo*)malloc(sizeof(EwkMediaDeviceInfo) * device_count);
+  if (!device_list) {
+    LOG(ERROR) << "malloc EwkMediaDeviceInfo failed";
+    device_cb_.Run(device_list, 0);
+    return;
+  }
+
+  int idx = 0;
+  for (int i = 0; i < NUM_MEDIA_DEVICE_TYPES; i++) {
+    blink::WebMediaDeviceInfoArray array = devices[i];
+    for (const auto& device : array) {
+      LOG(INFO) << "OnDeviceListed type:" << i
+                << ",device_id:" << device.device_id
+                << ",lable:" << device.label;
+
+      // convert device info to ewk structure
+      EwkMediaDeviceInfo* data = &device_list[idx++];
+      data->device_id = eina_stringshare_add(device.device_id.c_str());
+      data->label = eina_stringshare_add(device.label.c_str());
+      data->type = static_cast<EwkMediaDeviceType>(i);
+      data->connected = true;
+    }
+  }
+
+  device_cb_.Run(device_list, device_count);
+
+  // free data
+  for (int i = 0; i < device_count; i++) {
+    EwkMediaDeviceInfo* device = &device_list[i];
+    if (device->device_id)
+      eina_stringshare_del(device->device_id);
+    if (device->label)
+      eina_stringshare_del(device->label);
+  }
+  if (device_list) {
+    free(device_list);
+    device_list = NULL;
+  }
+}
+
+void EWebView::GetMediaDeviceList(Ewk_Media_Device_List_Get_Callback callback,
+                                  void* userData) {
+  if (!web_contents_delegate_) {
+    LOG(ERROR) << "no web_contents_delegate_";
+    return;
+  }
+
+  device_cb_.Set(callback, userData);
+
+  web_contents_delegate_->GetMediaDeviceList(
+      base::BindOnce(&EWebView::OnDeviceListed, weak_factory_.GetWeakPtr()));
+}
 #endif