[M67 Dev][EWK] Classify EWK APIs by public, internal, or product
[platform/framework/web/chromium-efl.git] / tizen_src / ewk / efl_integration / public / ewk_view.cc
index fb4ebf3..3b95f8e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2009-2010 ProFUSION embedded systems
- * Copyright (C) 2009-2013 Samsung Electronics
+ * Copyright (C) 2009-2014 Samsung Electronics. All rights reserved.
  * Copyright (C) 2012 Intel Corporation
  *
  * This library is free software; you can redistribute it and/or
@@ -8,51 +8,60 @@
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Library General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public License
- * along with this program; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
  */
 
-#include "ewk_view.h"
+#include "ewk_view_product.h"
 
 #include <Evas.h>
-#include <tizen_webview/public/tw_webview.h>
 
-// TODO: remove dependency
-#include <ui/events/gestures/gesture_configuration.h>
-#if !defined(EWK_BRINGUP)
-#include <webkit/common/webpreferences.h>
+#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
+#include "webkit/common/webpreferences.h"
 #else
-#include <content/public/common/web_preferences.h>
+#include "content/public/common/web_preferences.h"
 #endif
-#include <../impl/eweb_view.h>
-#include <../impl/web_contents_delegate_efl.h>
-#include <../impl/cookie_manager.h>
-
+#include "content/public/browser/navigation_controller.h"
+#include "cookie_manager.h"
+#include "eweb_view.h"
+#include "geolocation_permission_popup.h"
+#include "notification_permission_popup.h"
 #include "public/ewk_back_forward_list.h"
 #include "public/ewk_context.h"
-#include "public/ewk_enums.h"
+#include "public/ewk_enums_internal.h"
 #include "public/ewk_settings.h"
 #include "private/ewk_context_private.h"
+#include "private/ewk_frame_private.h"
 #include "private/ewk_hit_test_private.h"
 #include "private/ewk_notification_private.h"
 #include "private/ewk_private.h"
-#if !defined(EWK_BRINGUP)
 #include "private/ewk_quota_permission_request_private.h"
+#include "private/ewk_back_forward_list_private.h"
 #include "private/ewk_history_private.h"
-#endif
-#include "private/ewk_view_private.h"
-#include "private/chromium_glue.h"
 #include "private/ewk_view_private.h"
+// FIXME: removed on m63
+//#include "third_party/blink/public/web/WebViewModeEnums.h"
+#include "ui/events/gesture_detection/gesture_configuration.h"
+#include "url/gurl.h"
+#include "usermedia_permission_popup.h"
+#include "web_contents_delegate_efl.h"
 
