* The file contains the definition of _EflWebkit class.
*/
#include <unique_ptr.h>
+#include <vconf.h>
#include <EWebKit2.h>
#include <net_connection.h>
#include <FAppApp.h>
#include <FGrpPoint.h>
#include <FGrpRectangle.h>
-#include <FIoDbEnumerator.h>
+#include <FSysVibrator.h>
#include <FUiAnimVisualElement.h>
-#include <FApp_AppInfo.h>
#include <FBaseSysLog.h>
#include <FBase_StringConverter.h>
#include <FGrp_CoordinateSystem.h>
-#include <FIo_DirectoryImpl.h>
-#include <FIo_DatabaseImpl.h>
-#include <FIo_FileImpl.h>
#include <FSecCert_CertService.h>
+#include <FUi_Control.h>
+#include <FUi_Window.h>
#include "FUiAnim_EflNode.h"
#include "FUiAnim_VisualElementImpl.h"
+#include "FUiAnim_VisualElementSurfaceImpl.h"
#include "FWebCtrl_EflWebkit.h"
#include "FWebCtrl_Utility.h"
#include "FWebCtrl_WebImpl.h"
static const char PLUGIN_DIRECTORY_PATH[] = "/usr/lib/osp/browser-plugin/";
-
-extern const wchar_t CUSTOM_DB_DIRECTORY_PATH[] = L"data/.webkit/customDatabase/";
-extern const wchar_t USER_CONFIRM_DB_NAME[] = L"userConfirm.db";
-extern const wchar_t GEOLOCATION_TABLE_NAME[] = L"geolocationPermission";
-extern const wchar_t CUSTOM_PROTOCOL_TABLE_NAME[] = L"customProtocol";
-extern const wchar_t CUSTOM_CONTENT_TABLE_NAME[] = L"customContent";
-
-
-static const int CUSTOM_DB_TABLE_COUNT= 3;
+static const wchar_t ICON_DB_DIRECTORY_PATH[] = L"data/.webkit/iconDatabase/";
+static const wchar_t ICON_DB_FILE_NAME[] = L"icon.db";
_EflWebkit::_EflWebkit(void)
: __pWebFrame(null)
+ , __pContainerVisualElement(null)
+ , __pSurface(null)
{
}
_EflWebkit::~_EflWebkit(void)
{
-// evas_object_smart_member_del(__pWebFrame);
- evas_object_del(__pWebFrame);
- __pWebFrame = null;
+ if (__pContainerVisualElement)
+ {
+ __pContainerVisualElement->SetSurface(null);
+ }
+
+ delete __pSurface;
+ __pSurface = null;
+
+ if (__pWebFrame)
+ {
+ evas_object_del(__pWebFrame);
+ __pWebFrame = null;
+ }
}
result
-_EflWebkit::Construct(const Rectangle& rect, VisualElement& containerVisualElement)
+_EflWebkit::Construct(const Rectangle& rect, VisualElement& containerVisualElement, _Control* pControl)
{
result r = E_SUCCESS;
evas_object_resize(__pWebFrame, pXformer->TransformHorizontal(rect.width), pXformer->TransformVertical(rect.height));
evas_object_move(__pWebFrame, pXformer->TransformHorizontal(rect.x), pXformer->TransformVertical(rect.y));
+#if 0
pEflNode->AddNativeSmartObject(containerVisualElement, __pWebFrame);
+#else
+ __pContainerVisualElement = &containerVisualElement;
+
+ DisplayContext* pDisplayContext = pControl->GetRootWindow()->GetDisplayContext();
+ SysTryReturn(NID_WEB_CTRL, pDisplayContext, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ __pSurface = _VisualElementSurfaceImpl::CreateSurfaceUsingExistingObjectN(*pDisplayContext, (Handle)__pWebFrame, Dimension(rect.width, rect.height));
+ SysTryReturn(NID_WEB_CTRL, __pSurface, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ containerVisualElement.SetSurface(__pSurface);
+#endif
return E_SUCCESS;
}
Ewk_Context* pContext = ewk_view_context_get(__pWebFrame);
SysAssertf(pContext, "Failed to request.");
- ewk_view_text_selection_enable_set(__pWebFrame, EINA_FALSE);
+ Ewk_Settings* pSettings = ewk_view_settings_get(__pWebFrame);
+ SysAssertf(pSettings, "Failed to get webkit instance.");
- ewk_context_additional_plugin_path_set(pContext, PLUGIN_DIRECTORY_PATH);
+ ewk_context_cache_model_set(pContext, EWK_CACHE_MODEL_PRIMARY_WEBBROWSER);
- String certPath(_CertService::GetCertificateCrtFilePath());
- std::unique_ptr<char[]> pcertPath(_StringConverter::CopyToCharArrayN(certPath));
- SysTryReturn(NID_WEB_CTRL, pcertPath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+ ewk_settings_text_selection_enabled_set(pSettings, EINA_FALSE);
+ ewk_settings_uses_keypad_without_user_action_set(pSettings, EINA_FALSE);
- ewk_context_certificate_file_set(pContext, pcertPath.get());
-
- r = CreateResourceDirectory();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- r = InitializeCustomDb();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ ewk_context_additional_plugin_path_set(pContext, PLUGIN_DIRECTORY_PATH);
- r = SetProxyAddress();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ String certPath(_CertService::GetCertificateCrtFilePath());
+ std::unique_ptr<char[]> pCertPath(_StringConverter::CopyToCharArrayN(certPath));
+ SysTryReturn(NID_WEB_CTRL, pCertPath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
- return E_SUCCESS;
-}
+ ewk_context_certificate_file_set(pContext, pCertPath.get());
+ String iconPath(App::App::GetInstance()->GetAppRootPath() + ICON_DB_DIRECTORY_PATH + ICON_DB_FILE_NAME);
+ std::unique_ptr<char[]> pIconPath(_StringConverter::CopyToCharArrayN(iconPath));
+ SysTryReturn(NID_WEB_CTRL, pIconPath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-result
-_EflWebkit::CreateResourceDirectory(void) const
-{
- String html5FeaturesPath(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH);
+ ewk_context_icon_database_path_set(pContext, pIconPath.get());
- if (!_FileImpl::IsFileExist(html5FeaturesPath))
- {
- result r = E_SUCCESS;
-
- r = _DirectoryImpl::Create(html5FeaturesPath, true);
- SysTryReturnResult(NID_WEB_CTRL, r == E_SUCCESS, E_SYSTEM, "A system error has been occurred. create html5 features directory.");
- }
+ InitializeCustomHeader();
return E_SUCCESS;
}
result
-_EflWebkit::InitializeCustomDb(void) const
+_EflWebkit::SetProxyAddress(char* pProxy) const
{
- result r = E_SUCCESS;
-
- _DatabaseImpl db;
- String path(Tizen::App::App::GetInstance()->GetAppRootPath() + CUSTOM_DB_DIRECTORY_PATH + USER_CONFIRM_DB_NAME);
- String geolocationTable(GEOLOCATION_TABLE_NAME);
- String protocolTable(CUSTOM_PROTOCOL_TABLE_NAME);
- String contentTable(CUSTOM_CONTENT_TABLE_NAME);
-
- r = db.Construct(path, "a+", null);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- std::unique_ptr<DbEnumerator> pEnum(db.QueryN(L"Select count(name) from sqlite_master Where type='table' And name in ('" + geolocationTable + L"', '" + protocolTable + L"', '" + contentTable + L"')"));
- if (pEnum.get())
- {
- int count = 0;
-
- r = pEnum->MoveNext();
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
-
- r = pEnum->GetIntAt(0, count);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
-
- if (count == CUSTOM_DB_TABLE_COUNT)
- {
- return E_SUCCESS;
- }
- }
+ Ewk_Context* pContext = ewk_view_context_get(__pWebFrame);
+ SysAssertf(pContext, "Failed to get context.");
- pEnum.reset();
- pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + geolocationTable + L"'"));
- if (!pEnum.get())
+ if (!pProxy || !strlen(pProxy))
{
- r = db.ExecuteSql(
- L"CREATE TABLE IF NOT EXISTS " + geolocationTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, origin TEXT, permission INTEGER)",
- true);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ ewk_context_proxy_uri_set(pContext, null);
}
-
- pEnum.reset();
- pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + protocolTable + L"'"));
- if (!pEnum.get())
+ else
{
- r = db.ExecuteSql(
- L"CREATE TABLE IF NOT EXISTS " + protocolTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, baseUrl TEXT, url TEXT, mime TEXT, allow INTEGER)",
- true);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ ewk_context_proxy_uri_set(pContext, pProxy);
}
- pEnum.reset();
- pEnum = std::unique_ptr<DbEnumerator>(db.QueryN(L"Select name from sqlite_master Where type='table' And name = '" + contentTable + L"'"));
- if (!pEnum.get())
- {
- r = db.ExecuteSql(
- L"CREATE TABLE IF NOT EXISTS " + contentTable + L"(id INTEGER PRIMARY KEY AUTOINCREMENT, baseUrl TEXT, url TEXT, mime TEXT, allow INTEGER)",
- true);
- SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- }
+ SysLog(NID_WEB_CTRL, "The current value of proxy is %s", pProxy);
return E_SUCCESS;
}
-result
-_EflWebkit::SetProxyAddress(void) const
+void
+_EflWebkit::InitializeCustomHeader(void) const
{
- int ret = -1;
- connection_h handle = null;
-
- ret = connection_create(&handle);
- SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to create connection.");
-
- char* pProxy = null;
- connection_address_family_e family = CONNECTION_ADDRESS_FAMILY_IPV4;
+ char pAcceptLang[6] = {0, };
+ char* pLangSet = vconf_get_str(VCONFKEY_LANGSET);
+ const char name[] = "Accept-Language";
- ret = connection_get_proxy(handle, family, &pProxy);
- SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to get proxy address.");
-
- ret = connection_destroy(handle);
- SysTryReturnResult(NID_WEB_CTRL, ret == CONNECTION_ERROR_NONE, E_SYSTEM, "A system error has been occurred. Failed to destroy connection.");
-
- Ewk_Context* pContext = ewk_view_context_get(__pWebFrame);
- SysAssertf(pContext, "Failed to get context.");
-
- if (!pProxy || !strlen(pProxy))
+ if (pLangSet && strlen(pLangSet))
{
- ewk_context_proxy_uri_set(pContext, null);
+ strncpy(pAcceptLang, pLangSet, 2);
+
+ char *pRawData = strchr(pLangSet, '_');
+ if (pRawData && strlen(pLangSet) >= 5)
+ {
+ strcat(pAcceptLang, "-");
+ strncat(pAcceptLang, pRawData + 1, 2);
+ }
}
else
{
- ewk_context_proxy_uri_set(pContext, pProxy);
- }
-
- SysLog(NID_WEB_CTRL, "The current value of proxy is %s", pProxy);
-
- if (pProxy)
- {
- free(pProxy);
+ strcat(pAcceptLang, "en");
}
+ free(pLangSet);
- return E_SUCCESS;
+ ewk_view_custom_header_add(__pWebFrame, name, pAcceptLang);
}