From d2207666db1afbf4c71bbe91163cbc6a00c42e9e Mon Sep 17 00:00:00 2001 From: Arnaud Renevier Date: Mon, 4 May 2015 15:52:04 -0700 Subject: [PATCH] Remove tw_webview Use EWebView directly We need to make EWebView destructor and constructor public so they can be used from CreateWebViewAsEvasObject Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=11619 Change-Id: I90dc26c0d6ffec593d9abf30df3ea87634278516 Signed-off-by: Arnaud Renevier --- .../efl_integration/context_menu_controller_efl.cc | 45 +- .../efl_integration/context_menu_controller_efl.h | 6 +- tizen_src/ewk/efl_integration/efl_integration.gypi | 2 - tizen_src/ewk/efl_integration/eweb_view.cc | 26 +- tizen_src/ewk/efl_integration/eweb_view.h | 10 +- .../efl_integration/private/ewk_view_private.cc | 33 +- .../ewk/efl_integration/private/ewk_view_private.h | 15 +- .../private/webview_delegate_ewk.cc | 4 +- .../efl_integration/private/webview_delegate_ewk.h | 10 +- .../ewk/efl_integration/public/ewk_settings.cc | 7 +- tizen_src/ewk/efl_integration/public/ewk_view.cc | 25 +- .../tizen_webview/public/tw_webview.cc | 518 --------------------- .../tizen_webview/public/tw_webview.h | 235 ---------- .../tizen_webview/public/tw_webview_delegate.h | 2 +- .../efl_integration/web_contents_delegate_efl.cc | 4 +- 15 files changed, 76 insertions(+), 866 deletions(-) delete mode 100644 tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.cc delete mode 100644 tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.h diff --git a/tizen_src/ewk/efl_integration/context_menu_controller_efl.cc b/tizen_src/ewk/efl_integration/context_menu_controller_efl.cc index 1980066..55b1c43 100644 --- a/tizen_src/ewk/efl_integration/context_menu_controller_efl.cc +++ b/tizen_src/ewk/efl_integration/context_menu_controller_efl.cc @@ -23,15 +23,12 @@ #include "ui/base/clipboard/clipboard.h" #include "private/ewk_context_menu_private.h" -#include "tizen_webview/public/tw_webview.h" - #include "selection_controller_efl.h" #if defined(OS_TIZEN_MOBILE) #include #endif -using tizen_webview::WebView; using web_contents_utils::WebViewFromWebContents; namespace { @@ -63,10 +60,6 @@ bool ContextMenuControllerEfl::PopulateAndShowContextMenu(const ContextMenuParam if (!webview_) return false; - EWebView* view = webview_->GetImpl(); - if (!view) - return false; - DCHECK(menu_items_ == NULL); if (menu_items_) return false; @@ -74,7 +67,7 @@ bool ContextMenuControllerEfl::PopulateAndShowContextMenu(const ContextMenuParam params_ = params; GetProposedContextMenu(); _Ewk_Context_Menu new_menu(menu_items_); - view->SmartCallback().call(&new_menu); + webview_->SmartCallback().call(&new_menu); menu_items_ = new_menu.TakeMenuList(); if (!CreateContextMenu()) @@ -699,8 +692,7 @@ void ContextMenuControllerEfl::CustomMenuItemSelected(ContextMenuItemEfl* menu_i params_.src_url.spec(), params_.link_url.spec(), std::string())); - EWebView* view = webview_->GetImpl(); - view->SmartCallback().call(&item); + webview_->SmartCallback().call(&item); } void ContextMenuControllerEfl::MenuItemSelected(ContextMenuItemEfl* menu_item) @@ -708,8 +700,7 @@ void ContextMenuControllerEfl::MenuItemSelected(ContextMenuItemEfl* menu_item) if (!menu_item) return; - EWebView* view = webview_->GetImpl(); - if (!view) + if (!webview_) return; // FIXME: Add cases as and when required @@ -720,33 +711,33 @@ void ContextMenuControllerEfl::MenuItemSelected(ContextMenuItemEfl* menu_item) break; } case MENU_ITEM_GO_BACK: { - view->GoBack(); + webview_->GoBack(); break; } case MENU_ITEM_GO_FORWARD: { - view->GoForward(); + webview_->GoForward(); break; } case MENU_ITEM_RELOAD: { - view->ReloadIgnoringCache(); + webview_->ReloadIgnoringCache(); break; } case MENU_ITEM_COPY: { - view->ExecuteEditCommand("copy", NULL); + webview_->ExecuteEditCommand("copy", NULL); if (params_.is_editable) { HideSelectionHandle(); Eina_Rectangle left_rect, right_rect; - view->GetSelectionRange(&left_rect, &right_rect); - view->MoveCaret(gfx::Point(right_rect.x, right_rect.y)); + webview_->GetSelectionRange(&left_rect, &right_rect); + webview_->MoveCaret(gfx::Point(right_rect.x, right_rect.y)); } else { - view->ExecuteEditCommand("Unselect", NULL); + webview_->ExecuteEditCommand("Unselect", NULL); } break; } case MENU_ITEM_TEXT_SELECTION_MODE: { Evas_Coord x, y; - evas_object_geometry_get(view->evas_object(), &x, &y, 0, 0); - view->SelectLinkText(gfx::Point(params_.x - x, params_.y - y)); + evas_object_geometry_get(webview_->evas_object(), &x, &y, 0, 0); + webview_->SelectLinkText(gfx::Point(params_.x - x, params_.y - y)); ShowSelectionHandleAndContextMenu(); break; } @@ -795,30 +786,30 @@ void ContextMenuControllerEfl::MenuItemSelected(ContextMenuItemEfl* menu_item) break; } case MENU_ITEM_SELECT_WORD: { - view->ExecuteEditCommand("SelectWord", NULL); + webview_->ExecuteEditCommand("SelectWord", NULL); ShowSelectionHandleAndContextMenu(); break; } case MENU_ITEM_SELECT_ALL: { - view->ExecuteEditCommand("SelectAll", NULL); + webview_->ExecuteEditCommand("SelectAll", NULL); ShowSelectionHandleAndContextMenu(); break; } case MENU_ITEM_PASTE: { - view->ExecuteEditCommand("paste", NULL); + webview_->ExecuteEditCommand("paste", NULL); HideSelectionHandle(); break; } case MENU_ITEM_CUT: { - view->ExecuteEditCommand("cut", NULL); + webview_->ExecuteEditCommand("cut", NULL); HideSelectionHandle(); break; } case MENU_ITEM_CLIPBOARD: { // TODO: set true for richly editable. // Paste operations are blocked by Editor if content is not richly editible. - // Need to find if view has rich editor. - ClipboardHelperEfl::GetInstance()->OpenClipboardWindow(view, true); + // Need to find if webview_ has rich editor. + ClipboardHelperEfl::GetInstance()->OpenClipboardWindow(webview_, true); break; } #if !defined(EWK_BRINGUP) diff --git a/tizen_src/ewk/efl_integration/context_menu_controller_efl.h b/tizen_src/ewk/efl_integration/context_menu_controller_efl.h index 9190257..17bd67b 100644 --- a/tizen_src/ewk/efl_integration/context_menu_controller_efl.h +++ b/tizen_src/ewk/efl_integration/context_menu_controller_efl.h @@ -16,7 +16,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/context_menu_params.h" -#include "tizen_webview/public/tw_webview.h" +class EWebView; namespace content { @@ -173,7 +173,7 @@ class ContextMenuControllerEfl static void ContextMenuItemSelectedCallback(void* data, Evas_Object* obj, void* event_info); static void ContextMenuHWBackKey(void* data, Evas_Object* obj, void* event_info); - ContextMenuControllerEfl(tizen_webview::WebView* wv, ContextMenuType type, WebContents& web_contents) + ContextMenuControllerEfl(EWebView* wv, ContextMenuType type, WebContents& web_contents) : webview_(wv), native_view_(static_cast(web_contents.GetNativeView())), popup_(NULL), @@ -226,7 +226,7 @@ class ContextMenuControllerEfl static unsigned int _appended_item_size; static int _popup_item_height; static bool _context_menu_resized; - tizen_webview::WebView* webview_; + EWebView* webview_; Evas_Object* native_view_; Evas_Object* popup_; Eina_List* menu_items_; diff --git a/tizen_src/ewk/efl_integration/efl_integration.gypi b/tizen_src/ewk/efl_integration/efl_integration.gypi index 3b4f928..6352e5b 100644 --- a/tizen_src/ewk/efl_integration/efl_integration.gypi +++ b/tizen_src/ewk/efl_integration/efl_integration.gypi @@ -442,8 +442,6 @@ 'tizen_webview/public/tw_webview_delegate.h', 'tizen_webview/public/tw_webview_evas_event_handler.h', 'tizen_webview/public/tw_webview_evas_event_handler.cc', - 'tizen_webview/public/tw_webview.h', - 'tizen_webview/public/tw_webview.cc', 'renderer/content_renderer_client_efl.cc', 'renderer/content_renderer_client_efl.h', diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index 15e3c7e..bfbd60f 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -20,6 +20,7 @@ #include "private/ewk_policy_decision_private.h" #include "private/ewk_settings_private.h" #include "private/ewk_text_style_private.h" +#include "private/webview_delegate_ewk.h" #include "web_contents_delegate_efl.h" #include "public/ewk_hit_test.h" #include "public/platform/WebString.h" @@ -56,7 +57,6 @@ #include "ui/gfx/screen.h" #include "devtools_delegate_efl.h" -#include "tizen_webview/public/tw_webview.h" #include "tizen_webview/public/tw_webview_delegate.h" #include "tizen_webview/public/tw_webview_evas_event_handler.h" @@ -274,29 +274,16 @@ content::WebContentsEflDelegate::WebContentsCreateCallback base::Bind(&NullCreateWebContents); EWebView* EWebView::FromEvasObject(Evas_Object* eo) { - WebView *wv = WebView::FromEvasObject(eo); - if (!wv) { - DLOG(ERROR) << "Trying to get WebView from non-WebView Evas_Object"; - return NULL; - } - return wv->GetImpl(); -} - -tizen_webview::WebView* EWebView::GetPublicWebView() { - DCHECK(public_webview_); - if (public_webview_ == NULL) { - DLOG(ERROR) << "WebView is not set. Something wrong on construction"; - } - return public_webview_; + return WebViewDelegateEwk::GetInstance(). + GetWebViewFromEvasObject(eo); } RenderWidgetHostViewEfl* EWebView::rwhv() const { return static_cast(web_contents_->GetRenderWidgetHostView()); } -EWebView::EWebView(tizen_webview::WebView* owner, Ewk_Context* context, Evas_Object* object) - : public_webview_(owner), - context_(context), +EWebView::EWebView(Ewk_Context* context, Evas_Object* object) + : context_(context), evas_object_(object), native_view_(object), touch_events_enabled_(false), @@ -401,7 +388,6 @@ EWebView::~EWebView() formNavigation_.nextState = false; // evas_object_del(evas_object()); - public_webview_ = NULL; // Release manually those scoped pointers to // make sure they are released in correct order @@ -1266,7 +1252,7 @@ void EWebView::ShowContextMenu( convertedParams.y = convertedPoint.y(); } - context_menu_.reset(new content::ContextMenuControllerEfl(GetPublicWebView(), type, *web_contents_.get())); + context_menu_.reset(new content::ContextMenuControllerEfl(this, type, *web_contents_.get())); Evas_Coord x, y; evas_object_geometry_get(evas_object(), &x, &y, 0, 0); diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index e1e41e4..619df1f 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -65,7 +65,6 @@ class PopupControllerEfl; } namespace tizen_webview { -class WebView; class WebViewEvasEventHandler; } @@ -210,6 +209,9 @@ class EWebView { static EWebView* FromEvasObject(Evas_Object* eo); static int GetOrientation(); + EWebView(Ewk_Context*, Evas_Object* smart_object); + ~EWebView(); + // initialize data members and activate event handlers. // call this once after created and before use void Initialize(); @@ -217,7 +219,6 @@ class EWebView { void CreateNewWindow(content::WebContentsEflDelegate::WebContentsCreateCallback); static Evas_Object* GetHostWindowDelegate(const content::WebContents*); - tizen_webview::WebView* GetPublicWebView(); Ewk_Context* context() const { return context_.get(); } Evas_Object* evas_object() const { return evas_object_; } Evas* GetEvas() const { return evas_object_evas_get(evas_object_); } @@ -471,7 +472,6 @@ class EWebView { void ReleasePopupMenuList(); - tizen_webview::WebView* public_webview_; scoped_refptr evas_event_handler_; scoped_refptr context_; scoped_refptr old_context_; @@ -552,10 +552,6 @@ private: std::set delayed_messages_; std::map hit_test_callback_; - // only tizen_webview::WebView can create and delete this - EWebView(tizen_webview::WebView* owner, Ewk_Context*, Evas_Object* smart_object); - ~EWebView(); - friend class tizen_webview::WebView; }; namespace tizen_webview { diff --git a/tizen_src/ewk/efl_integration/private/ewk_view_private.cc b/tizen_src/ewk/efl_integration/private/ewk_view_private.cc index 74d3085..092f03d 100644 --- a/tizen_src/ewk/efl_integration/private/ewk_view_private.cc +++ b/tizen_src/ewk/efl_integration/private/ewk_view_private.cc @@ -12,17 +12,16 @@ #include "private/webview_delegate_ewk.h" -using tizen_webview::WebView; using tizen_webview::WebViewDelegate; // -------- EwkViewImpl struct EwkViewImpl { - explicit EwkViewImpl(tizen_webview::WebView* wv) : wv_(wv) {} - ~EwkViewImpl() { tizen_webview::WebView::Delete(wv_); } - tizen_webview::WebView* GetTizenWebView() { return wv_; } - const tizen_webview::WebView* GetTizenWebView() const { return wv_; } + explicit EwkViewImpl(EWebView* wv) : wv_(wv) {} + ~EwkViewImpl() { delete(wv_); } + EWebView* GetTizenWebView() { return wv_; } + const EWebView* GetTizenWebView() const { return wv_; } private: - tizen_webview::WebView* wv_; + EWebView* wv_; DISALLOW_COPY_AND_ASSIGN(EwkViewImpl); }; @@ -88,7 +87,7 @@ void handleEvasObjectDelete(Evas_Object* evas_object) void handleEvasObjectShow(Evas_Object* o) { Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o); - WebView* wv = GetWebViewFromSmartData(d); + EWebView* wv = GetWebViewFromSmartData(d); if (!wv) { return; } @@ -102,7 +101,7 @@ void handleEvasObjectShow(Evas_Object* o) void handleEvasObjectHide(Evas_Object* o) { Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o); - WebView* wv = GetWebViewFromSmartData(d); + EWebView* wv = GetWebViewFromSmartData(d); if (!wv) { return; } @@ -120,7 +119,7 @@ void handleEvasObjectHide(Evas_Object* o) void handleEvasObjectMove(Evas_Object* o, Evas_Coord x, Evas_Coord y) { Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o); - WebView* wv = GetWebViewFromSmartData(d); + EWebView* wv = GetWebViewFromSmartData(d); if (!wv) { return; } @@ -131,7 +130,7 @@ void handleEvasObjectMove(Evas_Object* o, Evas_Coord x, Evas_Coord y) void handleEvasObjectResize(Evas_Object* o, Evas_Coord width, Evas_Coord height) { Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o); - WebView* wv = GetWebViewFromSmartData(d); + EWebView* wv = GetWebViewFromSmartData(d); if (!wv) { return; } @@ -144,7 +143,7 @@ void handleEvasObjectResize(Evas_Object* o, Evas_Coord width, Evas_Coord height) void handleEvasObjectCalculate(Evas_Object* o) { Ewk_View_Smart_Data* d = GetEwkViewSmartDataFromEvasObject(o); - WebView* wv = GetWebViewFromSmartData(d); + EWebView* wv = GetWebViewFromSmartData(d); if (!wv) { return; } @@ -163,7 +162,7 @@ void handleEvasObjectColorSet(Evas_Object*, int red, int green, int blue, int al Eina_Bool handleTextSelectionDown(Ewk_View_Smart_Data* d, int x, int y) { - WebView* wv = GetWebViewFromSmartData(d); + EWebView* wv = GetWebViewFromSmartData(d); if (!wv) return false; return wv->HandleTextSelectionDown(x, y); @@ -171,7 +170,7 @@ Eina_Bool handleTextSelectionDown(Ewk_View_Smart_Data* d, int x, int y) Eina_Bool handleTextSelectionUp(Ewk_View_Smart_Data* d, int x, int y) { - WebView* wv = GetWebViewFromSmartData(d); + EWebView* wv = GetWebViewFromSmartData(d); if (!wv) return false; return wv->HandleTextSelectionUp(x, y); @@ -226,7 +225,7 @@ Ewk_View_Smart_Data* GetEwkViewSmartDataFromEvasObject(const Evas_Object* evas_o return static_cast(evas_object_smart_data_get(evas_object)); } -WebView* GetWebViewFromSmartData(const Ewk_View_Smart_Data* smartData) +EWebView* GetWebViewFromSmartData(const Ewk_View_Smart_Data* smartData) { if (smartData && smartData->priv) { return smartData->priv->GetTizenWebView(); @@ -234,7 +233,7 @@ WebView* GetWebViewFromSmartData(const Ewk_View_Smart_Data* smartData) return NULL; } -WebView* GetWebViewFromEvasObject(const Evas_Object* eo) { +EWebView* GetWebViewFromEvasObject(const Evas_Object* eo) { if (!IsWebViewObject(eo)) { return NULL; } @@ -252,13 +251,13 @@ Evas_Object* CreateWebViewAsEvasObject(Ewk_Context* context, smart = smart ? smart : DefaultSmartClassInstance(); Evas_Object* wv_evas_object = evas_object_smart_add(canvas, smart); - WebView* view = WebView::Create(context, wv_evas_object); + EWebView* view = new EWebView(context, wv_evas_object); if (!view) { return NULL; } Ewk_View_Smart_Data* sd = GetEwkViewSmartDataFromEvasObject(wv_evas_object); if (!sd) { - WebView::Delete(view); + delete view; return NULL; } // attach webview as a member of smart data diff --git a/tizen_src/ewk/efl_integration/private/ewk_view_private.h b/tizen_src/ewk/efl_integration/private/ewk_view_private.h index 3c18284..f47431a 100644 --- a/tizen_src/ewk/efl_integration/private/ewk_view_private.h +++ b/tizen_src/ewk/efl_integration/private/ewk_view_private.h @@ -6,8 +6,9 @@ #define ewk_view_private_h #include + +#include "eweb_view.h" #include "ewk_view.h" -#include class Ewk_Context; @@ -21,17 +22,11 @@ const char EwkViewSmartClassName[] = "EWebView"; // type conversion utility bool IsWebViewObject(const Evas_Object* evas_object); Ewk_View_Smart_Data* GetEwkViewSmartDataFromEvasObject(const Evas_Object* evas_object); -tizen_webview::WebView* GetWebViewFromSmartData(const Ewk_View_Smart_Data* smartData); -tizen_webview::WebView* GetWebViewFromEvasObject(const Evas_Object* eo); +EWebView* GetWebViewFromSmartData(const Ewk_View_Smart_Data* smartData); +EWebView* GetWebViewFromEvasObject(const Evas_Object* eo); // helper macro #define EWK_VIEW_IMPL_GET_OR_RETURN(evas_object, impl, ...) \ - tizen_webview::WebView* impl = GetWebViewFromEvasObject(evas_object); \ - do { \ - if (!impl) { \ - EINA_LOG_CRIT("Evas Object %p is not Ewk WebView", evas_object); \ - return __VA_ARGS__; \ - } \ - } while (0) + EWebView* impl = GetWebViewFromEvasObject(evas_object) \ #endif // ewk_view_private_h diff --git a/tizen_src/ewk/efl_integration/private/webview_delegate_ewk.cc b/tizen_src/ewk/efl_integration/private/webview_delegate_ewk.cc index 423e6dd..d226852 100644 --- a/tizen_src/ewk/efl_integration/private/webview_delegate_ewk.cc +++ b/tizen_src/ewk/efl_integration/private/webview_delegate_ewk.cc @@ -15,8 +15,8 @@ const WebViewDelegateEwk& WebViewDelegateEwk::GetInstance() { return instance; } -tizen_webview::WebView* WebViewDelegateEwk::GetWebViewFromEvasObject( - Evas_Object* evas_object) { +EWebView* WebViewDelegateEwk::GetWebViewFromEvasObject( + Evas_Object* evas_object) const { return ::GetWebViewFromEvasObject(evas_object); } diff --git a/tizen_src/ewk/efl_integration/private/webview_delegate_ewk.h b/tizen_src/ewk/efl_integration/private/webview_delegate_ewk.h index 1c5760e..5e402cb 100644 --- a/tizen_src/ewk/efl_integration/private/webview_delegate_ewk.h +++ b/tizen_src/ewk/efl_integration/private/webview_delegate_ewk.h @@ -6,21 +6,23 @@ #define webview_delegate_ewk_h #include -#include +#include "base/macros.h" + #include -using tizen_webview::WebView; using tizen_webview::WebViewDelegate; +class EWebView; + struct WebViewDelegateEwk : public WebViewDelegate { public: static const WebViewDelegateEwk& GetInstance(); - protected: - WebView* GetWebViewFromEvasObject(Evas_Object* evas_object); + EWebView* GetWebViewFromEvasObject(Evas_Object* evas_object) const; bool IsWebViewEvasObject(Evas_Object* evas_object); Evas_Object_Smart_Clipped_Data* GetSmartClippedData(Evas_Object* evas_object); Eina_Rectangle GetLastUsedViewPortArea(Evas_Object* evas_object); + protected: // Event handlers bool RequestHandleEvent_FocusIn(EWebView* wv); bool RequestHandleEvent_FocusOut(EWebView* wv); diff --git a/tizen_src/ewk/efl_integration/public/ewk_settings.cc b/tizen_src/ewk/efl_integration/public/ewk_settings.cc index 839963f..5432c27 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_settings.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_settings.cc @@ -4,8 +4,6 @@ #include "ewk_settings.h" -#include - #include "eweb_view.h" #include "ui/events/gesture_detection/gesture_configuration.h" #include "public/text_encoding_map_efl.h" @@ -14,12 +12,11 @@ #include "private/ewk_settings_private.h" #include "private/ewk_view_private.h" -using tizen_webview::WebView; namespace { void ewkUpdateWebkitPreferences(Evas_Object *ewkView) { - WebView* impl = WebView::FromEvasObject(ewkView); + EWebView* impl = EWebView::FromEvasObject(ewkView); assert(impl); bool autoSelectWord = ewk_settings_select_word_automatically_get(impl->GetSettings()); @@ -206,7 +203,7 @@ const char* ewk_settings_default_encoding_get(const Ewk_Settings* settings) Eina_Bool ewk_settings_private_browsing_enabled_set(Ewk_Settings* settings, Eina_Bool enable) { EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false); - WebView* impl = WebView::FromEvasObject(settings->getEvasObject()); + EWebView* impl = EWebView::FromEvasObject(settings->getEvasObject()); return impl->SetPrivateBrowsing(enable); } diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index 54ccc4c..1ff720e 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -23,7 +23,6 @@ #include "ewk_view.h" #include -#include #include "content/public/browser/navigation_controller.h" #include "ui/events/gesture_detection/gesture_configuration.h" @@ -52,8 +51,6 @@ #include "third_party/WebKit/public/web/WebViewModeEnums.h" #include "web_contents_delegate_efl.h" -using tizen_webview::WebView; - Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api) { EINA_SAFETY_ON_NULL_RETURN_VAL(api, false); @@ -68,7 +65,7 @@ Evas_Object* ewk_view_add_with_session_data(Evas* canvas, const char* data, unsi Evas_Object* ret = ewk_view_add(canvas); - WebView *webView = GetWebViewFromEvasObject(ret); + EWebView *webView = GetWebViewFromEvasObject(ret); if (!webView || !data || !length) return ret; @@ -108,7 +105,7 @@ Evas_Object* ewk_view_add_in_incognito_mode(Evas* e) Ewk_Context *ewk_view_context_get(const Evas_Object *view) { EWK_VIEW_IMPL_GET_OR_RETURN(view, impl, 0); - return static_cast(impl->GetWebContext()); + return static_cast(impl->context()); } Eina_Bool ewk_view_url_set(Evas_Object* view, const char* url) @@ -373,24 +370,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; } @@ -705,7 +702,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->GetSelectionController()->ClearSelectionViaEWebView() ? EINA_TRUE : EINA_FALSE; } const char* ewk_view_text_selection_text_get(Evas_Object* view) @@ -907,7 +904,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()); @@ -938,7 +935,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; diff --git a/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.cc b/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.cc deleted file mode 100644 index df4ac25..0000000 --- a/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.cc +++ /dev/null @@ -1,518 +0,0 @@ -// Copyright (c) 2014 The Chromium Authors. All rights reserved. -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "tw_webview.h" -#include "eweb_view.h" - -#include -#include - -#include "content/browser/renderer_host/render_widget_host_view_efl.h" -#include "private/ewk_back_forward_list_private.h" -#include "private/ewk_history_private.h" -#include - -using content::SelectionControllerEfl; - -namespace tizen_webview { - -WebView* WebView::Create(Ewk_Context* wc, Evas_Object* eo) { - WebView* wv = new WebView(); - DCHECK(wv); - - Impl* impl = new Impl(wv, wc, eo); - if (!impl) { - DLOG(ERROR) << "[tizen_webview] Cannot create webview"; - delete wv; - return NULL; - } - wv->SetImpl(impl); - DCHECK(wv == impl->GetPublicWebView()); - return wv; -} - -void WebView::Delete(WebView* wv) { - delete wv; -} - -void WebView::Initialize() { - impl_->Initialize(); -} - -WebView::WebView() - : impl_(NULL) { -} - -WebView::~WebView() { - delete impl_; -} - -Evas_Object* WebView::AsEvasObject() { - return impl_->evas_object(); -} - -WebView* WebView::FromEvasObject(Evas_Object* eo) { - return WebViewDelegate::GetInstance()->GetWebViewFromEvasObject(eo); -} - -Ewk_Context* WebView::GetWebContext() { - return impl_->context(); -} - -bool WebView::SetPrivateBrowsing(bool incognito) { - return impl_->SetPrivateBrowsing(incognito); -} - -bool WebView::GetPrivateBrowsing() const { - return impl_->GetPrivateBrowsing(); -} - -Ewk_Settings* WebView::GetSettings() { - return impl_->GetSettings(); -} - -content::SelectionControllerEfl* WebView::GetSelectionController() { - return impl_->GetSelectionController(); -} - -content::ContextMenuControllerEfl* WebView::GetContextMenuController() { - return impl_->GetContextMenuController(); -} - -void WebView::ResetContextMenuController() { - return impl_->ResetContextMenuController(); -} - -void WebView::HideSelectionHandlers() { - if (SelectionControllerEfl* selection_controller = GetSelectionController()) - selection_controller->HideHandles(); -} - -_Ewk_Frame* WebView::GetMainFrame() { - return impl_->GetMainFrame(); -} - -bool WebView::SetUserAgent(const char* userAgent) { - return impl_->SetUserAgent(userAgent); -} - -const char* WebView::GetUserAgent() const { - return impl_->GetUserAgent(); -} - -bool WebView::SetUserAgentAppName(const char* application_name) { - return impl_->SetUserAgentAppName(application_name); -} - -const char* WebView::GetUserAgentAppName() const { - return impl_->GetUserAgentAppName(); -} - -void WebView::SetURL(const char* url_string) { - return impl_->SetURL(url_string); -} - -const char* WebView::GetURL() const { - return impl_->GetURL(); -} - -void WebView::Reload() { - return impl_->Reload(); -} - -void WebView::ReloadIgnoringCache() { - return impl_->ReloadIgnoringCache(); -} - -double WebView::GetProgressValue() { - return impl_->GetProgressValue(); -} - -void WebView::LoadHTMLString(const char* html, const char* base_uri, const char* unreachable_uri) { - return impl_->LoadHTMLString(html, base_uri, unreachable_uri); -} - -void WebView::Suspend() { - return impl_->Suspend(); -} - -void WebView::Resume() { - return impl_->Resume(); -} - -void WebView::Stop() { - return impl_->Stop(); -} - -void WebView::LoadPlainTextString(const char* plain_text) { - return impl_->LoadPlainTextString(plain_text); -} - -void WebView::LoadData(const char* data, size_t size, const char* mime_type, const char* encoding, const char* base_uri, const char* unreachable_uri /*= NULL*/) { - return impl_->LoadData(data, size, mime_type, encoding, base_uri, unreachable_uri); -} - -void WebView::UrlRequestSet(const char* url, - content::NavigationController::LoadURLType loadtype, - Eina_Hash* headers, - const char* body) { - return impl_->UrlRequestSet(url, loadtype, headers, body); -} - -void WebView::LoadNotFoundErrorPage(const std::string& invalidUrl) { - return impl_->LoadNotFoundErrorPage(invalidUrl); -} - -bool WebView::GoBack() { - return impl_->GoBack(); -} - -bool WebView::GoForward() { - return impl_->GoForward(); -} - -bool WebView::CanGoBack() { - return impl_->CanGoBack(); -} - -bool WebView::CanGoForward() { - return impl_->CanGoForward(); -} - -void WebView::BackForwardListClear() { - return impl_->BackForwardListClear(); -} - -_Ewk_Back_Forward_List* WebView::GetBackForwardList() const { - return impl_->GetBackForwardList(); -} - -_Ewk_History* WebView::GetBackForwardHistory() const { - return impl_->GetBackForwardHistory(); -} - -const char* WebView::GetTitle() { - return impl_->GetTitle(); -} - -const Eina_Rectangle WebView::GetContentsSize() const { - return impl_->GetContentsSize(); -} - -bool WebView::PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data) { - return impl_->PlainTextGet(callback, user_data); -} - -void WebView::InvokePlainTextGetCallback(const std::string& content_text, int plain_text_get_callback_id) { - return impl_->InvokePlainTextGetCallback(content_text, plain_text_get_callback_id); -} - -int WebView::SetEwkViewPlainTextGetCallback(Ewk_View_Plain_Text_Get_Callback callback, void* user_data) { - return impl_->SetEwkViewPlainTextGetCallback(callback, user_data); -} - -bool WebView::GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data) { - return impl_->GetMHTMLData(callback, user_data); -} - -void WebView::OnMHTMLContentGet(const std::string& mhtml_content, int callback_id) { - return impl_->OnMHTMLContentGet(mhtml_content, callback_id); -} - -void WebView::SetOverrideEncoding(const std::string& encoding) { - return impl_->SetOverrideEncoding(encoding); -} - -void WebView::ExecuteEditCommand(const char* command, const char* value) { - return impl_->ExecuteEditCommand(command, value); -} - -void WebView::Find(const char* text, Ewk_Find_Options options) { - return impl_->Find(text, options); -} - -void WebView::StopFinding() { - return impl_->StopFinding(); -} - -void WebView::SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type) { - return impl_->SetContentSecurityPolicy(policy, type); -} - -void WebView::SetViewGeolocationPermissionCallback(Ewk_View_Geolocation_Permission_Callback callback, void* user_data) { - impl_->SetViewGeolocationPermissionCallback(callback, user_data); -} - -void WebView::SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback, void* user_data){ - impl_->SetViewUnfocusAllowCallback(callback, user_data); -} - -void WebView::Show() { - return impl_->Show(); -} - -void WebView::Hide() { - return impl_->Hide(); -} - -void WebView::SetFocus(Eina_Bool focus) { - return impl_->SetFocus(focus); -} - -bool WebView::HasFocus() const { - return impl_->HasFocus(); -} - -void WebView::SetScale(double scale_factor, int x, int y) { - return impl_->SetScale(scale_factor, x, y); -} - -double WebView::GetScale() { - return impl_->GetScale(); -} - -void WebView::DidChangePageScaleFactor(double scale_factor) { - return impl_->DidChangePageScaleFactor(scale_factor); -} - -void WebView::GetPageScaleRange(double *min_scale, double *max_scale) { - return impl_->GetPageScaleRange(min_scale, max_scale); -} - -void WebView::DidChangePageScaleRange(double min_scale, double max_scale) { - return impl_->DidChangePageScaleRange(min_scale, max_scale); -} - -bool WebView::GetScrollPosition(int* x, int* y) const { - return impl_->GetScrollPosition(x, y); -} - -void WebView::SetScroll(int x, int y) { - return impl_->SetScroll(x, y); -} - -void WebView::GetScrollSize(int* w, int* h) { - return impl_->GetScrollSize(w, h); -} - -void WebView::SetOrientation(int orientation) { - return impl_->SetOrientation(orientation); -} - -void WebView::SetOrientationLockCallback(Ewk_Orientation_Lock_Cb func, void* data) { - return impl_->SetOrientationLockCallback(func, data); -} - -void WebView::SetViewMode(blink::WebViewMode view_mode) { - return impl_->SetViewMode(view_mode); -} - -bool WebView::IsFullscreen() { - return impl_->IsFullscreen(); -} - -void WebView::ExitFullscreen() { - return impl_->ExitFullscreen(); -} - -Evas_Object* WebView::GetSnapshot(Eina_Rectangle rect) { - return impl_->GetSnapshot(rect); -} - -bool WebView::GetSnapshotAsync(Eina_Rectangle rect, Evas* canvas, Ewk_Web_App_Screenshot_Captured_Callback callback, void* user_data) { - return impl_->GetSnapshotAsync(rect, canvas, callback, user_data); -} - -void WebView::SetDrawsTransparentBackground(bool enabled) { - return impl_->SetDrawsTransparentBackground(enabled); -} - -bool WebView::TouchEventsEnabled() const { - return impl_->TouchEventsEnabled(); -} - -void WebView::SetTouchEventsEnabled(bool enabled) { - return impl_->SetTouchEventsEnabled(enabled); -} - -void WebView::HandleTouchEvents(Ewk_Touch_Event_Type type, const Eina_List *point, const Evas_Modifier *modifiers) { - return impl_->HandleTouchEvents(type, point, modifiers); -} - -_Ewk_Hit_Test* WebView::RequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode) { - return impl_->RequestHitTestDataAt(x, y, mode); -} - -Eina_Bool WebView::AsyncRequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode, Ewk_View_Hit_Test_Request_Callback callback, void* user_data) -{ - return impl_->AsyncRequestHitTestDataAt(x, y, mode, callback, user_data); -} - -void WebView::QuerySelectionStyle() { - return impl_->QuerySelectionStyle(); -} - -void WebView::OnQuerySelectionStyleReply(const SelectionStylePrams& params) { - return impl_->OnQuerySelectionStyleReply(params); -} - -void WebView::SelectClosestWord(const gfx::Point& touch_point) { - return impl_->SelectClosestWord(touch_point); -} - -void WebView::SelectLinkText(const gfx::Point& touch_point) { - return impl_->SelectLinkText(touch_point); -} - -bool WebView::GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect) { - return impl_->GetSelectionRange(left_rect, right_rect); -} - -bool WebView::ClearSelection() { - return impl_->GetSelectionController()->ClearSelectionViaEWebView(); -} - -const char* WebView::GetSelectedText() const { - return impl_->GetSelectedText(); -} - -void WebView::GetSessionData(const char **data, unsigned *length) const { - return impl_->GetSessionData(data, length); -} - -bool WebView::RestoreFromSessionData(const char *data, unsigned length) { - return impl_->RestoreFromSessionData(data, length); -} - -void WebView::UseSettingsFont() { - return impl_->UseSettingsFont(); -} - -void WebView::SetMouseEventsEnabled(bool enabled) { - return impl_->SetMouseEventsEnabled(enabled); -} - -bool WebView::MouseEventsEnabled() const { - return impl_->MouseEventsEnabled(); -} - -double WebView::GetTextZoomFactor() const { - return impl_->GetTextZoomFactor(); -} - -void WebView::SetTextZoomFactor(double text_zoom_factor) { - return impl_->SetTextZoomFactor(text_zoom_factor); -} - -bool WebView::GetLinkMagnifierEnabled() const { - return impl_->GetLinkMagnifierEnabled(); -} - -void WebView::SetLinkMagnifierEnabled(bool enabled) { - return impl_->SetLinkMagnifierEnabled(enabled); -} - -void WebView::SetBrowserFont() { - return impl_->SetBrowserFont(); -} - -void WebView::UpdateWebKitPreferences() { - return impl_->UpdateWebKitPreferences(); -} - -bool WebView::ExecuteJavaScript(const char* script, Ewk_View_Script_Execute_Callback callback, void* userdata) { - return impl_->ExecuteJavaScript(script, callback, userdata); -} - -void WebView::SetJavaScriptAlertCallback(Ewk_View_JavaScript_Alert_Callback callback, void* user_data) { - return impl_->SetJavaScriptAlertCallback(callback, user_data); -} - -void WebView::JavaScriptAlertReply() { - return impl_->JavaScriptAlertReply(); -} - -void WebView::SetJavaScriptConfirmCallback(Ewk_View_JavaScript_Confirm_Callback callback, void* user_data) { - return impl_->SetJavaScriptConfirmCallback(callback, user_data); -} - -void WebView::JavaScriptConfirmReply(bool result) { - return impl_->JavaScriptConfirmReply(result); -} - -void WebView::SetJavaScriptPromptCallback(Ewk_View_JavaScript_Prompt_Callback callback, void* user_data) { - return impl_->SetJavaScriptPromptCallback(callback, user_data); -} - -void WebView::JavaScriptPromptReply(const char* result) { - return impl_->JavaScriptPromptReply(result); -} - -bool WebView::WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback, void *userData) { - return impl_->WebAppCapableGet(callback, userData); -} - -bool WebView::WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback, void *userData) { - return impl_->WebAppIconUrlGet(callback, userData); -} - -bool WebView::WebAppIconUrlsGet(Ewk_Web_App_Icon_URLs_Get_Callback callback, void *userData) { - return impl_->WebAppIconUrlsGet(callback, userData); -} - -void WebView::InvokeWebAppCapableGetCallback(bool capable, int callbackId) { - return impl_->InvokeWebAppCapableGetCallback(capable, callbackId); -} - -void WebView::InvokeWebAppIconUrlGetCallback(const std::string &iconUrl, int callbackId) { - return impl_->InvokeWebAppIconUrlGetCallback(iconUrl, callbackId); -} - -void WebView::InvokeWebAppIconUrlsGetCallback(const std::map &iconUrls, int callbackId) { - return impl_->InvokeWebAppIconUrlsGetCallback(iconUrls, callbackId); -} - -void WebView::SetNotificationPermissionCallback( - Ewk_View_Notification_Permission_Callback callback, void* user_data) { - return impl_->SetNotificationPermissionCallback(callback, user_data); -} - -bool WebView::SaveAsPdf(int width, int height, const std::string& file_name) { - return impl_->SaveAsPdf(width, height, file_name); -} - -int WebView::StartInspectorServer(int port ) { - return impl_->StartInspectorServer(port); -} - -bool WebView::StopInspectorServer() { - return impl_->StopInspectorServer(); -} - -bool WebView::HandleShow() { - return impl_->HandleShow(); -} - -bool WebView::HandleHide() { - return impl_->HandleHide(); -} - -bool WebView::HandleMove(int x, int y) { - return impl_->HandleMove(x, y); -} - -bool WebView::HandleResize(int width, int height) { - return impl_->HandleResize(width, height); -} - -bool WebView::HandleTextSelectionDown(int x, int y) { - return impl_->HandleTextSelectionDown(x, y); -} - -bool WebView::HandleTextSelectionUp(int x, int y) { - return impl_->HandleTextSelectionUp(x, y); -} - -} // namespace tizen_webview diff --git a/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.h b/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.h deleted file mode 100644 index 86380a9..0000000 --- a/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview.h +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) 2014 The Chromium Authors. All rights reserved. -// Copyright 2014 Samsung Electronics. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef TIZEN_WEBVIEW_PUBLIC_TW_WEBVIEW_H_ -#define TIZEN_WEBVIEW_PUBLIC_TW_WEBVIEW_H_ - -#include -#include -#include - -#include "base/macros.h" -#include "content/public/browser/navigation_controller.h" -#include "ewk_touch.h" -#include "public/ewk_hit_test.h" -#include "public/ewk_view.h" -#include "third_party/WebKit/public/web/WebViewModeEnums.h" - -// TODO: Remove this dependency -class _Ewk_Back_Forward_List; -class _Ewk_History; -class Ewk_Settings; -class WebContentDelegateEfl; -struct SelectionStylePrams; -// TODO END - -class Ewk_Context; -class EWebView; -class _Ewk_Frame; - -namespace gfx { -class Point; -} - -namespace content { -class SelectionControllerEfl; -class ContextMenuControllerEfl; -} - -namespace tizen_webview { - -class WebViewDelegate; -class WebViewEvasEventHandler; - -class WebView { - public: - // ---- create/delete - static WebView* Create(Ewk_Context* wc, Evas_Object* eo) WARN_UNUSED_RESULT; - static void Delete(WebView* wv); - - // initialize data members and activate event handlers. - // call this once after Create() and before using EWebView - void Initialize(); - - // ---- Get various objects related with this webview - Evas_Object* AsEvasObject(); - static WebView* FromEvasObject(Evas_Object* eo); - Ewk_Context* GetWebContext(); - bool SetPrivateBrowsing(bool incognito); - bool GetPrivateBrowsing() const; - Ewk_Settings* GetSettings(); - content::SelectionControllerEfl* GetSelectionController(); - content::ContextMenuControllerEfl* GetContextMenuController(); - void ResetContextMenuController(); - void HideSelectionHandlers(); - - _Ewk_Frame* GetMainFrame(); - - // ---- User Agent - bool SetUserAgent(const char* userAgent); - const char* GetUserAgent() const; - bool SetUserAgentAppName(const char* application_name); - const char* GetUserAgentAppName() const; - - // ---- Load - void SetURL(const char* url_string); - const char* GetURL() const; - void Reload(); - void ReloadIgnoringCache(); - double GetProgressValue(); // GetLoadProgressPercentage - void LoadHTMLString(const char* html, const char* base_uri, const char* unreachable_uri); - void Suspend(); - void Resume(); - void Stop(); - void LoadPlainTextString(const char* plain_text); - void LoadData(const char* data, size_t size, const char* mime_type, const char* encoding, const char* base_uri, const char* unreachable_uri = NULL); // SetContent - void UrlRequestSet(const char* url, - content::NavigationController::LoadURLType loadtype, - Eina_Hash* headers, - const char* body); - void LoadNotFoundErrorPage(const std::string& invalidUrl); - - // ---- Navigation - bool GoBack(); - bool GoForward(); - bool CanGoBack(); - bool CanGoForward(); - void BackForwardListClear(); - _Ewk_Back_Forward_List* GetBackForwardList() const; - _Ewk_History* GetBackForwardHistory() const; - - // ---- Contents - const char* GetTitle(); - const Eina_Rectangle GetContentsSize() const; - bool PlainTextGet(Ewk_View_Plain_Text_Get_Callback callback, void* user_data); - void InvokePlainTextGetCallback(const std::string& content_text, int plain_text_get_callback_id); - int SetEwkViewPlainTextGetCallback(Ewk_View_Plain_Text_Get_Callback callback, void* user_data); - bool GetMHTMLData(Ewk_View_MHTML_Data_Get_Callback callback, void* user_data); - void OnMHTMLContentGet(const std::string& mhtml_content, int callback_id); - void SetOverrideEncoding(const std::string& encoding); - void ExecuteEditCommand(const char* command, const char* value); - void Find(const char* text, Ewk_Find_Options options); - void StopFinding(); - void SetContentSecurityPolicy(const char* policy, Ewk_CSP_Header_Type type); - - void SetViewGeolocationPermissionCallback(Ewk_View_Geolocation_Permission_Callback callback, void* user_data); - void SetViewUnfocusAllowCallback(Ewk_View_Unfocus_Allow_Callback callback, void* user_data); - // ---- View - // > View Visibility - void Show(); - void Hide(); - // > View Focus - void SetFocus(Eina_Bool focus); - bool HasFocus() const; - // > View Scale - void SetScale(double scale_factor, int x, int y); - double GetScale(); - void DidChangePageScaleFactor(double scale_factor); - void GetPageScaleRange(double *min_scale, double *max_scale); - void DidChangePageScaleRange(double min_scale, double max_scale); - // > View Scroll - bool GetScrollPosition(int* x, int* y) const; - void SetScroll(int x, int y); // TODO: rename to ScrollTo (x,y) x,y is left top (see GetScrollSize) - void GetScrollSize(int* w, int* h); // TODO: rename to GetPossibleScrollSize - // > View Orientation - void SetOrientation(int orientation); - void SetOrientationLockCallback(Ewk_Orientation_Lock_Cb func, void* data); - // > View mode - void SetViewMode(blink::WebViewMode view_mode); - bool IsFullscreen(); - void ExitFullscreen(); - // > View Snapshot - // Get snapshot for given |rect|. Return a new created Evas_Object. - Evas_Object* GetSnapshot(Eina_Rectangle rect); - bool GetSnapshotAsync(Eina_Rectangle rect, Evas* canvas, Ewk_Web_App_Screenshot_Captured_Callback callback, void* user_data); - // > View Misc. - void SetDrawsTransparentBackground(bool enabled); - - // ---- Touch & Hit Test - bool TouchEventsEnabled() const; - void SetTouchEventsEnabled(bool enabled); - void HandleTouchEvents(Ewk_Touch_Event_Type type, const Eina_List *point, const Evas_Modifier *modifiers); - _Ewk_Hit_Test* RequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode); - Eina_Bool AsyncRequestHitTestDataAt(int x, int y, Ewk_Hit_Test_Mode mode, Ewk_View_Hit_Test_Request_Callback, void* user_data); - - // ---- Selection - void QuerySelectionStyle(); - void OnQuerySelectionStyleReply(const SelectionStylePrams& params); - void SelectClosestWord(const gfx::Point& touch_point); - void SelectLinkText(const gfx::Point& touch_point); - bool GetSelectionRange(Eina_Rectangle* left_rect, Eina_Rectangle* right_rect); - bool ClearSelection(); - const char* GetSelectedText() const; - - // ---- Session - void GetSessionData(const char **data, unsigned *length) const; - bool RestoreFromSessionData(const char *data, unsigned length); - - // ---- Settings - void UseSettingsFont(); - void SetMouseEventsEnabled(bool enabled); - bool MouseEventsEnabled() const; - double GetTextZoomFactor() const; - void SetTextZoomFactor(double text_zoom_factor); - bool GetLinkMagnifierEnabled() const; - void SetLinkMagnifierEnabled(bool enabled); - void SetBrowserFont(); // browser specific? make static? - void UpdateWebKitPreferences(); // global? make static - - //---- JavaScript - bool ExecuteJavaScript(const char* script, Ewk_View_Script_Execute_Callback callback, void* userdata); - void SetJavaScriptAlertCallback(Ewk_View_JavaScript_Alert_Callback callback, void* user_data); - void JavaScriptAlertReply(); - void SetJavaScriptConfirmCallback(Ewk_View_JavaScript_Confirm_Callback callback, void* user_data); - void JavaScriptConfirmReply(bool result); - void SetJavaScriptPromptCallback(Ewk_View_JavaScript_Prompt_Callback callback, void* user_data); - void JavaScriptPromptReply(const char* result); - - // ---- Web App - bool WebAppCapableGet(Ewk_Web_App_Capable_Get_Callback callback, void *userData); - bool WebAppIconUrlGet(Ewk_Web_App_Icon_URL_Get_Callback callback, void *userData); - bool WebAppIconUrlsGet(Ewk_Web_App_Icon_URLs_Get_Callback callback, void *userData); - void InvokeWebAppCapableGetCallback(bool capable, int callbackId); - void InvokeWebAppIconUrlGetCallback(const std::string &iconUrl, int callbackId); - void InvokeWebAppIconUrlsGetCallback(const std::map &iconUrls, int callbackId); - - // ---- Notification Permission Request - void SetNotificationPermissionCallback( - Ewk_View_Notification_Permission_Callback callback, - void* user_data); - - // ---- Misc. - bool SaveAsPdf(int width, int height, const std::string& file_name); - // Returns TCP port number with Inspector, or 0 if error. - int StartInspectorServer(int port = 0); - bool StopInspectorServer(); - - - /// ---- Event handling - bool HandleShow(); - bool HandleHide(); - bool HandleMove(int x, int y); - bool HandleResize(int width, int height); - bool HandleTextSelectionDown(int x, int y); - bool HandleTextSelectionUp(int x, int y); - - // TODO: move to private - typedef ::EWebView Impl; - Impl* GetImpl() { return impl_; } - const Impl* GetImpl() const { return impl_; } - - private: - Impl* impl_; - void SetImpl(Impl* impl) { impl_ = impl; } - - WebView(); - ~WebView(); - DISALLOW_COPY_AND_ASSIGN(WebView); - friend class ::WebContentDelegateEfl; -}; - -} // namespace tizen_webview - -#endif // TIZEN_WEBVIEW_PUBLIC_TW_WEBVIEW_H_ diff --git a/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview_delegate.h b/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview_delegate.h index 30a8f8f..e20cf13 100644 --- a/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview_delegate.h +++ b/tizen_src/ewk/efl_integration/tizen_webview/public/tw_webview_delegate.h @@ -33,7 +33,7 @@ class WebViewDelegate { // Retrieve WebView from |evas_object|. // If |evas_object| is not WebView, return NULL. - virtual WebView* GetWebViewFromEvasObject(Evas_Object* evas_object) = 0; + virtual EWebView* GetWebViewFromEvasObject(Evas_Object* evas_object) const = 0; // Check if |evas_object| is WebView or not. virtual bool IsWebViewEvasObject(Evas_Object* evas_object) = 0; diff --git a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc index 774a4a0..5d752c4 100644 --- a/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc +++ b/tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc @@ -10,6 +10,7 @@ #include "private/ewk_custom_handlers_private.h" #include "private/ewk_policy_decision_private.h" #include "private/ewk_user_media_private.h" +#include "private/webview_delegate_ewk.h" #include "browser/javascript_dialog_manager_efl.h" #include "browser/policy_response_delegate_efl.h" #include "browser/inputpicker/color_chooser_efl.h" @@ -130,7 +131,8 @@ WebContents* WebContentsDelegateEfl::OpenURLFromTab( if (!new_object) return NULL; - EWebView* wv = EWebView::FromEvasObject(new_object); + EWebView* wv = WebViewDelegateEwk::GetInstance(). + GetWebViewFromEvasObject(new_object); DCHECK(wv); wv->SetURL(url.spec().c_str()); return NULL; -- 2.7.4