-using tizen_webview::WebView;
-using tizen_webview::WebContext;
+static Eina_Bool _ewk_view_default_user_media_permission(
+    Evas_Object*, Ewk_User_Media_Permission_Request*, void*);
+
+static Eina_Bool _ewk_view_default_geolocation_permission(
+    Evas_Object*, Ewk_Geolocation_Permission_Request*, void*);
+
+static Eina_Bool _ewk_view_default_notification_permission(
+    Evas_Object*, Ewk_Notification_Permission_Request*, void*);
 
 Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api)
 {
@@ -66,16 +75,11 @@ Evas_Object* ewk_view_add_with_session_data(Evas* canvas, const char* data, unsi
 {
   EINA_SAFETY_ON_NULL_RETURN_VAL(canvas, NULL);
 
-  if (!length)
-    return NULL;
-
-  EINA_SAFETY_ON_NULL_RETURN_VAL(data, NULL);
-
   Evas_Object* ret = ewk_view_add(canvas);
 
-  WebView *webView = GetWebViewFromEvasObject(ret);
+  EWebView *webView = GetWebViewFromEvasObject(ret);
 
-  if (!webView)
+  if (!webView || !data || !length)
     return ret;
 
   if (webView->RestoreFromSessionData(data, length))
@@ -89,11 +93,23 @@ Evas_Object* ewk_view_add_with_session_data(Evas* canvas, const char* data, unsi
 Evas_Object* ewk_view_add_with_context(Evas* e, Ewk_Context* context)
 {
   EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
-  return CreateWebViewAsEvasObject(context, e);
+  Evas_Object* ewk_view = CreateWebViewAsEvasObject(context, e);
+
+  if (ewk_view) {
+    ewk_view_user_media_permission_callback_set(ewk_view,
+        _ewk_view_default_user_media_permission, 0);
+    ewk_view_geolocation_permission_callback_set(ewk_view,
+        _ewk_view_default_geolocation_permission, 0);
+    ewk_view_notification_permission_callback_set(ewk_view,
+        _ewk_view_default_notification_permission, 0);
+  }
+
+  return ewk_view;
 }
 
 Evas_Object* ewk_view_add(Evas* e)
 {
+  EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL);
   // TODO: shouldn't this function create new EWebContext for each new EWebView?
   // when using default context like that it makes unclear who should release
   // default web context. It won't be released by destroyed eweb_view because
@@ -102,16 +118,24 @@ Evas_Object* ewk_view_add(Evas* e)
   return ewk_view_add_with_context(e, context);
 }
 
+Evas_Object* ewk_view_add_in_incognito_mode(Evas* e)
+{
+  Ewk_Context* context = Ewk_Context::Create(true);
+  EINA_SAFETY_ON_NULL_RETURN_VAL(context, NULL);
+  return ewk_view_add_with_context(e, context);
+}
+
 Ewk_Context *ewk_view_context_get(const Evas_Object *view)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
-  return static_cast<Ewk_Context*>(impl->GetWebContext());
+  return static_cast<Ewk_Context*>(impl->context());
 }
 
-Eina_Bool ewk_view_url_set(Evas_Object* view, const char* url)
+Eina_Bool ewk_view_url_set(Evas_Object* view, const char* url_string)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
-  EINA_SAFETY_ON_NULL_RETURN_VAL(url, false);
+  EINA_SAFETY_ON_NULL_RETURN_VAL(url_string, false);
+  GURL url(url_string);
   impl->SetURL(url);
   return true;
 }
@@ -119,7 +143,7 @@ Eina_Bool ewk_view_url_set(Evas_Object* view, const char* url)
 const char* ewk_view_url_get(const Evas_Object* view)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
-  return impl->GetURL();
+  return impl->GetURL().possibly_invalid_spec().c_str();
 }
 
 
@@ -134,7 +158,7 @@ Eina_Bool ewk_view_reload(Evas_Object *view)
 Eina_Bool ewk_view_reload_bypass_cache(Evas_Object *view)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
-  impl->ReloadIgnoringCache();
+  impl->ReloadBypassingCache();
   return true;
 }
 
@@ -258,9 +282,7 @@ Eina_Bool ewk_view_text_zoom_set(Evas_Object* view, double text_zoom_level)
 void ewk_view_not_found_error_page_load(Evas_Object* ewkView, const char* errorUrl)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
-  std::string errorhtml = impl->GetErrorPage(std::string(errorUrl));
-
-   ewk_view_html_string_load(ewkView, errorhtml.c_str(), errorUrl, errorUrl);
+  impl->LoadNotFoundErrorPage(std::string(errorUrl));
 }
 
 void ewk_view_scale_range_get(Evas_Object* view, double* min_scale, double* max_scale)
@@ -288,27 +310,20 @@ Eina_Bool ewk_view_url_request_set(Evas_Object* ewkView, const char* url, Ewk_Ht
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(url, EINA_FALSE);
-  std::string str_method;
+  content::NavigationController::LoadURLType loadtype;
   switch (method) {
   case EWK_HTTP_METHOD_GET:
-    str_method = "GET";
-    break;
-  case EWK_HTTP_METHOD_HEAD:
-    str_method = "HEAD";
+    loadtype = content::NavigationController::LOAD_TYPE_DEFAULT;
     break;
   case EWK_HTTP_METHOD_POST:
-    str_method = "POST";
-    break;
-  case EWK_HTTP_METHOD_PUT:
-    str_method = "PUT";
-    break;
-  case EWK_HTTP_METHOD_DELETE:
-    str_method = "DELETE";
+    loadtype = content::NavigationController::LOAD_TYPE_HTTP_POST;
     break;
   default:
+    LOG(ERROR) << "Not supported HTTP Method.";
     return EINA_FALSE;
   }
-  impl->UrlRequestSet(url, str_method, headers, body);
+
+  impl->UrlRequestSet(url, loadtype, headers, body);
   return EINA_TRUE;
 }
 
