[Tizen]Implement ewk_view_main_frame_get
authorzhishun.zhou <zhishun.zhou@samsung.com>
Sat, 25 Oct 2014 10:10:56 +0000 (18:10 +0800)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
This patch implements ewk_view_main_frame_get.
This is code migration from m34 beta to DEV,
Original patch info:
http://suprem.sec.samsung.net/gerrit/#/c/5160/3

Bug: http://107.108.218.239/bugzilla/show_bug.cgi?id=6006
Reviewed by:  Antonio Gomes, Laszlo Gombos

Change-Id: I9c50c876abee78bbf1729a627e89c66920a9840a
Signed-off-by: zhishun.zhou <zhishun.zhou@samsung.com>
tizen_src/ewk/efl_integration/public/ewk_view.cc
tizen_src/impl/eweb_view.cc
tizen_src/impl/eweb_view.h
tizen_src/impl/tizen_webview/public/tw_webview.cc
tizen_src/impl/tizen_webview/public/tw_webview.h

index 286ac20..fb4ebf3 100644 (file)
@@ -806,11 +806,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);
-#if !defined(EWK_BRINGUP)
   return impl->GetMainFrame();
-#else
-  return NULL;
-#endif
 }
 
 Eina_Bool ewk_view_main_frame_scrollbar_visible_set(Evas_Object* ewkView, Eina_Bool visible)
index 546751f..b520f04 100644 (file)
@@ -812,6 +812,19 @@ Ewk_Settings* EWebView::GetSettings() {
   return settings_.get();
 }
 
+tizen_webview::Frame* EWebView::GetMainFrame() {
+  DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+  if (!frame_.get()) {
+    RenderViewHost* render_view_host = web_contents_->GetRenderViewHost();
+
+    if (render_view_host)
+      frame_.reset(new tizen_webview::Frame(render_view_host->GetMainFrame()));
+  }
+
+  return frame_.get();
+}
+
 void EWebView::UpdateWebKitPreferences() {
   RenderViewHost* render_view_host = web_contents_->GetRenderViewHost();
   if (!render_view_host)
index 8d2955d..203345e 100644 (file)
@@ -74,6 +74,7 @@
 #include "tizen_webview/public/tw_touch_event.h"
 #include "tizen_webview/public/tw_callbacks.h"
 #include "tizen_webview/public/tw_content_security_policy.h"
+#include "tizen_webview/public/tw_frame.h"
 #include "tizen_webview/public/tw_input_type.h"
 #include "tizen_webview/public/tw_find_options.h"
 #include "tizen_webview/public/tw_touch_event.h"
@@ -261,6 +262,7 @@ class EWebView {
   const char* GetUserAgentAppName() const;
   const char* GetSelectedText() const;
   Ewk_Settings* GetSettings();
+  tizen_webview::Frame* GetMainFrame();
   void UpdateWebKitPreferences();
   void LoadHTMLString(const char* html, const char* base_uri, const char* unreachable_uri);
   void LoadPlainTextString(const char* plain_text);
@@ -437,6 +439,7 @@ class EWebView {
   scoped_ptr<content::WebContentsDelegateEfl> web_contents_delegate_;
   std::string pending_url_request_;
   scoped_ptr<Ewk_Settings> settings_;
+  scoped_ptr<tizen_webview::Frame> frame_;
   scoped_ptr<tizen_webview::PolicyDecision> window_policy_;
   Evas_Object* evas_object_;
   bool touch_events_enabled_;
index 9f81401..df5f63d 100644 (file)
@@ -80,6 +80,9 @@ void WebView::ResetContextMenuController() {
   return impl_->context_menu_.reset();
 }
 
+tizen_webview::Frame* WebView::GetMainFrame() {
+  return impl_->GetMainFrame();
+}
 
 bool WebView::SetUserAgent(const char* userAgent) {
   return impl_->SetUserAgent(userAgent);
index 3340716..b3e5a3a 100644 (file)
@@ -36,6 +36,7 @@ class TouchEvent;
 
 namespace tizen_webview {
 
+class Frame;
 class ContextMenuController;
 class SelectionController;
 class WebContext;
@@ -62,6 +63,8 @@ class WebView {
   ContextMenuController* GetContextMenuController();
   void ResetContextMenuController();
 
+  Frame* GetMainFrame();
+
   // ---- User Agent
   bool SetUserAgent(const char* userAgent);
   const char* GetUserAgent() const;