From: Surya Kumar Date: Wed, 1 Dec 2021 08:20:02 +0000 (+0530) Subject: [M94 Migration] Add internalization of login_popup(Authentication) X-Git-Tag: submit/tizen/20230227.160252~218 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F267582%2F3;p=platform%2Fframework%2Fweb%2Fchromium-efl.git [M94 Migration] Add internalization of login_popup(Authentication) In current implementation, we just call signal of authentication. But we need to offer default popup about authentication. If application developer wants to customize authentication, use "ewk_view_authentication_callback_set". Reference: https://review.tizen.org/gerrit/245896 Change-Id: Ie637aaf65a49c24a126167fed4fc98a74fff7acd Signed-off-by: Surya Kumar --- diff --git a/tizen_src/ewk/efl_integration/BUILD.gn b/tizen_src/ewk/efl_integration/BUILD.gn index 125203a..e956ddf 100644 --- a/tizen_src/ewk/efl_integration/BUILD.gn +++ b/tizen_src/ewk/efl_integration/BUILD.gn @@ -180,6 +180,8 @@ shared_library("chromium-ewk") { } sources += [ + "authentication_challenge_popup.cc", + "authentication_challenge_popup.h", "autofill_popup_view_efl.cc", "autofill_popup_view_efl.h", "browser/background_sync_controller_efl.cc", diff --git a/tizen_src/ewk/efl_integration/authentication_challenge_popup.cc b/tizen_src/ewk/efl_integration/authentication_challenge_popup.cc new file mode 100644 index 0000000..d0a3803 --- /dev/null +++ b/tizen_src/ewk/efl_integration/authentication_challenge_popup.cc @@ -0,0 +1,252 @@ +// Copyright 2021 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 "ewk/efl_integration/authentication_challenge_popup.h" + +#if defined(OS_TIZEN) +#include +#endif + +#include "base/files/file_path.h" +#include "base/path_service.h" +#include "base/strings/utf_string_conversions.h" +#include "content/common/paths_efl.h" +#include "ewk/efl_integration/eweb_view.h" +#include "public/ewk_view.h" + +// Color of text_box border +static const int kBorderColorRed = 10; +static const int kBorderColorGreen = 10; +static const int kBorderColorBlue = 10; + +// Length of text_box border +static const int kBorderWidth = 200; +static const int kBorderHeight = 30; +static const int kBorderThickness = 3; + +AuthenticationChallengePopup::AuthenticationChallengePopup( + Ewk_Auth_Challenge* auth_challenge, + Evas_Object* ewk_view) + : conformant_(nullptr), + ewk_view_(ewk_view), + login_button_(nullptr), + layout_(nullptr), + password_entry_(nullptr), + popup_(nullptr), + user_name_entry_(nullptr), + auth_challenge_(auth_challenge) {} + +AuthenticationChallengePopup::~AuthenticationChallengePopup() { + if (login_button_) + evas_object_smart_callback_del(login_button_, "clicked", + AuthenticationLoginCallback); +#if defined(OS_TIZEN) + if (popup_) { + eext_object_event_callback_del(popup_, EEXT_CALLBACK_BACK, + HwBackKeyCallback); + } +#endif + if (conformant_) { + evas_object_del(conformant_); + conformant_ = nullptr; + } +} + +void AuthenticationChallengePopup::AuthenticationLoginCallback( + void* data, + Evas_Object* obj, + void* event_info) { + auto auth_challenge_popup = static_cast(data); + if (!auth_challenge_popup) { + LOG(ERROR) << "Showing authentication popup failed"; + return; + } + + const char* username = + elm_entry_entry_get(auth_challenge_popup->user_name_entry_); + const char* password = + elm_entry_entry_get(auth_challenge_popup->password_entry_); + ewk_auth_challenge_credential_use(auth_challenge_popup->auth_challenge_, + username, password); + delete auth_challenge_popup; +} + +#if defined(OS_TIZEN) +void AuthenticationChallengePopup::HwBackKeyCallback(void* data, + Evas_Object* obj, + void* event_info) { + auto* auth_challenge_popup = static_cast(data); + if (!auth_challenge_popup) { + LOG(ERROR) << "Showing authentication popup failed"; + return; + } + ewk_auth_challenge_credential_cancel(auth_challenge_popup->auth_challenge_); + delete auth_challenge_popup; +} +#endif + +Evas_Object* AuthenticationChallengePopup::CreateBorder( + const std::string& text, + Evas_Object* entry_box) { + Evas_Object* border = elm_bg_add(popup_); + if (!border) + return nullptr; + + elm_bg_color_set(border, kBorderColorRed, kBorderColorGreen, + kBorderColorBlue); + if (!text.compare("border_up") || !text.compare("border_down")) + evas_object_size_hint_min_set(border, kBorderWidth, kBorderThickness); + else + evas_object_size_hint_min_set(border, kBorderThickness, kBorderHeight); + + evas_object_show(border); + elm_object_part_content_set(entry_box, text.c_str(), border); + + return border; +} + +Evas_Object* AuthenticationChallengePopup::CreateTextBox( + const char* edj_path, + Evas_Object* container_box) { + Evas_Object* entry_box = elm_layout_add(popup_); + if (!entry_box) + return nullptr; + elm_layout_file_set(entry_box, edj_path, "authentication_challenge"); + + Evas_Object* text_box = elm_entry_add(entry_box); + if (!text_box) + return nullptr; + elm_entry_single_line_set(text_box, EINA_TRUE); + elm_object_focus_set(text_box, EINA_TRUE); + elm_entry_scrollable_set(text_box, true); + evas_object_show(text_box); + + elm_object_part_content_set(entry_box, "elm.swallow.entry", text_box); + + CreateBorder("border_up", entry_box); + CreateBorder("border_down", entry_box); + CreateBorder("border_left", entry_box); + CreateBorder("border_right", entry_box); + + elm_box_pack_end(container_box, entry_box); + evas_object_show(entry_box); + + return text_box; +} + +bool AuthenticationChallengePopup::CreateTextLabel(const char* text, + Evas_Object* container_box) { + Evas_Object* text_label = elm_label_add(popup_); + if (!text_label) + return false; + elm_object_text_set(text_label, text); + elm_box_pack_end(container_box, text_label); + evas_object_show(text_label); + return true; +} + +Evas_Object* AuthenticationChallengePopup::CreateContainerBox() { + Evas_Object* box = elm_box_add(popup_); + if (!box) + return nullptr; + evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_show(box); + + if (!CreateTextLabel(dgettext("WebKit", "IDS_WEBVIEW_BODY_USERNAME"), box)) + return nullptr; + base::FilePath edj_dir, authentication_edj; + base::PathService::Get(PathsEfl::EDJE_RESOURCE_DIR, &edj_dir); + authentication_edj = + edj_dir.Append(FILE_PATH_LITERAL("AuthenticationPopup.edj")); + + user_name_entry_ = + CreateTextBox(authentication_edj.AsUTF8Unsafe().c_str(), box); + if (!user_name_entry_) + return nullptr; + + if (!CreateTextLabel(dgettext("WebKit", "IDS_WEBVIEW_BODY_PASSWORD"), box)) + return nullptr; + + password_entry_ = + CreateTextBox(authentication_edj.AsUTF8Unsafe().c_str(), box); + if (!password_entry_) + return nullptr; + elm_entry_password_set(password_entry_, EINA_TRUE); + elm_entry_input_panel_layout_set(password_entry_, + ELM_INPUT_PANEL_LAYOUT_PASSWORD); + + return box; +} + +bool AuthenticationChallengePopup::ShowAuthenticationPopup(const char* url) { + Evas_Object* parent = + elm_object_top_widget_get(elm_object_parent_widget_get(ewk_view_)); + if (!parent) + parent = ewk_view_; + + conformant_ = elm_conformant_add(parent); + if (!conformant_) + return false; + + evas_object_size_hint_weight_set(conformant_, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_win_resize_object_add(parent, conformant_); + + layout_ = elm_layout_add(conformant_); + if (!layout_) + return false; + elm_layout_theme_set(layout_, "layout", "application", "default"); + evas_object_size_hint_weight_set(layout_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_content_set(conformant_, layout_); + evas_object_show(layout_); + + popup_ = elm_popup_add(layout_); + if (!popup_) + return false; + elm_object_part_text_set(popup_, "title,text", url); + + Evas_Object* box = CreateContainerBox(); + if (!box) + return false; + elm_object_content_set(popup_, box); + login_button_ = elm_button_add(popup_); + if (!login_button_) + return false; + elm_object_style_set(login_button_, "popup"); + evas_object_size_hint_weight_set(login_button_, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(login_button_, EVAS_HINT_FILL, + EVAS_HINT_FILL); + elm_object_text_set(login_button_, dgettext("WebKit", "IDS_BR_BODY_LOG_IN")); + elm_box_pack_end(box, login_button_); + elm_object_part_content_set(popup_, "button1", login_button_); + evas_object_show(login_button_); + + evas_object_smart_callback_add(login_button_, "clicked", + AuthenticationLoginCallback, this); +#if defined(OS_TIZEN) + eext_object_event_callback_add(popup_, EEXT_CALLBACK_BACK, HwBackKeyCallback, + this); +#endif + evas_object_show(popup_); + + return true; +} + +void AuthenticationChallengePopup::CreateAndShow( + Ewk_Auth_Challenge* auth_challenge, + Evas_Object* ewk_view) { + if (!auth_challenge) + return; + auto popup = new AuthenticationChallengePopup(auth_challenge, ewk_view); + + const char* url = ewk_auth_challenge_url_get(auth_challenge); + + ewk_auth_challenge_suspend(auth_challenge); + if (!popup->ShowAuthenticationPopup(url)) { + LOG(ERROR) << "Showing authentication popup is failed"; + ewk_auth_challenge_credential_cancel(auth_challenge); + delete popup; + } +} diff --git a/tizen_src/ewk/efl_integration/authentication_challenge_popup.h b/tizen_src/ewk/efl_integration/authentication_challenge_popup.h new file mode 100644 index 0000000..5d2766f --- /dev/null +++ b/tizen_src/ewk/efl_integration/authentication_challenge_popup.h @@ -0,0 +1,46 @@ +// Copyright 2021 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 EWK_EFL_INTEGRATION_AUTHENTICATION_CHALLENGE_POPUP_H_ +#define EWK_EFL_INTEGRATION_AUTHENTICATION_CHALLENGE_POPUP_H_ + +#include +#include + +#include "public/ewk_auth_challenge_internal.h" + +class AuthenticationChallengePopup { + public: + ~AuthenticationChallengePopup(); + + static void CreateAndShow(Ewk_Auth_Challenge* auth_challenge, + Evas_Object* ewk_view); + + private: + explicit AuthenticationChallengePopup(Ewk_Auth_Challenge* auth_challenge, + Evas_Object* ewk_view); + + bool ShowAuthenticationPopup(const char* url); + static void AuthenticationLoginCallback(void* data, + Evas_Object* obj, + void* event_info); +#if defined(OS_TIZEN) + static void HwBackKeyCallback(void* data, Evas_Object* obj, void* event_info); +#endif + Evas_Object* CreateBorder(const std::string& text, Evas_Object* entry_box); + Evas_Object* CreateContainerBox(); + Evas_Object* CreateTextBox(const char* edj_path, Evas_Object* container_box); + bool CreateTextLabel(const char* edj_path, Evas_Object* container_box); + + Evas_Object* conformant_; + Evas_Object* ewk_view_; + Evas_Object* login_button_; + Evas_Object* layout_; + Evas_Object* password_entry_; + Evas_Object* popup_; + Evas_Object* user_name_entry_; + Ewk_Auth_Challenge* auth_challenge_; +}; + +#endif // EWK_EFL_INTEGRATION_AUTHENTICATION_CHALLENGE_POPUP_H_ \ No newline at end of file diff --git a/tizen_src/ewk/efl_integration/eweb_view.cc b/tizen_src/ewk/efl_integration/eweb_view.cc index d19ceba..52b66e3 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.cc +++ b/tizen_src/ewk/efl_integration/eweb_view.cc @@ -533,13 +533,18 @@ void EWebView::Hide() { web_contents_->WasHidden(); } +void EWebView::SetViewAuthCallback(Ewk_View_Authentication_Callback callback, + void* user_data) { + authentication_cb_.Set(callback, user_data); +} + void EWebView::InvokeAuthCallback(LoginDelegateEfl* login_delegate, const GURL& url, const std::string& realm) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); auth_challenge_.reset(new _Ewk_Auth_Challenge(login_delegate, url, realm)); - SmartCallback().call(auth_challenge_.get()); + authentication_cb_.Run(evas_object_, auth_challenge_.get()); if (!auth_challenge_->is_decided && !auth_challenge_->is_suspended) { auth_challenge_->is_decided = true; diff --git a/tizen_src/ewk/efl_integration/eweb_view.h b/tizen_src/ewk/efl_integration/eweb_view.h index 124652a..b4abe90 100644 --- a/tizen_src/ewk/efl_integration/eweb_view.h +++ b/tizen_src/ewk/efl_integration/eweb_view.h @@ -253,6 +253,9 @@ class EWebView { int error_code, const std::string& error_description, bool is_main_frame); + + void SetViewAuthCallback(Ewk_View_Authentication_Callback callback, + void* user_data); void InvokeAuthCallback(LoginDelegateEfl* login_delegate, const GURL& url, const std::string& realm); @@ -580,6 +583,8 @@ class EWebView { WebViewCallback quota_request_callback_; + WebViewCallback + authentication_cb_; std::unique_ptr inputPicker_; base::IDMap diff --git a/tizen_src/ewk/efl_integration/eweb_view_callbacks.h b/tizen_src/ewk/efl_integration/eweb_view_callbacks.h index e23a4bd..95aac0b 100644 --- a/tizen_src/ewk/efl_integration/eweb_view_callbacks.h +++ b/tizen_src/ewk/efl_integration/eweb_view_callbacks.h @@ -99,7 +99,6 @@ enum CallbackType { GeoLocationPermissionRequest, GeoLocationValid, RequestCertificateConfirm, - AuthChallenge, SetCertificatePem, PolicyResponseDecide, ContextMenuCustomize, @@ -237,7 +236,6 @@ DECLARE_EWK_VIEW_CALLBACK(LoadCommitted, "load,committed", void); DECLARE_EWK_VIEW_CALLBACK(GeoLocationPermissionRequest, "geolocation,permission,request", _Ewk_Geolocation_Permission_Request*); DECLARE_EWK_VIEW_CALLBACK(GeoLocationValid, "geolocation,valid", Eina_Bool*); DECLARE_EWK_VIEW_CALLBACK(RequestCertificateConfirm, "request,certificate,confirm", _Ewk_Certificate_Policy_Decision*); -DECLARE_EWK_VIEW_CALLBACK(AuthChallenge, "authentication,challenge", _Ewk_Auth_Challenge*); DECLARE_EWK_VIEW_CALLBACK(SetCertificatePem, "certificate,pem,set", const char*); DECLARE_EWK_VIEW_CALLBACK(PolicyResponseDecide, "policy,response,decide", _Ewk_Policy_Decision*); DECLARE_EWK_VIEW_CALLBACK(ContextMenuCustomize, "contextmenu,customize", _Ewk_Context_Menu*); diff --git a/tizen_src/ewk/efl_integration/public/ewk_view.cc b/tizen_src/ewk/efl_integration/public/ewk_view.cc index 67696bb..a95082e5 100644 --- a/tizen_src/ewk/efl_integration/public/ewk_view.cc +++ b/tizen_src/ewk/efl_integration/public/ewk_view.cc @@ -22,6 +22,7 @@ #include +#include "authentication_challenge_popup.h" #include "content/public/browser/navigation_controller.h" #include "cookie_manager.h" #include "eweb_view.h" @@ -56,6 +57,9 @@ static Eina_Bool _ewk_view_default_geolocation_permission( static Eina_Bool _ewk_view_default_notification_permission( Evas_Object*, Ewk_Notification_Permission_Request*, void*); +static void _ewk_view_default_authentication( + Evas_Object*, Ewk_Auth_Challenge*, void*); + Eina_Bool ewk_view_smart_class_set(Ewk_View_Smart_Class* api) { EINA_SAFETY_ON_NULL_RETURN_VAL(api, false); @@ -95,6 +99,8 @@ Evas_Object* ewk_view_add_with_context(Evas* e, Ewk_Context* context) _ewk_view_default_geolocation_permission, 0); ewk_view_notification_permission_callback_set(ewk_view, _ewk_view_default_notification_permission, 0); + ewk_view_authentication_callback_set(ewk_view, + _ewk_view_default_authentication, nullptr); } return ewk_view; @@ -1333,6 +1339,23 @@ void ewk_view_request_manifest_from_url(Evas_Object* o, Ewk_View_Request_Manifes LOG_EWK_API_MOCKUP(); } +void ewk_view_authentication_callback_set( + Evas_Object* ewk_view, + Ewk_View_Authentication_Callback callback, + void* user_data) +{ + EWK_VIEW_IMPL_GET_OR_RETURN(ewk_view, impl); + impl->SetViewAuthCallback(callback, user_data); + +} + +static void _ewk_view_default_authentication(Evas_Object* ewk_view, + Ewk_Auth_Challenge* auth_challenge, + void* user_data) +{ + AuthenticationChallengePopup::CreateAndShow(auth_challenge, ewk_view); +} + void ewk_view_app_installation_request_callback_set(Evas_Object* o, Ewk_App_Installation_Request_Callback callback, void* user_data) { LOG_EWK_API_MOCKUP(); diff --git a/tizen_src/ewk/efl_integration/resource/AuthenticationPopup.edc b/tizen_src/ewk/efl_integration/resource/AuthenticationPopup.edc new file mode 100644 index 0000000..8df1cca --- /dev/null +++ b/tizen_src/ewk/efl_integration/resource/AuthenticationPopup.edc @@ -0,0 +1,115 @@ +collections { + group { + name: "authentication_challenge"; + parts { + part { + name: "background"; + type: RECT; + scale : 1; + description { + state: "default" 0.0; + min: 200 30; + max: 200 30; + visible: 1; + } + } + part { + name: "elm.swallow.entry"; + type: SWALLOW; + scale : 1; + description { + state: "default" 0.0; + align: 0.0 0.0; + min: 200 30; + max: 200 30; + color: 0 217 217 255; + visible: 1; + rel1{ + relative: 0 0; + to: "background"; + } + rel2{ + relative: 1 1; + to: "background"; + } + } + } + part { + name: "border_up"; + type: SWALLOW; + scale : 1; + description { + state: "default" 0.0; + align: 0 0; + visible: 1; + fixed: 1 1; + rel1{ + relative: 0 0; + to: "background"; + } + rel2{ + relative: 1 0; + to: "background"; + } + } + } + part { + name: "border_down"; + type: SWALLOW; + scale : 1; + description { + state: "default" 0.0; + align: 1 1; + visible: 1; + fixed: 1 1; + rel1{ + relative: 0 1; + to: "background"; + } + rel2{ + relative: 1 1; + to: "background"; + } + } + } + part { + name: "border_left"; + type: SWALLOW; + scale : 1; + description { + state: "default" 0.0; + align: 0 0; + visible: 1; + fixed: 1 1; + rel1{ + relative: 0 0; + to: "background"; + } + rel2{ + relative: 0 1; + to: "background"; + } + } + } + part { + name: "border_right"; + type: SWALLOW; + scale : 1; + description { + state: "default" 0.0; + align: 0 0; + visible: 1; + fixed: 1 1; + rel1{ + relative: 1 0; + to: "background"; + } + rel2{ + relative: 1 1; + to: "background"; + } + } + } + } + } +} \ No newline at end of file diff --git a/tizen_src/ewk/efl_integration/resource/BUILD.gn b/tizen_src/ewk/efl_integration/resource/BUILD.gn index ed22cfe..274481b 100644 --- a/tizen_src/ewk/efl_integration/resource/BUILD.gn +++ b/tizen_src/ewk/efl_integration/resource/BUILD.gn @@ -30,6 +30,7 @@ template("edje_res_ewk") { edje_res_ewk("edje_resources_ewk") { sources = [ + "AuthenticationPopup.edc", "AutofillPopup.edc", "JavaScriptPopup.edc", "control.edc", diff --git a/tizen_src/ewk/efl_webview_app/app.c b/tizen_src/ewk/efl_webview_app/app.c index 98b1f4f..f98652c 100644 --- a/tizen_src/ewk/efl_webview_app/app.c +++ b/tizen_src/ewk/efl_webview_app/app.c @@ -88,7 +88,7 @@ static void __did_start_provisional_load_for_frame_cb(void *data, Evas_Object *o static void __did_commit_load_for_frame(void *data, Evas_Object *obj, void *event_info); static void __geoLocation_popup_display_cb(void *data, Evas_Object *obj, void *event_info); void __script_executed_cb(Evas_Object *obj, const char *javascript_result, void *data); -static void __auth_challenge_cb(void* data, Evas_Object *obj, void *event_info); +static void __auth_challenge_cb(Evas_Object* ewk_view, Ewk_Auth_Challenge* auth_challenge, void* user_data); static void __policy_response_decide_cb(void *data, Evas_Object *obj, void *event_info); static void __customize_context_menu_cb(void* data, Evas_Object *obj, void *event_info); static void __customize_context_menu_item_selected_cb(void* data, Evas_Object *obj, void *event_info); @@ -538,7 +538,6 @@ int main(int argc, char** argv) evas_object_smart_callback_add(view, "load,committed", __did_commit_load_for_frame, 0); evas_object_smart_callback_add(view, "load,provisional,started", __did_start_provisional_load_for_frame_cb, 0); evas_object_smart_callback_add(view, "geolocation,permission,request", __geoLocation_popup_display_cb,0); - evas_object_smart_callback_add(view, "authentication,challenge", __auth_challenge_cb, 0); evas_object_smart_callback_add(view, "policy,response,decide", __policy_response_decide_cb, 0); evas_object_smart_callback_add(view, "contextmenu,customize", __customize_context_menu_cb, 0); evas_object_smart_callback_add(view, "contextmenu,selected", __customize_context_menu_item_selected_cb, 0); @@ -565,6 +564,7 @@ int main(int argc, char** argv) ewk_view_custom_header_add(view, "X-Test-header", "X-Value-1"); ewk_view_notification_permission_callback_set(view, __notification_permission_cb, 0); + ewk_view_authentication_callback_set(view, __auth_challenge_cb, NULL); #if defined(OS_TIZEN) if (IsMobileProfile() || IsWearableProfile()) { @@ -850,13 +850,14 @@ void __navigation_policy_decide_cb(void *data, Evas_Object *obj, void *event_inf ewk_policy_decision_use(decision); } -void __auth_challenge_cb(void* data, Evas_Object *obj, void *event_info) +void __auth_challenge_cb(Evas_Object* ewk_view, Ewk_Auth_Challenge* auth_challenge, void* user_data) { printf("APP.C callback called __auth_challenge_cb \n"); - Ewk_Auth_Challenge* auth_challenge = (Ewk_Auth_Challenge*)event_info; auth_challenge_holder = auth_challenge; - if (!auth_challenge) + if (!auth_challenge) { fprintf(stderr, "auth_challenge NULL\n"); + return; + } const char* realm = ewk_auth_challenge_realm_get(auth_challenge); const char* url = ewk_auth_challenge_url_get(auth_challenge); diff --git a/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_credential_cancel_func.cpp b/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_credential_cancel_func.cpp index a834487..b577874 100755 --- a/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_credential_cancel_func.cpp +++ b/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_credential_cancel_func.cpp @@ -10,12 +10,14 @@ static Eina_Bool is_Authenticated; class utc_blink_ewk_auth_challenge_credential_cancel : public utc_blink_ewk_base { protected: - void PostSetUp() { - evas_object_smart_callback_add(GetEwkWebView(), "authentication,challenge", authentication_challenge, this); + void PostSetUp() override + { + ewk_view_authentication_callback_set(GetEwkWebView(), AuthenticationChallenge, this); } - void PreTearDown() { - evas_object_smart_callback_del(GetEwkWebView(), "authentication,challenge", authentication_challenge); + void PreTearDown() override + { + ewk_view_authentication_callback_set(GetEwkWebView(), nullptr, nullptr); } void LoadFinished(Evas_Object* webview) @@ -23,12 +25,11 @@ protected: EventLoopStop(utc_blink_ewk_base::Failure); // will noop if EventLoopStop was alraedy called } - static void authentication_challenge(void* data, Evas_Object* webview, void* event_info) + static void AuthenticationChallenge(Evas_Object* o, Ewk_Auth_Challenge* auth_challenge, void* data) { utc_blink_ewk_auth_challenge_credential_cancel *owner = static_cast(data); utc_message("[authentication_challenge] :: "); - Ewk_Auth_Challenge* auth_challenge = (Ewk_Auth_Challenge*)event_info; if (!auth_challenge) { owner->EventLoopStop(utc_blink_ewk_base::Failure); return; diff --git a/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_credential_use_func.cpp b/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_credential_use_func.cpp index 1895cad..8b5467c 100755 --- a/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_credential_use_func.cpp +++ b/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_credential_use_func.cpp @@ -9,14 +9,15 @@ class utc_blink_ewk_auth_challenge_credential_use : public utc_blink_ewk_base { protected: - void PostSetUp() + void PostSetUp() override { - evas_object_smart_callback_add( GetEwkWebView(), "authentication,challenge", authentication_challenge, this); + ewk_view_authentication_callback_set(GetEwkWebView(), AuthenticationChallenge, this); } - void PreTearDown() + void PreTearDown() override { evas_object_smart_callback_del( GetEwkWebView(), "authentication,challenge", authentication_challenge); + ewk_view_authentication_callback_set(GetEwkWebView(), nullptr, nullptr); } void LoadFinished(Evas_Object* webview) @@ -24,12 +25,11 @@ protected: EventLoopStop( utc_blink_ewk_base::Failure ); // will noop if EventLoopStop was alraedy called } - static void authentication_challenge(void* data, Evas_Object* webview, void* event_info) + static void AuthenticationChallenge(Evas_Object* o, Ewk_Auth_Challenge* auth_challenge, void* data) { utc_message("[authentication_challenge] :: "); utc_blink_ewk_auth_challenge_credential_use *owner = static_cast(data); - Ewk_Auth_Challenge* auth_challenge = (Ewk_Auth_Challenge*)event_info; if (!auth_challenge) { owner->EventLoopStop( utc_blink_ewk_base::Failure ); // will noop if EventLoopStop was alraedy called utc_fail(); diff --git a/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_realm_get_func.cpp b/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_realm_get_func.cpp index 2ab69da..35db7b4 100755 --- a/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_realm_get_func.cpp +++ b/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_realm_get_func.cpp @@ -8,14 +8,14 @@ class utc_blink_ewk_auth_challenge_realm_get : public utc_blink_ewk_base { protected: - void PostSetUp() + void PostSetUp() override { - evas_object_smart_callback_add(GetEwkWebView(), "authentication,challenge", authentication_challenge, this); + ewk_view_authentication_callback_set(GetEwkWebView(), AuthenticationChallenge, this); } - void PreTearDown() + void PreTearDown() override { - evas_object_smart_callback_del(GetEwkWebView(), "authentication,challenge", authentication_challenge); + ewk_view_authentication_callback_set(GetEwkWebView(), nullptr, nullptr); } void LoadFinished(Evas_Object* webview) @@ -23,19 +23,16 @@ protected: EventLoopStop( utc_blink_ewk_base::Failure ); // will noop if EventLoopStop was alraedy called } - static void authentication_challenge(void* data, Evas_Object* webview, void* event_info) + static void AuthenticationChallenge(Evas_Object* o, Ewk_Auth_Challenge* auth_challenge, void* data) { ASSERT_TRUE(data != NULL); utc_blink_ewk_auth_challenge_realm_get *owner = static_cast(data); - Ewk_Auth_Challenge* auth_challenge = static_cast(event_info); - - if(auth_challenge) + if (auth_challenge) { std::string realm = ewk_auth_challenge_realm_get(auth_challenge); - if( realm == "Widget TestCases EARLY ACCESS" ) { - + if (realm == "Widget TestCases EARLY ACCESS") { owner->EventLoopStop(utc_blink_ewk_base::Success); return; } diff --git a/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_suspend_func.cpp b/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_suspend_func.cpp index 7e6baa4..b721c5a 100755 --- a/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_suspend_func.cpp +++ b/tizen_src/ewk/unittest/utc_blink_ewk_auth_challenge_suspend_func.cpp @@ -8,14 +8,14 @@ class utc_blink_ewk_auth_challenge_suspend : public utc_blink_ewk_base { protected: - void PostSetUp() + void PostSetUp() override { - evas_object_smart_callback_add(GetEwkWebView(), "authentication,challenge", authentication_challenge, this); + ewk_view_authentication_callback_set(GetEwkWebView(), AuthenticationChallenge, this); } - void PreTearDown() + void PreTearDown() override { - evas_object_smart_callback_del(GetEwkWebView(), "authentication,challenge", authentication_challenge); + ewk_view_authentication_callback_set(GetEwkWebView(), nullptr, nullptr); } void LoadFinished(Evas_Object* webview) @@ -23,7 +23,7 @@ protected: EventLoopStop( utc_blink_ewk_base::Failure ); // will noop if EventLoopStop was alraedy called } - static void authentication_challenge(void* data, Evas_Object* webview, void* event_info) + static void AuthenticationChallenge(Evas_Object* o, Ewk_Auth_Challenge* auth_challenge, void* data) { ASSERT_TRUE(data != NULL); @@ -31,7 +31,7 @@ protected: Ewk_Auth_Challenge* auth_challenge = static_cast(event_info); - if(auth_challenge) + if (auth_challenge) { ewk_auth_challenge_suspend(auth_challenge);