@@ -335,27 +350,30 @@ Eina_Bool ewk_view_html_contents_set(Evas_Object* view, const char* html, const
 
 Eina_Bool ewk_view_page_visibility_state_set(Evas_Object* ewkView, Ewk_Page_Visibility_State page_visibility_state, Eina_Bool initial_state)
 {
-  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl,false);
+  // TODO: Should we send initial_state to |Page::setVisibilityState()|?.
+  // isInitialState parameter seems be true only in the constructor of WebViewImpl.
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
+
+  // TODO: We should able to set 'prerender' or 'unloaded' as visibility state.
+  // http://www.w3.org/TR/page-visibility/#dom-document-visibilitystate
   switch (page_visibility_state) {
-    case EWK_PAGE_VISIBILITY_STATE_VISIBLE :
+    case EWK_PAGE_VISIBILITY_STATE_VISIBLE:
       impl->Show();
       break;
-    case EWK_PAGE_VISIBILITY_STATE_HIDDEN :
+    case EWK_PAGE_VISIBILITY_STATE_HIDDEN:
       impl->Hide();
       break;
     default:
-      break;
+      return EINA_FALSE;
   }
-  return true;
+  return EINA_TRUE;
 }
 
 Eina_Bool ewk_view_user_agent_set(Evas_Object* ewkView, const char* user_agent)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
-  EINA_SAFETY_ON_NULL_RETURN_VAL(user_agent, false);
-  if (0 != strcmp(user_agent, "")) //check for empty string
-    return impl->SetUserAgent(user_agent);
-  return false;
+
+  return impl->SetUserAgent(user_agent);
 }
 
 const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
@@ -367,16 +385,13 @@ const char* ewk_view_user_agent_get(const Evas_Object* ewkView)
 Eina_Bool ewk_view_application_name_for_user_agent_set(Evas_Object* ewkView, const char* application_name)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
-  EINA_SAFETY_ON_NULL_RETURN_VAL(application_name, false);
-  if (0 != strcmp(application_name, "")) //check for empty string
-    return impl->SetUserAgentAppName(application_name);
-  return false;
+  return impl->SetUserAgentAppName(application_name);
 }
 
 const char* ewk_view_application_name_for_user_agent_get(const Evas_Object* ewkView)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
-  return impl->GetUserAgentAppName();
+  return eina_stringshare_add(impl->GetUserAgentAppName());
 }
 
 Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* name, const char* value)
@@ -384,24 +399,24 @@ Eina_Bool ewk_view_custom_header_add(const Evas_Object* ewkView, const char* nam
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(value, EINA_FALSE);
-  EINA_SAFETY_ON_NULL_RETURN_VAL(impl->GetWebContext(),EINA_FALSE);
-  return impl->GetWebContext()->HTTPCustomHeaderAdd(name, value);
+  EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
+  return impl->context()->HTTPCustomHeaderAdd(name, value);
 }
 
 Eina_Bool ewk_view_custom_header_remove(const Evas_Object* ewkView, const char* name)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(name, EINA_FALSE);
-  EINA_SAFETY_ON_NULL_RETURN_VAL(impl->GetWebContext(),EINA_FALSE);
-  return impl->GetWebContext()->HTTPCustomHeaderRemove(name);
+  EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
+  return impl->context()->HTTPCustomHeaderRemove(name);
 
 }
 
 Eina_Bool ewk_view_custom_header_clear(const Evas_Object* ewkView)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
-  EINA_SAFETY_ON_NULL_RETURN_VAL(impl->GetWebContext(),EINA_FALSE);
-  impl->GetWebContext()->HTTPCustomHeaderClear();
+  EINA_SAFETY_ON_NULL_RETURN_VAL(impl->context(),EINA_FALSE);
+  impl->context()->HTTPCustomHeaderClear();
   return EINA_TRUE;
 }
 
@@ -431,6 +446,20 @@ Evas_Object* ewk_view_screenshot_contents_get(const Evas_Object* view, Eina_Rect
   return impl->GetSnapshot(view_area);
 }
 
+Eina_Bool ewk_view_screenshot_contents_get_async(const Evas_Object* view, Eina_Rectangle view_area,
+        float scale_factor, Evas* canvas, Ewk_Web_App_Screenshot_Captured_Callback callback, void* user_data)
+{
+  EINA_SAFETY_ON_NULL_RETURN_VAL(callback, EINA_FALSE);
+  EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
+  // Zoom level equality (<=0.001) is sufficient compared to high precision std::numeric_value::epsilon.
+  if (!content::ZoomValuesEqual(scale_factor, 1.0)) {
+    LOG(ERROR) << "We only support scale factor of 1.0."
+               << "Scaling option will be supported after hardware acceleration is enabled.";
+    return EINA_FALSE;
+  }
+  return impl->GetSnapshotAsync(view_area, callback, user_data) ? EINA_TRUE : EINA_FALSE;
+}
+
 unsigned int ewk_view_inspector_server_start(Evas_Object* ewkView, unsigned int port)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
