ExitFullscreen,
UserMediaPermission,
RegisterProtocolHandler,
+ UnregisterProtocolHandler,
IMEInputPanelShow,
IMEInputPanelHide,
IMECandidatePanelShow,
DECLARE_EWK_VIEW_CALLBACK(ExitFullscreen, "fullscreen,exitfullscreen", void);
DECLARE_EWK_VIEW_CALLBACK(UserMediaPermission, "usermedia,permission,request", _Ewk_User_Media_Permission_Request*);
DECLARE_EWK_VIEW_CALLBACK(RegisterProtocolHandler, "protocolhandler,registration,requested", Ewk_Custom_Handlers_Data*);
+DECLARE_EWK_VIEW_CALLBACK(UnregisterProtocolHandler, "protocolhandler,unregistration,requested", Ewk_Custom_Handlers_Data*);
DECLARE_EWK_VIEW_CALLBACK(IMEInputPanelShow, "editorclient,ime,opened", void);
DECLARE_EWK_VIEW_CALLBACK(IMEInputPanelHide, "editorclient,ime,closed", void);
DECLARE_EWK_VIEW_CALLBACK(IMECandidatePanelShow, "editorclient,candidate,opened", void);
void WebContentsDelegateEfl::RegisterProtocolHandler(WebContents* web_contents,
const std::string& protocol, const GURL& url, bool user_gesture) {
- scoped_ptr<Ewk_Custom_Handlers_Data> protocol_data(
- new Ewk_Custom_Handlers_Data(protocol.c_str(),
- url.host().c_str(), url.spec().c_str()));
- web_view_->SmartCallback<EWebViewCallbacks::RegisterProtocolHandler>().call(protocol_data.get());
+ Ewk_Custom_Handlers_Data protocol_data(protocol.c_str(),
+ url.host().c_str(), url.spec().c_str());
+ web_view_->SmartCallback<EWebViewCallbacks::RegisterProtocolHandler>().call(&protocol_data);
+}
+
+void WebContentsDelegateEfl::UnregisterProtocolHandler(WebContents* web_contents,
+ const std::string& protocol,
+ const GURL& url,
+ bool user_gesture) {
+ Ewk_Custom_Handlers_Data protocol_data(protocol.c_str(),
+ url.host().c_str(), url.spec().c_str());
+ web_view_->SmartCallback<EWebViewCallbacks::UnregisterProtocolHandler>()
+ .call(&protocol_data);
}
#if defined(TIZEN_MULTIMEDIA_SUPPORT)
const GURL& url,
bool user_gesture) override;
+ void UnregisterProtocolHandler(WebContents* web_contents,
+ const std::string& protocol,
+ const GURL& url,
+ bool user_gesture) override;
+
void FindReply(WebContents* web_contents,
int request_id,
int number_of_matches,
<head>
<script>
window.onload = function() {
+ var url = location.protocol + '//' + location.host+location.pathname;
navigator.registerProtocolHandler("mailto",
- "file:///opt/usr/resources/protocol_handler/handler.html?url=%s",
+ url + '?url=%s',
"EFL-Mail");
}
</script>
<head>
<script>
window.onload = function() {
- navigator.unregisterProtocolHandler("mailto",
- "file:///opt/usr/resources/protocol_handler/handler.html?url=%s");
+ var url = location.protocol + '//' + location.host+location.pathname;
+ navigator.unregisterProtocolHandler("mailto", url + '?url=%s');
}
</script>
</head>
: handler_target_(NULL)
, handler_base_url_(NULL)
, handler_url_(NULL)
- , handler_title_(NULL)
{}
~utc_blink_cb_protocolhandler_registration_requested()
if (handler_target_) free(handler_target_);
if (handler_base_url_) free(handler_base_url_);
if (handler_url_) free(handler_url_);
- if (handler_title_) free(handler_title_);
}
- void LoadFinished(Evas_Object *)
+ void LoadFinished(Evas_Object *) override
{
EventLoopStop(Failure);
}
- void PostSetUp()
+ void PostSetUp() override
{
evas_object_smart_callback_add(GetEwkWebView(), "protocolhandler,registration,requested", cb_protocolhandler_registration_requested, this);
}
- void PreTearDown()
+ void PreTearDown() override
{
evas_object_smart_callback_del(GetEwkWebView(), "protocolhandler,registration,requested", cb_protocolhandler_registration_requested);
}
owner->handler_target_ = ewk_custom_handlers_data_target_get(handler_data_) ? strdup(ewk_custom_handlers_data_target_get(handler_data_)) : 0;
owner->handler_base_url_ = ewk_custom_handlers_data_base_url_get(handler_data_) ? strdup(ewk_custom_handlers_data_base_url_get(handler_data_)) : 0;
owner->handler_url_ = ewk_custom_handlers_data_url_get(handler_data_) ? strdup(ewk_custom_handlers_data_url_get(handler_data_)) : 0;
- owner->handler_title_ = ewk_custom_handlers_data_title_get(handler_data_) ? strdup(ewk_custom_handlers_data_title_get(handler_data_)) : 0;
owner->EventLoopStop(Success);
}
char *handler_target_;
char *handler_base_url_;
char *handler_url_;
- char *handler_title_;
-
- static const char * const TARGET;
- static const char * const BASE_URL;
- static const char * const URL;
- static const char * const TITLE;
};
-const char * const utc_blink_cb_protocolhandler_registration_requested::TARGET = "mailto";
-const char * const utc_blink_cb_protocolhandler_registration_requested::BASE_URL = "file:///";
-const char * const utc_blink_cb_protocolhandler_registration_requested::URL = "file:///opt/usr/resources/protocol_handler/handler.html?url=%s";
-const char * const utc_blink_cb_protocolhandler_registration_requested::TITLE = "EFL-Mail";
-
TEST_F(utc_blink_cb_protocolhandler_registration_requested, MAILTO_PROTOCOL_REGISTRATION)
{
- ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl("protocol_handler/register_protocol_handler.html").c_str()));
+ std::string url = GetResourceUrl("protocol_handler/register_protocol_handler.html");
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), url.c_str()));
ASSERT_EQ(Success, EventLoopStart());
- ASSERT_STREQ(TARGET, handler_target_);
- ASSERT_STREQ(BASE_URL, handler_base_url_);
- ASSERT_STREQ(URL, handler_url_);
- ASSERT_STREQ(TITLE, handler_title_);
+ ASSERT_STREQ("mailto", handler_target_);
+ ASSERT_STREQ("", handler_base_url_);
+ ASSERT_STREQ((url + "?url=%s").c_str(), handler_url_);
utc_message("target: %s", handler_target_);
utc_message("base url: %s", handler_base_url_);
utc_message("url: %s", handler_url_);
- utc_message("title: %s", handler_title_);
}
if (handler_title_) free(handler_title_);
}
- void LoadFinished(Evas_Object *)
+ void LoadFinished(Evas_Object *) override
{
EventLoopStop(Failure);
}
- void PostSetUp()
+ void PostSetUp() override
{
evas_object_smart_callback_add(GetEwkWebView(), "protocolhandler,unregistration,requested", cb_protocolhandler_unregistration_requested, this);
}
- void PreTearDown()
+ void PreTearDown() override
{
evas_object_smart_callback_del(GetEwkWebView(), "protocolhandler,unregistration,requested", cb_protocolhandler_unregistration_requested);
}
char *handler_base_url_;
char *handler_url_;
char *handler_title_;
-
- static const char * const TARGET;
- static const char * const BASE_URL;
- static const char * const URL;
};
-const char * const utc_blink_cb_protocolhandler_unregistration_requested::TARGET = "mailto";
-const char * const utc_blink_cb_protocolhandler_unregistration_requested::BASE_URL = "file:///";
-const char * const utc_blink_cb_protocolhandler_unregistration_requested::URL = "file:///opt/usr/resources/protocol_handler/handler.html?url=%s";
-
TEST_F(utc_blink_cb_protocolhandler_unregistration_requested, MAILTO_PROTOCOL_UNREGISTRATION)
{
- ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl("protocol_handler/unregister_protocol_handler.html").c_str()));
+ std::string url = GetResourceUrl("protocol_handler/unregister_protocol_handler.html");
+ ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), url.c_str()));
ASSERT_EQ(Success, EventLoopStart());
- ASSERT_STREQ(TARGET, handler_target_);
- ASSERT_STREQ(BASE_URL, handler_base_url_);
- ASSERT_STREQ(URL, handler_url_);
- utc_message("target: %s", handler_target_);
- utc_message("base url: %s", handler_base_url_);
- utc_message("url: %s", handler_url_);
- utc_message("title: %s", handler_title_);
+ ASSERT_STREQ("mailto", handler_target_);
+ ASSERT_STREQ("", handler_base_url_);
+ ASSERT_STREQ((url + "?url=%s").c_str(), handler_url_);
}