#include <FBaseRtMutexGuard.h>
#include <FBaseSysLog.h>
#include <FBaseUtilUri.h>
-#include <FCntDownloadRequest.h>
#include <FGrpColor.h>
#include <FGrpPoint.h>
#include <FGrpRectangle.h>
#include <FApp_AppInfo.h>
#include <FApp_AppManagerImpl.h>
#include <FBase_StringConverter.h>
-#include <FCnt_DownloadManagerImpl.h>
-#include <FCnt_ContentManagerImpl.h>
#include <FGrp_CoordinateSystem.h>
#include <FGrp_Screen.h>
#include <FIo_DatabaseImpl.h>
String url(ewk_policy_decision_url_get(pPolicy));
SysSecureLog(NID_WEB_CTRL, "The current value of url is %ls", url.GetPointer());
- if (url == L"about:blank")
- {
- ewk_policy_decision_use(pPolicy);
- return;
- }
-
- if (pImpl->GetLoadingListener() && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
+ if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy))
&& !pImpl->IsRedirectRequested())
{
_Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
{
pImpl->DisableAsyncSearch();
}
-
- WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
- Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
- switch (ewkNavigationType)
+ ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
+ if (pLoadingListener)
{
- case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
- navigationType = WEB_NAVIGATION_LINK_CLICKED;
- break;
- case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
- navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
- break;
- case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
- navigationType = WEB_NAVIGATION_BACKFORWARD;
- break;
- case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
- navigationType = WEB_NAVIGATION_RELOAD;
- break;
- case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
- navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
- break;
- case EWK_POLICY_NAVIGATION_TYPE_OTHER:
- navigationType = WEB_NAVIGATION_OTHER;
- break;
- default:
- SysAssert(false);
- }
+ WebNavigationType navigationType = WEB_NAVIGATION_OTHER;
+ Ewk_Policy_Navigation_Type ewkNavigationType = ewk_policy_decision_navigation_type_get(pPolicy);
- if (pImpl->GetLoadingListener()->OnLoadingRequested(url, navigationType))
- {
- ewk_policy_decision_ignore(pPolicy);
+ switch (ewkNavigationType)
+ {
+ case EWK_POLICY_NAVIGATION_TYPE_LINK_CLICKED:
+ navigationType = WEB_NAVIGATION_LINK_CLICKED;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_FORM_SUBMITTED:
+ navigationType = WEB_NAVIGATION_FORM_SUBMITTED;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_BACK_FORWARD:
+ navigationType = WEB_NAVIGATION_BACKFORWARD;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_RELOAD:
+ navigationType = WEB_NAVIGATION_RELOAD;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_FORM_RESUBMITTED:
+ navigationType = WEB_NAVIGATION_FORM_RESUBMITTED;
+ break;
+ case EWK_POLICY_NAVIGATION_TYPE_OTHER:
+ navigationType = WEB_NAVIGATION_OTHER;
+ break;
+ default:
+ SysAssert(false);
+ }
- return;
+ if (pLoadingListener->OnLoadingRequested(url, navigationType))
+ {
+ ewk_policy_decision_ignore(pPolicy);
+
+ return;
+ }
}
}
+ if (url == L"about:blank")
+ {
+ ewk_policy_decision_use(pPolicy);
+
+ return;
+ }
+
String currentUrl(pImpl->GetUrl());
String redirectUrl(pImpl->GetProtocolFromUri(url, currentUrl));
if (redirectUrl != L"")
{
- pImpl->LoadUrl(redirectUrl);
ewk_policy_decision_ignore(pPolicy);
+ pImpl->LoadUrl(redirectUrl);
+
return;
}
uri.SetUri(url);
String uriScheme(uri.GetScheme());
- SysLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
+ SysSecureLog(NID_WEB_CTRL, "The current value of scheme is %ls", uriScheme.GetPointer());
if ((uriScheme != L"http") && (uriScheme != L"https") && (uriScheme != L"file"))
{
result r = E_SUCCESS;
- _SystemResource* pSysResource = _SystemResource::GetInstance();
- SysAssertf(pSysResource != null, "Failed to get _SystemResource instance");
-
- const char* pUrl = ewk_policy_decision_url_get(pPolicy);
int code = ewk_policy_decision_response_status_code_get(pPolicy);
- String mime(ewk_policy_decision_response_mime_get(pPolicy));
- SysSecureLog(NID_WEB_CTRL, "url : %s, mime : %ls, code : %d", pUrl, mime.GetPointer(), code);
-
- String* pFieldValue = null;
- String compareHeader(L"");
- std::unique_ptr<IEnumerator> pFieldValueEnum;
-
- ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
-
String url(ewk_policy_decision_url_get(pPolicy));
+ String mime(ewk_policy_decision_response_mime_get(pPolicy));
+ SysSecureLog(NID_WEB_CTRL, "code : %d, url : %ls, mime : %ls", code, url.GetPointer(), mime.GetPointer());
- const Eina_Hash* pHeader = ewk_policy_decision_response_headers_get(pPolicy);
- HttpHeader httpHeader;
-
- eina_hash_foreach(pHeader, AddHttpHeaderData, &httpHeader);
- SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
- pFieldValueEnum = std::unique_ptr<IEnumerator>(httpHeader.GetFieldValuesN(L"Content-Disposition"));
-
- if( pFieldValueEnum != null)
- {
- pFieldValueEnum->MoveNext();
- pFieldValue = dynamic_cast< String* >(pFieldValueEnum->GetCurrent());
- pFieldValue->SubString(0, 10, compareHeader);
- }
-
- if (pLoadingListener && ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
+ if (ewk_frame_is_main_frame(ewk_policy_decision_frame_get(pPolicy)))
{
- DecisionPolicy policy;
-
if (code >= REDIRECTION_HEADER_GROUP && code < REDIRECTION_HEADER_GROUP + 100)
{
pImpl->SetRedirectRequested(true);
mime = L"";
}
- policy = pLoadingListener->OnWebDataReceived(mime, httpHeader);
- pImpl->SetPolicyDecision(policy);
+ ILoadingListener* pLoadingListener = pImpl->GetLoadingListener();
+ if (pLoadingListener)
+ {
+ const Eina_Hash* pHeader = ewk_policy_decision_response_headers_get(pPolicy);
+ HttpHeader httpHeader;
+
+ eina_hash_foreach(pHeader, AddHttpHeaderData, &httpHeader);
+ SysTryCatch(NID_WEB_CTRL, GetLastResult() == E_SUCCESS, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ pImpl->SetPolicyDecision(pLoadingListener->OnWebDataReceived(mime, httpHeader));
+ }
+ else
+ {
+ pImpl->SetPolicyDecision(WEB_DECISION_CONTINUE);
+ }
}
switch (pImpl->GetPolicyDecision())
return;
}
- if ( String::Compare(compareHeader, L"attachment") != 0 && (pImpl->IsMimeSupported(mime) || mime == L""))
+ if (ewk_policy_decision_type_get(pPolicy) == EWK_POLICY_DECISION_USE)
{
break;
}
-
else
{
ewk_policy_decision_ignore(pPolicy);
r = _AppControlImpl::FindAndStart(operationId, &url, &mime, null, null, null);
SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS || r == E_OBJ_NOT_FOUND, r, "[%s] Propagating.", GetErrorMessage(r));
-
- if (r == E_OBJ_NOT_FOUND)
- {
- _SelectBox* pSelectBox = new (std::nothrow) _SelectBox;
- SysTryReturnVoidResult(NID_WEB_CTRL, pSelectBox, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
-
- r = pSelectBox->Construct(false, L"Select application", 1, null, url);
- SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
- pSelectBox->AddListItem(pSysResource->GetString(_RESOURCE_DOMAIN_ID_OSP, "IDS_TPLATFORM_BODY_DOWNLOAD_ABB"), _SelectBox::LIST_ITEM_TYPE_NORMAL, false);
- r = pSelectBox->ShowPopup();
- SysTryReturnVoidResult(NID_WEB_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
- }
return;
}
break;
}
+
case WEB_DECISION_DOWNLOAD:
{
ewk_policy_decision_ignore(pPolicy);
Ewk_Context* pContext = ewk_view_context_get(pView);
SysAssertf(pContext, "Failed to get webkit instance.");
- pDownloadHandler->StartDownload(pUrl);
+ pDownloadHandler->StartDownload(url);
return;
}
+
case WEB_DECISION_IGNORE:
{
ewk_policy_decision_ignore(pPolicy);
return;
}
+
default:
{
SysAssert(false);
_WebImpl::~_WebImpl()
{
- _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
- pManagerImpl->SetDownloadListener(null);
-
_WebManager* pWebManager = _WebManager::GetInstance();
pWebManager->RemoveWeb(reinterpret_cast< int >(this));
r = InitWebEvent();
SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- _DownloadManagerImpl* pManagerImpl = _DownloadManagerImpl::GetInstance();
- SysTryReturn(NID_WEB_CTRL, pManagerImpl, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-
- pManagerImpl->SetDownloadListener(this);
-
__pWebCore = dynamic_cast< _Web* >(&(GetCore()));
SysTryReturnResult(NID_WEB_CTRL, __pWebCore, E_SYSTEM, "A system error has been occurred. Failed to get web control");
}
-void
-_WebImpl::OnDownloadCompleted(RequestId reqId, const String &path)
-{
- _ContentManagerImpl::ScanFile(path);
-}
-
-
}}} // Tizen::Web::Controls