@@ -463,8 +492,7 @@ Eina_Bool ewk_view_scroll_pos_get(Evas_Object* ewkView, int* x, int* y)
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
   EINA_SAFETY_ON_NULL_RETURN_VAL(x, EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(y, EINA_FALSE);
-  impl->GetScrollPosition(x, y);
-  return true;
+  return impl->GetScrollPosition(x, y);
 }
 
 Eina_Bool ewk_view_scroll_set(Evas_Object* view, int x, int y)
@@ -477,6 +505,10 @@ Eina_Bool ewk_view_scroll_set(Evas_Object* view, int x, int y)
 
 Eina_Bool ewk_view_scroll_size_get(const Evas_Object* view, int* width, int* height)
 {
+  if (width)
+    *width = 0;
+  if (height)
+    *height = 0;
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
   impl->GetScrollSize(width,height);
   return EINA_TRUE;
@@ -623,54 +655,25 @@ Eina_Bool ewk_view_mhtml_data_get(Evas_Object *view, Ewk_View_MHTML_Data_Get_Cal
 Ewk_Hit_Test* ewk_view_hit_test_new(Evas_Object* ewkView, int x, int y, int hit_test_mode)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
-  return chromium_glue::from(impl->RequestHitTestDataAt(x, y,
-      chromium_glue::to(static_cast<Ewk_Hit_Test_Mode>(hit_test_mode))));
+  return impl->RequestHitTestDataAt(x, y,
+      static_cast<Ewk_Hit_Test_Mode>(hit_test_mode));
 }
 
 Eina_Bool ewk_view_hit_test_request(Evas_Object* o, int x, int y, int hit_test_mode, Ewk_View_Hit_Test_Request_Callback callback, void* user_data)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, EINA_FALSE);
-  return impl->AsyncRequestHitTestDataAt(x, y, chromium_glue::to(static_cast<Ewk_Hit_Test_Mode>(hit_test_mode)), chromium_glue::to(callback), user_data);
+  return impl->AsyncRequestHitTestDataAt(x, y, static_cast<Ewk_Hit_Test_Mode>(hit_test_mode), callback, user_data);
 }
 
-#if !defined(EWK_BRINGUP)
 Ewk_History* ewk_view_history_get(Evas_Object* ewkView)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, NULL);
-  return chromium_glue::from(impl->GetBackForwardList());
+  return impl->GetBackForwardHistory();
 }
-#endif
 
 Eina_Bool ewk_view_notification_closed(Evas_Object* ewkView, Eina_List* notification_list)
 {
-  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
-
-#if !defined(EWK_BRINGUP)
-#warning "[M38] Fix and re-enable notifications (edit efl_integration/public/ewk_view.cc)"
-  // copied from deleted NotificationControllerEfl::RemoveClosedNotifications()
-  if (!eina_list_count(notification_list))
-    return false;
-
-  assert(impl->GetWebContext());
-  assert(impl->GetWebContext()->browser_context());
-  assert(impl->GetWebContext()->browser_context()->GetNotificationController());
-  content::NotificationControllerEfl* controller =
-      impl->GetWebContext()->browser_context()->GetNotificationController();
-
-  Eina_List* notification_iterator = NULL;
-  void* notification_data = NULL;
-  EINA_LIST_FOREACH(notification_list, notification_iterator, notification_data) {
-    Ewk_Notification* notification =
-      static_cast<Ewk_Notification*>(notification_data);
-
-    if (notification) {
-      controller->DeleteNotification(notification->GetID(), true);
-      delete notification;
-    }
-  }
-#endif
-  return true;
-
+  return EINA_FALSE;
 }
 
 Eina_Bool ewk_view_popup_menu_select(Evas_Object* ewkView, unsigned int selectedIndex)
