[M85 Migration][API] Adds ewk_view_original_url_get 69/245369/2
authoryh106.jung <yh106.jung@samsung.com>
Tue, 13 Jun 2017 07:28:45 +0000 (16:28 +0900)
committerBot Blink <blinkbot@samsung.com>
Mon, 12 Oct 2020 06:46:15 +0000 (06:46 +0000)
There is no way to get original URL of current webview.
Android webview is supporting it. [1]
So this patch adds ewk_view_original_url_get which can get original URL
of given webview.

[1] https://developer.android.com/reference/android/webkit/WebView.html#getOriginalUrl()

References:
https://review.tizen.org/gerrit/c/platform/framework/web/chromium-efl/+/219988

Change-Id: I1d20b5549e28bd6fd4a2f5cb4321f037ecb5d620
Signed-off-by: yh106.jung <yh106.jung@samsung.com>
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/eweb_view.h
tizen_src/ewk/efl_integration/public/ewk_view.cc

index 9256e6d..900706f 100644 (file)
@@ -332,6 +332,14 @@ const GURL& EWebView::GetURL() const {
   return web_contents_->GetVisibleURL();
 }
 
+const GURL& EWebView::GetOriginalURL() const {
+  const auto entry = web_contents_->GetController().GetVisibleEntry();
+  if (entry)
+    return entry->GetOriginalRequestURL();
+
+  return web_contents_->GetVisibleURL();
+}
+
 void EWebView::Reload() {
   web_contents_->GetController().Reload(content::ReloadType::NORMAL, true);
 }
index 31d157b..fb9dc85 100644 (file)
@@ -197,6 +197,7 @@ class EWebView {
   // ewk_view api
   void SetURL(const GURL& url);
   const GURL& GetURL() const;
+  const GURL& GetOriginalURL() const;
   void Reload();
   void ReloadBypassingCache();
   Eina_Bool CanGoBack();
index b959740..724a673 100644 (file)
@@ -143,6 +143,11 @@ const char* ewk_view_url_get(const Evas_Object* view)
   return impl->GetURL().possibly_invalid_spec().c_str();
 }
 
+const char* ewk_view_original_url_get(const Evas_Object* view)
+{
+  EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0);
+  return impl->GetOriginalURL().possibly_invalid_spec().c_str();
+}
 
 Eina_Bool ewk_view_reload(Evas_Object *view)
 {
@@ -1382,12 +1387,6 @@ Eina_Bool ewk_view_app_preload_set(Evas_Object* ewkView, Eina_Bool is_preload) {
   return false;
 }
 
-const char* ewk_view_original_url_get(const Evas_Object* o)
-{
-  LOG_EWK_API_MOCKUP();
-  return NULL;
-}
-
 void ewk_view_offscreen_rendering_enabled_set(Evas_Object* o, Eina_Bool enabled)
 {
   LOG_EWK_API_MOCKUP();