}
-Eina_Bool
-OnSelectUploadFile(Evas_Object* pView, Eina_Bool multipleFile, Eina_List* pAcceptTypes, const char* pCapture, void* pUserData)
-{
- std::unique_ptr<_MediaSelectionListener> pMediaListener(new (std::nothrow) _MediaSelectionListener());
- SysTryReturn(NID_WEB_CTRL, pMediaListener.get(), EINA_TRUE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-
- pMediaListener->Construct(pView);
-
- HashMap extraData;
- result r = extraData.Construct();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_TRUE, r, "[%s] Propagating.", GetErrorMessage(r));
-
- String isMultipleSelection(L"single");
- String mode(L"selectionType");
- String type(L"type");
- String fileType = L"*/*";
- String operationId = L"http://tizen.org/appcontrol/operation/pick";
-
- if (multipleFile)
- {
- isMultipleSelection.Append(L"multiple");
- }
-
- if (eina_list_count(pAcceptTypes) == 1)
- {
- String item((char*)eina_list_nth(pAcceptTypes, 0));
- String captureString(pCapture);
-
- if (item.StartsWith("image/",0))
- {
- if (captureString == L"camera")
- {
- fileType = L"image/jpg";
- operationId = L"http://tizen.org/appcontrol/operation/create_content";
- String typeKey = L"http://tizen.org/appcontrol/data/camera/allow_switch";
- String typeVal = L"false";
- extraData.Add(&typeKey, &typeVal);
- }
- else
- {
- fileType = L"image/*";
- String selectKey = L"http://tizen.org/appcontrol/data/selection_mode";
- extraData.Add(&selectKey, &isMultipleSelection);
- }
- }
- else if (item.StartsWith("audio/",0))
- {
- fileType = L"audio/*";
- //TO DO: as microphone is not supported yet. suggest to throw an exception
- //if (captureString == L"microphone")
- //{
- //operationId = L"http://tizen.org/appcontrol/operation/create_content";
- //}
- //else
- //{
- String selectKey = L"http://tizen.org/appcontrol/data/selection_mode";
- extraData.Add(&selectKey, &isMultipleSelection);
- //}
- }
- else if (item.StartsWith("video/",0))
- {
- if (captureString == L"camcorder")
- {
- fileType = L"video/3gpp";
- operationId = L"http://tizen.org/appcontrol/operation/create_content";
- String typeKey = L"http://tizen.org/appcontrol/data/camera/allow_switch";
- String typeVal = L"false";
- extraData.Add(&typeKey, &typeVal);
- }
- else
- {
- fileType = L"video/*";
- String selectKey = L"http://tizen.org/appcontrol/data/selection_mode";
- extraData.Add(&selectKey, &isMultipleSelection);
- }
- }
- }
-
- r = _AppControlImpl::FindAndStart(operationId, null, &fileType, null, &extraData, pMediaListener.get());
- SysTryCatch(NID_WEB_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- pMediaListener.release();
-
- return EINA_TRUE;
-
-CATCH:
- ewk_view_open_panel_reply(pView, null, EINA_FALSE);
- return EINA_TRUE;
-}
-
-
void
OnHandleJavaScriptRequest(void* pUserData, Evas_Object* pView, void* pEventInfo)
{
evas_object_smart_callback_add(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered, this);
evas_object_smart_callback_add(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited, this);
- ewk_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(this));
Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
SysAssertf(pContext, "Failed to get webkit instance.");
ewk_context_did_start_download_callback_set(pContext, OnDidStartDownloadCallback, const_cast< _WebImpl* >(this));
evas_object_smart_callback_del(pWebNativeNode, "fullscreen,enterfullscreen", OnFullScreenEntered);
evas_object_smart_callback_del(pWebNativeNode, "fullscreen,exitfullscreen", OnFullScreenExited);
- ewk_view_open_panel_callback_set(null, null, null);
Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
SysAssertf(pContext, "Failed to get webkit instance.");
ewk_context_vibration_client_callbacks_set(pContext, null, null, null);