@@ -701,8 +704,7 @@ Eina_Bool ewk_view_popup_menu_multiple_select(Evas_Object* ewkView, Eina_Inarray
 void ewk_view_orientation_send(Evas_Object* ewkView, int orientation)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
-  //send to webview
-  impl->SendOrientationChangeEventIfNeeded(orientation);
+  impl->SetOrientation(orientation);
 }
 
 void ewk_view_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
@@ -729,7 +731,7 @@ Eina_Bool ewk_view_text_selection_range_get(const Evas_Object* view, Eina_Rectan
 Eina_Bool ewk_view_text_selection_clear(Evas_Object *view)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
-  return impl->ClearSelection() ? EINA_TRUE : EINA_FALSE;
+  return impl->ClearSelection();
 }
 
 const char* ewk_view_text_selection_text_get(Evas_Object* view)
@@ -766,9 +768,9 @@ void ewk_view_vertical_panning_hold_set(Evas_Object* view, Eina_Bool hold)
 
 void ewk_view_orientation_lock_callback_set(Evas_Object* ewkView, Ewk_Orientation_Lock_Cb func, void* data)
 {
-  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
-  EINA_SAFETY_ON_NULL_RETURN(func);
-  impl->SetOrientationLockCallback(func, data);
+  LOG_EWK_API_MOCKUP("This API is deprecated, to use orientation lock/unlock "
+      "API please use functions lock_orientation/unlock_orientation provided "
+      "by Ewk_View_Smart_Class.");
 }
 
 
@@ -782,7 +784,7 @@ Eina_Bool ewk_view_feed_touch_event(Evas_Object *view, Ewk_Touch_Event_Type type
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, false);
 
-  impl->HandleTouchEvents(chromium_glue::to(type), points, modifiers);
+  impl->HandleTouchEvents(type, points, modifiers);
 
   return true;
 }
@@ -806,7 +808,7 @@ Eina_Bool ewk_view_touch_events_enabled_get(const Evas_Object *view)
 Ewk_Frame_Ref ewk_view_main_frame_get(Evas_Object* o)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(o, impl, NULL);
-  return impl->GetMainFrame();
+  return static_cast<Ewk_Frame_Ref>(impl->GetMainFrame());
 }
 
 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewkView, Eina_Bool visible)
@@ -819,7 +821,7 @@ void ewk_view_content_security_policy_set(Evas_Object* ewkView, const char* poli
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
   EINA_SAFETY_ON_NULL_RETURN(policy);
-  impl->SetContentSecurityPolicy(policy, chromium_glue::to(type));
+  impl->SetContentSecurityPolicy(policy, type);
 }
 
 void ewk_view_application_cache_permission_callback_set(Evas_Object* ewkView, Ewk_View_Applicacion_Cache_Permission_Callback callback, void* userData)
@@ -864,7 +866,7 @@ Eina_Bool ewk_view_text_find(Evas_Object *view, const char *text, Ewk_Find_Optio
 
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, EINA_FALSE);
   EINA_SAFETY_ON_NULL_RETURN_VAL(text, EINA_FALSE);
-  impl->Find(text, chromium_glue::to(options));
+  impl->Find(text, options);
   return EINA_TRUE;
 }
 
