${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_filesystem_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_scheme_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_geolocation_support_webkit2.cpp
+ ${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_usermedia_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/view_logic_web_storage_support.cpp
${PROJECT_SOURCE_DIR}/src/view/webkit/bundles/plugin_module_support.cpp
${VIEW_MODULE_SOURCES}
#include <view_logic_scheme_support.h>
#include <view_logic_filesystem_support.h>
#include <view_logic_geolocation_support_webkit2.h>
+#include <view_logic_usermedia_support.h>
#include <view_logic_web_storage_support.h>
#include "bundles/plugin_module_support.h"
#include <popup-runner/PopupInvoker.h>
const char * const EWK_EDITORCLIENT_IME_OPENED = "editorclient,ime,opened";
const char * const EWK_EDITORCLIENT_IME_CLOSED = "editorclient,ime,closed";
+// EWK Usermedia Callback
+const char * const EWK_USERMEDIA_PERMISSION_REQUEST = "usermedia,permission,request";
+
// Custom handlers
const char * const EWK_PROTOCOLHANDLER_REGISTRATION = "protocolhandler,registration,requested";
const char * const EWK_PROTOCOLHANDLER_ISREGISTERED = "protocolhandler,isregistered";
imeClosedCallback,
this);
+ // usermedia callback
+ evas_object_smart_callback_add(
+ wkView,
+ EWK_USERMEDIA_PERMISSION_REQUEST,
+ usermediaPermissionRequestCallback,
+ this);
+
// custom content/scheme handlers
evas_object_smart_callback_add(
wkView,
EWK_EDITORCLIENT_IME_CLOSED,
imeClosedCallback);
+ // usermedia callback
+ evas_object_smart_callback_del(
+ wkView,
+ EWK_USERMEDIA_PERMISSION_REQUEST,
+ usermediaPermissionRequestCallback);
+
// custom content/scheme handlers
evas_object_smart_callback_del(
wkView,
&args);
}
+void ViewLogic::usermediaPermissionRequestCallback(
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
+{
+ LogDebug("usermediaPermissionRequestCallback called");
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ ViewModule::UsermediaSupport::usermediaPermissionRequest(This->m_window,
+ eventInfo);
+}
+
+
// helper method
CustomHandlerDB::CustomHandlerPtr getCustomHandlerFromData(void* data)
{
Evas_Object* obj,
void* eventInfo);
+ // EWK Usermedia Callback
+ static void usermediaPermissionRequestCallback(
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+
// custom content/scheme handlers
void attachToCustomHandlersDao();
void detachFromCustomHandlersDao();
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file view_logic_usermedia_support.cpp
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ */
+
+#include "view_logic_usermedia_support.h"
+
+#include <string>
+#include <dpl/log/log.h>
+#include <dpl/assert.h>
+#include <Elementary.h>
+#include <EWebKit2.h>
+
+namespace ViewModule {
+
+namespace {
+const char* const USERMEDIA_USE_ASK_BODY =
+ "This application wants to use your media";
+
+// function declare
+void askUserForUsermediaPermission(Evas_Object* window, void* data);
+Evas_Object* getPopup(Evas_Object* button);
+static void popupCallback(void* data, Evas_Object* obj, void* eventInfo);
+
+void askUserForUsermediaPermission(Evas_Object* window, void* data)
+{
+ LogDebug("askUserForUsermediaPermission called");
+
+ Evas_Object* popup = elm_popup_add(window);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_text_set(popup, USERMEDIA_USE_ASK_BODY);
+
+ Evas_Object* lButton = elm_button_add(popup);
+ elm_object_text_set(lButton, "Allow");
+ elm_object_part_content_set(popup, "button1", lButton);
+ evas_object_smart_callback_add(lButton, "clicked", popupCallback, popup);
+
+ Evas_Object* rButton = elm_button_add(popup);
+ elm_object_text_set(rButton, "Deny");
+ elm_object_part_content_set(popup, "button2", rButton);
+ evas_object_smart_callback_add(rButton, "clicked", popupCallback, popup);
+ evas_object_show(popup);
+}
+
+Evas_Object* getPopup(Evas_Object* button)
+{
+ Assert(button);
+
+ Evas_Object* popup = button;
+ while (strcmp(elm_object_widget_type_get(popup), "elm_popup")) {
+ popup = elm_object_parent_widget_get(popup);
+ if (!popup) {
+ return NULL;
+ }
+ }
+ return popup;
+}
+
+void popupCallback(void* data, Evas_Object* obj, void* /*eventInfo*/)
+{
+ LogDebug("popupCallback");
+ Assert(data);
+ Ewk_User_Media_Permission* usermediaPermission =
+ static_cast<Ewk_User_Media_Permission*>(data);
+
+ Assert(obj);
+ Evas_Object* popup = getPopup(obj);
+ Assert(popup);
+ bool allow = !strcmp("Allow", elm_object_text_get(obj));
+
+ Eina_Bool ret = allow ? EINA_TRUE : EINA_FALSE;
+ ewk_user_media_permission_set(usermediaPermission, ret);
+
+ evas_object_hide(popup);
+ evas_object_del(popup);
+}
+} // namespace
+
+void UsermediaSupport::usermediaPermissionRequest(Evas_Object* window,
+ void* data)
+{
+ LogDebug("usermediaPermissionRequest called");
+ Assert(window);
+ Assert(data);
+ // ask to user
+ askUserForUsermediaPermission(window, data);
+ return;
+}
+} // namespace ViewModule
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file view_logic_usermedia_support.h
+ * @author Jihoon Chung (jihoon.chung@samsung.com)
+ */
+
+#ifndef VIEW_LOGIC_USERMEDIA_SUPPORT_H_
+#define VIEW_LOGIC_USERMEDIA_SUPPORT_H_
+
+#include <Elementary.h>
+
+namespace ViewModule {
+namespace UsermediaSupport {
+
+void usermediaPermissionRequest(
+ Evas_Object* window,
+ void* data);
+
+} // namespace UsermediaSupport
+} // namespace ViewModule
+
+#endif // VIEW_LOGIC_USERMEDIA_SUPPORT_H_
\ No newline at end of file