#include <FBase_StringConverter.h>
#include <FCnt_DownloadManagerImpl.h>
#include <FGrp_CoordinateSystem.h>
+#include <FGrp_Screen.h>
#include <FIo_DatabaseImpl.h>
#include <FIo_NormalFile.h>
#include <FSys_VibratorImpl.h>
}
}
+Eina_Bool
+OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
+ String msg;
+ result r = msg.Format(256, L"Allow %s to use offline application cache?", pHostName);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_APP_CACHE, pView, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnIndexedDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
+ String msg;
+ result r = msg.Format(512, L"%s Used %lld of storage. Allow %s to use upto 2GB of indexed db?", pHostName, currentQuota, pHostName);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_INDEXED_DB_QUOTA_EXCEDED, pView, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool
+OnDatabaseQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, const char* database_name, unsigned long long expectedQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
+ String msg;
+ result r = msg.Format(512, L"Allow %s to open %s use upto %lld of web database?", pHostName, database_name, expectedQuota);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_DB_QUOTA_EXCEDED, pView, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
+
+Eina_Bool OnLocalFileSystemQuotaExceeded(Evas_Object* pView, Ewk_Security_Origin* pSecOrigin, long long currentQuota, void* pUserData)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl , "Failed to request");
+
+ const char* pHostName = ewk_security_origin_host_get(pSecOrigin);
+ String msg;
+ result r = msg.Format(512, L"%s Used %lld of storgae. Allow %s to use upto 2GB of file system?", pHostName, currentQuota, pHostName);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ r = pImpl->ShowUserConfirmPopup(USER_CONFIRM_LOCAL_FS_QUOTA_EXCEDED, pView, msg);
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return EINA_TRUE;
+}
+
void
OnGeolocationPermissionRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
//ewk_notification_security_origin_get(pNotification)
const char* text = ewk_notification_body_get(pNotification);
- SysLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
+ SysSecureLog(NID_WEB_CTRL, "The current value of icon path is %s",ewk_notification_icon_url_get(pNotification));
std::unique_ptr<_WebNotification> pNotificationWindow( new (std::nothrow) _WebNotification());
SysTryReturnVoidResult(NID_WEB_CTRL, pNotificationWindow.get(), E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
}
-Eina_Bool
-OnApplicationCachePermissionRequested(Evas_Object* pView, Ewk_Security_Origin* pOrigin, void* pUserData)
-{
- ewk_view_application_cache_permission_reply(pView, EINA_TRUE);
-
- return EINA_TRUE;
-}
-
-
void
OnLoadingRequested(void* pUserData, Evas_Object* pView, void* pEventInfo)
{
OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
{
_WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
- Ewk_Text_Style* pStyle = reinterpret_cast< Ewk_Text_Style* >(pEventInfo);
- SysAssertf(pImpl && pStyle, "Failed to request");
+ SysAssertf(pImpl, "Failed to request");
if (pImpl->GetUiEventListener())
{
}
+void
+OnWebPageBlockSelectedByOrientation(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+ SysAssertf(pImpl, "Failed to request");
+
+ if (!pImpl->IsOrientationChanged())
+ {
+ return;
+ }
+
+ pImpl->SetOrientationChanged(false);
+
+ int orientation = 0;
+ _ControlRotation rotation = _ControlManager::GetInstance()->GetOrientationStatus();
+ switch (rotation)
+ {
+ case _CONTROL_ROTATION_0:
+ orientation = 0;
+ break;
+ case _CONTROL_ROTATION_90:
+ orientation = 90;
+ break;
+ case _CONTROL_ROTATION_180:
+ orientation = 180;
+ break;
+ case _CONTROL_ROTATION_270:
+ orientation = -90;
+ break;
+ }
+ ewk_view_orientation_send(pView, orientation);
+
+ OnWebPageBlockSelected(pUserData, pView, pEventInfo);
+}
+
+
Eina_Bool
OnSelectUploadFile(Evas_Object* pView, Eina_Bool multipleFile, Eina_List* pAcceptTypes, const char* pCapture, void* pUserData)
{
String result(pResult);
SysLog(NID_WEB_CTRL, "result : %ls", result.GetPointer());
- pPresenter->EndAsyncProcess(result);
+ _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(evas_object_data_get(pView, WEB_CTRL));
+ if (pImpl && pImpl->IsPresenterAlived(pPresenter))
+ {
+ pPresenter->EndAsyncProcess(result);
+ }
}
, __isRedirectRequested(false)
, __isCertificateRequested(false)
, __isCertificateConfirmed(false)
+ , __isOrientationChanged(false)
, __keypadBounds(0, 0, 0, 0)
, __pWebCore(null)
, __pUserLoadingListener(null)
, __pColorPicker(null)
, __pVibrator(null)
, __policy(WEB_DECISION_CONTINUE)
+ , __defaultUserAgent(L"")
{
__textSearch.__searchAll = false;
__textSearch.__searchForward = true;
r = __textSearch.__searchQueue.Construct();
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ r = __callbackList.Construct();
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
r = InitJsBridgeList();
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
SetPrivateBrowsingEnabled(pWebSettingImpl->IsPrivateBrowsingEnabled());
SetZoomLevel(pWebSettingImpl->GetZoomLevel());
- pWebSettingImpl->SetUserAgent(ewk_view_user_agent_get(__pWebCore->GetWebNativeNode()));
+ __defaultUserAgent = pWebSettingImpl->GetUserAgent();
r = SetSetting(*pWebSetting);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
String*
-_WebImpl::EvaluateJavascriptN(const String& scriptCode) const
+_WebImpl::EvaluateJavascriptN(const String& scriptCode)
{
- if (scriptCode.GetLength())
+ if (scriptCode.GetLength() == 0)
{
- std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
- SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ return null;
+ }
+
+ result r = E_SUCCESS;
- std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter());
- SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- pPresenter->InitAsyncProcess();
+ std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(scriptCode));
+ SysTryReturn(NID_WEB_CTRL, pScript.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- ewk_view_script_execute(__pWebCore->GetWebNativeNode(), pScript.get(), OnScriptExecuted, pPresenter.get());
+ std::unique_ptr<_WebPresenter> pPresenter(new (std::nothrow) _WebPresenter());
+ SysTryReturn(NID_WEB_CTRL, pPresenter.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- std::unique_ptr<String> pResult(new (std::nothrow) String(L""));
- SysTryReturn(NID_WEB_CTRL, pResult.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- pPresenter->WaitAsyncProcess(*pResult.get());
+ r = __callbackList.Add(pPresenter.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
- return pResult.release();
- }
+ ewk_view_script_execute(__pWebCore->GetWebNativeNode(), pScript.get(), OnScriptExecuted, pPresenter.get());
- return null;
+ std::unique_ptr<String> pResult(new (std::nothrow) String(L""));
+ SysTryReturn(NID_WEB_CTRL, pResult.get(), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ pPresenter->WaitAsyncProcess(*pResult.get());
+
+ r = __callbackList.Remove(*pPresenter.get());
+ SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
+ pPresenter.release();
+
+ return pResult.release();
+}
+
+
+bool
+_WebImpl::IsPresenterAlived(_WebPresenter* pPresenter) const
+{
+ return __callbackList.Contains(*pPresenter);
}
ewk_settings_loads_images_automatically_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoImageLoadEnabled()));
- std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
- SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ if (__defaultUserAgent != setting.GetUserAgent())
+ {
+ std::unique_ptr<char[]> pAgent(_StringConverter::CopyToCharArrayN(setting.GetUserAgent()));
+ SysTryReturn(NID_WEB_CTRL, pAgent.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
+ ewk_view_user_agent_set(__pWebCore->GetWebNativeNode(), pAgent.get());
+ }
ewk_settings_auto_fitting_set(pSettings, static_cast< Eina_Bool >(setting.IsAutoFittingEnabled()));
const HitElementResult*
_WebImpl::GetElementByPointN(const Point& point) const
{
+ return GetElementByPointN(_CoordinateSystemUtils::ConvertToFloat(point));
+}
+
+
+const HitElementResult*
+_WebImpl::GetElementByPointN(const FloatPoint& point) const
+{
+ SysTryReturn(NID_WEB_CTRL, Contains(point), null, E_INVALID_ARG, "[%s] The point must be contained in the bounds of a web control.", GetErrorMessage(E_INVALID_ARG));
+
result r = E_SUCCESS;
_HitElementResultImpl* pHitElementResultImpl = null;
std::unique_ptr<Bitmap> pImage;
std::unique_ptr<HashMap, AllElementsDeleter> pAttributeMap;
- Point absPoint(__pWebCore->GetAbsoluteCoordinate(point));
+ Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(point)));
Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL);
SysTryReturn(NID_WEB_CTRL, pEwkHitTest, null, E_SYSTEM, "[%s] Failed to get hit test.", GetErrorMessage(E_SYSTEM));
}
-const HitElementResult*
-_WebImpl::GetElementByPointN(const FloatPoint& point) const
-{
- const Point integerPoint(_CoordinateSystemUtils::ConvertToInteger(point));
-
- std::unique_ptr<const HitElementResult> pHitElementResult(GetElementByPointN(integerPoint));
- SysTryReturn(NID_WEB_CTRL, pHitElementResult.get(), null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
- return pHitElementResult.release();
-}
-
-
bool
_WebImpl::IsLoading(void) const
{
evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
evas_object_smart_callback_add(pWebNativeNode, "text,style,state", OnWebPageBlockSelected, this);
+ evas_object_smart_callback_add(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation, 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));
ewk_context_vibration_client_callbacks_set(pContext, OnVibrationRequested, OnVibrationCanceled, const_cast< _WebImpl* >(this));
+
ewk_view_application_cache_permission_callback_set(pWebNativeNode, OnApplicationCachePermissionRequested, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, OnIndexedDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, OnDatabaseQuotaExceeded, const_cast< _WebImpl* >(this));
+ ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, OnLocalFileSystemQuotaExceeded, const_cast< _WebImpl* >(this));
evas_object_event_callback_add(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained, this);
}
evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
evas_object_smart_callback_del(pWebNativeNode, "text,style,state", OnWebPageBlockSelected);
+ evas_object_smart_callback_del(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation);
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);
+
ewk_view_application_cache_permission_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_indexed_database_quota_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_database_quota_callback_set(pWebNativeNode, null, null);
+ ewk_view_exceeded_local_file_system_quota_callback_set(pWebNativeNode, null, null);
evas_object_event_callback_del(pWebNativeNode, EVAS_CALLBACK_FOCUS_IN, OnWebNativeNodeFocusGained);
}
result
_WebImpl::SetBlockSelectionPosition(const Point& startPoint)
{
+ return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToFloat(startPoint));
+}
+
+
+result
+_WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
+{
Evas_Object* pWebNativeNode = __pWebCore->GetWebNativeNode();
Ewk_View_Smart_Data* pSmartData = (Ewk_View_Smart_Data*) evas_object_smart_data_get(pWebNativeNode);
SysAssertf(pSmartData, "Failed to request");
- Point absPoint(__pWebCore->GetAbsoluteCoordinate(startPoint));
+ Point absPoint( _CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(startPoint)));
Eina_Bool ret = pSmartData->api->text_selection_down(pSmartData, absPoint.x, absPoint.y);
if (ret)
}
-result
-_WebImpl::SetBlockSelectionPosition(const FloatPoint& startPoint)
-{
- return SetBlockSelectionPosition(_CoordinateSystemUtils::ConvertToInteger(startPoint));
-}
-
-
void
_WebImpl::ReleaseBlock(void)
{
- ewk_view_command_execute(__pWebCore->GetWebNativeNode(), "Unselect", 0);
+ ewk_view_text_selection_range_clear(__pWebCore->GetWebNativeNode());
}
}
+void
+_WebImpl::SetOrientationChanged(bool arg)
+{
+ __isOrientationChanged = arg;
+}
+
+
+bool
+_WebImpl::IsOrientationChanged(void) const
+{
+ return __isOrientationChanged;
+}
+
+
result
_WebImpl::LaunchAppControl(const IEventArg& arg)
{
}
result
-_WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy)
+_WebImpl::ShowUserConfirmPopup(_UserConfirmMode userConfirmMode, void* pPolicy, String msg)
{
result r = E_SUCCESS;
std::unique_ptr<_UserConfirmPopup> pUserConfirmPopup(new (std::nothrow) _UserConfirmPopup());
SysTryReturnResult(NID_WEB_CTRL, pUserConfirmPopup.get(), E_OUT_OF_MEMORY, "Memory Allocation failed.");
- r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, true);
+ r = pUserConfirmPopup->Construct(userConfirmMode, pPolicy, true, msg);
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
__pUserConfirmPopup = std::move(pUserConfirmPopup);
{
__pColorPicker->ChangeLayout(orientation);
}
+
+ __isOrientationChanged = true;
}