@@ -910,7 +912,88 @@ void ewk_view_intercept_request_callback_set (Evas_Object* ewkView, Ewk_View_Int
 
 void ewk_view_unfocus_allow_callback_set(Evas_Object* ewkView, Ewk_View_Unfocus_Allow_Callback callback, void* user_data)
 {
-  LOG_EWK_API_MOCKUP();
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
+  impl->SetViewUnfocusAllowCallback(callback, user_data);
+}
+
+void ewk_view_geolocation_permission_callback_set(Evas_Object* ewk_view, Ewk_View_Geolocation_Permission_Callback callback, void* user_data)
+{
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
+  impl->SetViewGeolocationPermissionCallback(callback, user_data);
+}
+
+static Eina_Bool _ewk_view_default_geolocation_permission(
+    Evas_Object* ewk_view,
+    Ewk_Geolocation_Permission_Request* request,
+    void* user_data)
+{
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
+
+  std::string value = std::string(ewk_security_origin_host_get(
+      ewk_geolocation_permission_request_origin_get(request)));
+  std::string message = std::string(
+      "Web Page (%s) is requesting permission to access your location.");
+  std::string replace_str = std::string("(%s)");
+
+  size_t pos = message.find(replace_str.c_str());
+  if (pos != std::string::npos)
+    message.replace(pos, replace_str.length(), value.c_str());
+
+  // add for suspending
+  ewk_geolocation_permission_request_suspend(request);
+
+  GeolocationPermissionPopup* popup = new GeolocationPermissionPopup(request,
+      ewk_geolocation_permission_request_origin_get(request), message);
+
+  impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
+
+  return EINA_TRUE;
+}
+
+void ewk_view_user_media_permission_callback_set(Evas_Object* ewk_view,
+    Ewk_View_User_Media_Permission_Callback callback,
+    void* user_data)
+{
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl);
+  impl->SetViewUserMediaPermissionCallback(callback, user_data);
+}
+
+static Eina_Bool _ewk_view_default_user_media_permission(
+    Evas_Object* ewk_view,
+    Ewk_User_Media_Permission_Request* user_media_permission_request,
+    void* user_data)
+{
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
+
+  std::string value = std::string(ewk_security_origin_host_get(
+      ewk_user_media_permission_request_origin_get(
+          user_media_permission_request)));
+
+  std::string message = std::string(dgettext(
+      "WebKit",
+      "IDS_WEBVIEW_POP_P1SS_HP2SS_IS_REQUESTING_PERMISSION_TO_USE_YOUR_CAMERA"));
+
+  std::string replace_str = std::string("%1$s");
+  size_t pos = message.find(replace_str.c_str());
+  if (pos != std::string::npos)
+    message.replace(pos, replace_str.length(), value.c_str());
+
+  replace_str = std::string("(%2$s)");
+  pos = message.find(replace_str.c_str());
+  if (pos != std::string::npos)
+    message.replace(pos, replace_str.length(), "");
+
+  // add for suspending
+  ewk_user_media_permission_request_suspend(user_media_permission_request);
+
+  UserMediaPermissionPopup* popup = new UserMediaPermissionPopup(
+      user_media_permission_request,
+      ewk_user_media_permission_request_origin_get(
+          user_media_permission_request), message);
+
+  impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
+
+  return EINA_TRUE;
 }
 
 void ewk_view_use_settings_font(Evas_Object* ewkView)
@@ -924,7 +1007,7 @@ char* ewk_view_get_cookies_for_url(Evas_Object* view, const char* url)
   EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
   EINA_SAFETY_ON_NULL_RETURN_VAL(url, 0);
   std::string cookiesForURL;
-  cookiesForURL = impl->GetWebContext()->cookieManager()->GetCookiesForURL(std::string(url));
+  cookiesForURL = impl->context()->cookieManager()->GetCookiesForURL(std::string(url));
   if (cookiesForURL.empty())
     return NULL;
   return strndup(cookiesForURL.c_str(), cookiesForURL.length());
@@ -955,7 +1038,7 @@ void ewk_view_session_data_get(Evas_Object* ewkView, const char** data, unsigned
   EINA_SAFETY_ON_NULL_RETURN(data);
   EINA_SAFETY_ON_NULL_RETURN(length);
 
-  WebView* impl = GetWebViewFromEvasObject(ewkView);
+  EWebView* impl = GetWebViewFromEvasObject(ewkView);
   if (!impl) {
     *data = NULL;
     *length = 0;
@@ -967,23 +1050,21 @@ void ewk_view_session_data_get(Evas_Object* ewkView, const char** data, unsigned
 
 Eina_Bool ewk_view_mode_set(Evas_Object* ewkView, Ewk_View_Mode view_mode)
 {
- EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
-
-#if !defined(EWK_BRINGUP)
-#warning "[M38] view mode is not supported in M38"
-  switch (view_mode) {
-    case EWK_VIEW_MODE_WINDOWED:
-    case EWK_VIEW_MODE_FLOATING:
-    case EWK_VIEW_MODE_FULLSCREEN:
-    case EWK_VIEW_MODE_MAXIMIZED:
-    case EWK_VIEW_MODE_MINIMIZED:
-        impl->SetViewMode((int)view_mode);
-        break;
-    default:
-        return EINA_FALSE;
-    }
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
+
+  if (view_mode == EWK_VIEW_MODE_WINDOWED) {
+#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
+    impl->SetViewMode(blink::WebViewModeWindowed);
 #endif
-  return EINA_TRUE;
+    return EINA_TRUE;
+  } else if (view_mode == EWK_VIEW_MODE_FULLSCREEN) {
+#if !defined(EWK_BRINGUP)  // FIXME: m67 bringup
+    impl->SetViewMode(blink::WebViewModeFullscreen);
+#endif
+    return EINA_TRUE;
+  } else {
+    return EINA_FALSE;
+  }
 }
 
 Eina_Bool ewk_view_split_scroll_overflow_enabled_set(Evas_Object* ewkView, const Eina_Bool enabled)
@@ -992,35 +1073,62 @@ Eina_Bool ewk_view_split_scroll_overflow_enabled_set(Evas_Object* ewkView, const
   return false;
 }
 
-#if defined(OS_TIZEN_TV)
 Ewk_Back_Forward_List* ewk_view_back_forward_list_get(const Evas_Object* ewkView)
 {
-  LOG_EWK_API_MOCKUP("for Tizen TV Browser");
-  return NULL;
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, NULL);
+  return impl->GetBackForwardList();
+}
+
+void ewk_view_notification_permission_callback_set(Evas_Object *o, Ewk_View_Notification_Permission_Callback callback, void *user_data)
+{
+  EWK_VIEW_IMPL_GET_OR_RETURN(o, impl);
+  impl->SetNotificationPermissionCallback(callback, user_data);
+}
+
+static Eina_Bool _ewk_view_default_notification_permission(
+    Evas_Object* ewk_view,
+    Ewk_Notification_Permission_Request* request,
+    void* user_data)
+{
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl, EINA_FALSE);
+
+  std::string value = std::string(ewk_security_origin_host_get(
+      ewk_notification_permission_request_origin_get(request)));
+  std::string message = std::string(
+      "Web Page (%s) is requesting permission to show notifications.");
+  std::string replace_str = std::string("(%s)");
+
+  size_t pos = message.find(replace_str.c_str());
+  if (pos != std::string::npos)
+    message.replace(pos, replace_str.length(), value.c_str());
+
+  // add for suspending
+  ewk_notification_permission_request_suspend(request);
+
+  NotificationPermissionPopup* popup = new NotificationPermissionPopup(request,
+      ewk_notification_permission_request_origin_get(request), message);
+
+  impl->GetPermissionPopupManager()->AddPermissionRequest(popup);
+
+  return EINA_TRUE;
 }
-#endif
 
 void ewk_view_draw_focus_ring_enable_set(Evas_Object* ewkView, Eina_Bool enable)
 {
-#if defined(OS_TIZEN_TV) && !defined(EWK_BRINGUP)
-  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
-  impl->setDrawFocusRing(enable);
-#else
-   LOG_EWK_API_MOCKUP("Only for Tizen TV Browser");
-#endif
+  LOG_EWK_API_MOCKUP("This API is deprecated");
 }
 
-#if defined(OS_TIZEN_TV)
 double ewk_view_page_zoom_get(const Evas_Object* ewkView)
 {
-  LOG_EWK_API_MOCKUP("for Tizen TV Browser");
-  return 0;
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, -1.0);
+  return impl->GetPageZoomFactor();
 }
 
 Eina_Bool ewk_view_page_zoom_set(Evas_Object* ewkView, double zoomFactor)
 {
-  LOG_EWK_API_MOCKUP("for Tizen TV Browser");
-  return false;
+  EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, EINA_FALSE);
+  impl->SetPageZoomFactor(zoomFactor);
+  return EINA_TRUE;
 }
 
 Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context, Ewk_Page_Group* pageGroup)
@@ -1028,13 +1136,11 @@ Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* co
   EINA_SAFETY_ON_NULL_RETURN_VAL(context, 0);
   return CreateWebViewAsEvasObject(context, canvas, smart);
 }
-#endif // OS_TIZEN_TV
 
-#if !defined(EWK_BRINGUP)
 void ewk_view_quota_permission_request_callback_set(Evas_Object* ewkView, Ewk_Quota_Permission_Request_Callback callback, void* user_data)
 {
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
-  impl->SetQuotaPermissionRequestCallback((tizen_webview::QuotaPermissionRequest_Cb)callback, user_data);
+  impl->SetQuotaPermissionRequestCallback(callback, user_data);
 }
 
 void ewk_view_quota_permission_request_reply(const Ewk_Quota_Permission_Request* request, const Eina_Bool allow)
@@ -1052,4 +1158,3 @@ void ewk_view_quota_permission_request_cancel(const Ewk_Quota_Permission_Request
   EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
   impl->QuotaRequestCancel(request);
 }
-#endif