#include <dpl/string.h>
#include <dpl/foreach.h>
-#include <appcore-common.h>
+#include <Elementary.h>
+#include <efl_assist.h>
#include <pcrecpp.h>
-#include <vconf.h>
#include <sysman.h>
#include <widget_model.h>
+#include <dpl/log/secure_log.h>
+#include <system_settings.h>
#include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/wrt-dao-ro/vconf_config.h>
#include <dpl/utils/wrt_global_settings.h>
-#include <common/application_data.h>
+#include <application_data.h>
#include <common/application_launcher.h>
+#include <common/message_support.h>
#include <common/scheme.h>
#include <common/view_logic_apps_support.h>
#include <common/view_logic_custom_header_support.h>
-#include <common/view_logic_password_support.h>
#include <common/view_logic_security_support.h>
#include <common/view_logic_security_origin_support.h>
+#include <common/view_logic_certificate_support.h>
#include <common/view_logic_storage_support.h>
#include <common/view_logic_uri_support.h>
-#include <common/view_logic_user_agent_support.h>
#include <common/view_logic_vibration_support.h>
+#include <view_logic_authentication_challenge_support.h>
+#include <view_logic_certificate_confirm_support.h>
+#include <view_logic_geolocation_support.h>
+#include <view_logic_message_support.h>
+#include <view_logic_orientation_support.h>
#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_notification_data.h>
#include <view_logic_web_notification_support.h>
+#include <view_logic_web_notification_permission_support.h>
#include <view_logic_web_storage_support.h>
-#include "bundles/plugin_module_support.h"
-#include <popup-runner/PopupInvoker.h>
#include <EWebKit2.h>
+#include <dpl/localization/w3c_file_localization.h>
#include <js_overlay_types.h>
+#include <dispatch_event_support.h>
#include <i_runnable_widget_object.h>
#include <profiling_util.h>
-#include <wrt-commons/custom-handler-dao-ro/common_dao_types.h>
#include <wrt-commons/custom-handler-dao-ro/CustomHandlerDatabase.h>
-#include <wrt-commons/custom-handler-dao-ro/custom_handler_dao_read_only.h>
#include <wrt-commons/custom-handler-dao-rw/custom_handler_dao.h>
#include <popup-runner/PopupInvoker.h>
-
-#include <appsvc/appsvc.h>
+#include <plugins-ipc-message/ipc_message_support.h>
+#include <appsvc.h>
namespace {
-const char * const bundlePath = "/usr/lib/wrt-wk2-bundles/libwrt-wk2-bundle.so";
-const char * const uriBlockedMessageName = "uri_block_msg";
-const char * const uriChangedMessageName = "uri_changed_msg";
-const char * const URICHANGE_PLUGIN_STOP_ONLY = "plugin_stop_only";
-const char * const URICHANGE_PLUGIN_RESTART = "plugin_restart";
-const char * const URICHANGE_PLUGIN_NO_CHANGE = "plugin_no_change";
-const char * const URICHANGE_BLOCKED_URL = "null";
-const char* PATTERN_URI_CHANGE = "^(([^:/\\?#]+)://[^\\?#]*)";
-const int MAX_NUM_CONTEXT_MENU_ITEMS = 10;
// IME State value
const char * const IME_STATE_ON = "on";
const char * const IME_STATE_OFF = "off";
const char CONTENT_HANDLER_ASK_MSG[] = "Add content?";
const char CONTENT_HANDLER_ASK_TITLE[] = "Add content";
const char CONTENT_HANDLER_AKS_REMEMBER[] = "Remember dicision";
-const char * const CERTIFICATE_CONFIRM_REQUEST_ASK_TITLE =
- "Certification Info";
-const char * const CERTIFICATE_CONFIRM_REQUEST_ASK_BODY =
- "This site's security certificate is not trusted! Do you acess this site?";
-
-const wchar_t* BACKGROUND_ENABLED = L"background_enabled" ;
+const char* const DEFAULT_ENCODING = "UTF-8";
+#ifdef CSP_ENABLED
+const char* const DEFAULT_CSP_POLICY =
+ "default-src *; script-src 'self'; style-src 'self'; object-src 'none';";
+#endif
+// SCHEME
+const char * const SCHEME_BOX_SLASH = "box://";
+const double ORIENTATION_THRESHOLD = 0.5;
} // anonymous namespace
-std::map<const std::string, const Evas_Smart_Cb> ViewLogic::m_ewkCallbacksMap =
-{
- {"load,started", &ViewLogic::loadStartedCallback},
- {"load,finished", &ViewLogic::loadFinishedCallback},
- {"title,changed", &ViewLogic::titleChangedCallback},
- {"load,progress", &ViewLogic::loadProgressCallback},
- {"load,progress,finished", &ViewLogic::loadProgressFinishedCallback},
- {"process,crashed", &ViewLogic::processCrashedCallback},
+std::map<const std::string,
+ const Evas_Smart_Cb> ViewLogic::m_ewkCallbacksMap = {
+ { "load,started", &ViewLogic::loadStartedCallback },
+ { "load,finished", &ViewLogic::loadFinishedCallback },
+ { "load,progress,started", &ViewLogic::loadProgressStartedCallback },
+ { "load,progress", &ViewLogic::loadProgressCallback },
+ { "load,progress,finished", &ViewLogic::loadProgressFinishedCallback },
+ { "process,crashed", &ViewLogic::processCrashedCallback },
// WKPageUIClient
- {"create,window", &ViewLogic::createWindowCallback},
- {"close,window", &ViewLogic::closeWindowCallback},
+ { "create,window", &ViewLogic::createWindowCallback },
+ { "close,window", &ViewLogic::closeWindowCallback },
// WKPagePolicyClient
- {"policy,navigation,decide", &ViewLogic::policyNavigationDecideCallback},
- {"policy,newwindow,decide", &ViewLogic::policyNewWindowDecideCallback},
- {"policy,response,decide", &ViewLogic::pageResponseDecideCallback},
+ { "policy,navigation,decide", &ViewLogic::policyNavigationDecideCallback },
+ { "policy,newwindow,decide", &ViewLogic::policyNewWindowDecideCallback },
+ { "policy,response,decide", &ViewLogic::pageResponseDecideCallback },
// WKPageContextMenuClient
- {"contextmenu,customize", &ViewLogic::contextmenuCustomizeCallback},
- // WKPageFormClient
- {"form,submit", &ViewLogic::formSubmitCallback},
+ { "contextmenu,customize", &ViewLogic::contextmenuCustomizeCallback },
// EWK Geolocation Callback
- {"request,geolocation,permission", &ViewLogic::geolocationPermissionRequestCallback},
+ { "geolocation,permission,request",
+ &ViewLogic::geolocationPermissionRequestCallback },
// EWK Notification Callback
- {"notification,show", &ViewLogic::notificationShowCallback},
- {"notification,cancel", &ViewLogic::notificationCancelCallback},
- {"notification,permission,request", &ViewLogic::notificationPermissionRequestCallback},
-
- {"database,quota,exceeded", &ViewLogic::databaseUsagePermissionRequestCallback},
- {"filesystem,permission,request", &ViewLogic::fileSystemPermissionRequestCallback},
- {"fullscreen,enterfullscreen", &ViewLogic::enterFullscreenCallback},
- {"fullscreen,exitfullscreen", &ViewLogic::exitFullscreenCallback},
+ { "notification,show", &ViewLogic::notificationShowCallback },
+ { "notification,cancel", &ViewLogic::notificationCancelCallback },
+ { "notification,permission,request",
+ &ViewLogic::notificationPermissionRequestCallback },
+ { "fullscreen,enterfullscreen", &ViewLogic::enterFullscreenCallback },
+ { "fullscreen,exitfullscreen", &ViewLogic::exitFullscreenCallback },
// IME Callback
// when ime start to be showed on the webview,
// this callback will be called
- {"inputmethod,changed", &ViewLogic::imeChangedCallback},
+ { "inputmethod,changed", &ViewLogic::imeChangedCallback },
// this callback will be called
// when ime finishes to be showed on the webview
// "event_info" arg of this callback is always NULL point
// if web content should know size of ime,
// use "inputmethod,changed" instead of this.
//
- {"editorclient,ime,opened", &ViewLogic::imeOpenedCallback},
+ { "editorclient,ime,opened", &ViewLogic::imeOpenedCallback },
// when ime finished to be hidden,
// this callback will be called
- {"editorclient,ime,closed", &ViewLogic::imeClosedCallback},
+ { "editorclient,ime,closed", &ViewLogic::imeClosedCallback },
// EWK Usermedia Callback
- {"usermedia,permission,request", &ViewLogic::usermediaPermissionRequestCallback},
+ { "usermedia,permission,request",
+ &ViewLogic::usermediaPermissionRequestCallback },
// Custom handlers
- {"protocolhandler,registration,requested", &ViewLogic::protocolHandlerRegistrationCallback},
- {"protocolhandler,isregistered", &ViewLogic::protocolHandlerIsRegisteredCallback},
- {"protocolhandler,unregistration,requested", &ViewLogic::protocolHandlerUnregistrationCallback},
- {"contenthandler,registration,requested", &ViewLogic::contentHandlerRegistrationCallback},
- {"contenthandler,isregistered", &ViewLogic::contentHandlerIsRegisteredCallback},
- {"contenthandler,unregistration,requested", &ViewLogic::contentHandlerUnregistrationCallback},
- {"request,certificate,confirm", &ViewLogic::certificateConfirmRequestCallback}
+ { "protocolhandler,registration,requested",
+ &ViewLogic::protocolHandlerRegistrationCallback },
+ { "protocolhandler,isregistered",
+ &ViewLogic::protocolHandlerIsRegisteredCallback },
+ { "protocolhandler,unregistration,requested",
+ &ViewLogic::protocolHandlerUnregistrationCallback },
+ { "contenthandler,registration,requested",
+ &ViewLogic::contentHandlerRegistrationCallback },
+ { "contenthandler,isregistered",
+ &ViewLogic::contentHandlerIsRegisteredCallback },
+ { "contenthandler,unregistration,requested",
+ &ViewLogic::contentHandlerUnregistrationCallback },
+ { "request,certificate,confirm",
+ &ViewLogic::certificateConfirmRequestCallback },
+ { "authentication,challenge",
+ &ViewLogic::authenticationChallengeRequestCallback },
+ { "frame,rendered",
+ &ViewLogic::viewFrameRenderedCallback },
+ { "mediacontrol,rotate,horizontal",
+ &ViewLogic::mediacontrolRotateHorizontal },
+ { "mediacontrol,rotate,vertical",
+ &ViewLogic::mediacontrolRotateVertical },
+ { "mediacontrol,rotate,exit",
+ &ViewLogic::mediacontrolRotateExit },
+ { "popup,reply,wait,start",
+ &ViewLogic::popupReplyWaitStart },
+ { "popup,reply,wait,finish",
+ &ViewLogic::popupReplyWaitFinish },
};
-ViewLogic::ViewLogic():
+ViewLogic::ViewLogic() :
m_ewkContext(0),
+ m_attachedToCustomHandlerDao(false),
m_currentEwkView(0),
+ m_closedEwkView(NULL),
m_window(NULL),
m_model(0),
m_cbs(new WRT::UserDelegates),
+ m_imeWidth(0),
+ m_imeHeight(0),
m_isBackgroundReload(false),
m_isBackgroundSupport(false),
+ m_rotateAngle(0),
+ m_deferredRotateAngle(
+ ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY),
+ m_orientationThresholdTimer(NULL),
+ m_isPopupReplyWait(false),
+ m_isFullscreenByPlatform(false),
m_appsSupport(new ViewModule::AppsSupport()),
m_vibrationSupport(new ViewModule::VibrationSupport()),
- m_attachedToCustomHandlerDao(false)
+ m_webNotificationSupport(new ViewModule::WebNotificationSupport())
{
+ ApplicationLauncherSingleton::Instance().Touch();
}
-ViewLogic::~ViewLogic ()
+ViewLogic::~ViewLogic()
{
detachFromCustomHandlersDao();
}
bool ViewLogic::createWebView(Ewk_Context* context,
Evas_Object* window)
{
- LogDebug("");
- initializeEwkContext(context);
- Assert(NULL != m_ewkContext);
- Assert(window);
- m_window = window;
- if(!createEwkView(evas_object_evas_get(m_window)))
- {
+ LogDebug("enter");
+ if (!context || !window) {
return false;
}
- return true;
-}
-void ViewLogic::destroyWebView()
-{
- if (m_ewkContext) {
- finalizeEwkContext();
+ // theme setting
+ const char *theme = elm_theme_get(NULL);
+ if (theme) {
+ m_theme = theme;
+ LogDebug("theme is " << m_theme);
}
-}
-void ViewLogic::initialize()
-{
- LogDebug("Initializing");
- ApplicationLauncherSingleton::Instance().Touch();
- appcore_set_event_callback(
- APPCORE_EVENT_LOW_MEMORY,
- &appcoreLowMemoryCallback,
- this);
-}
+ // set members
+ m_ewkContext = context;
+ m_window = window;
-void ViewLogic::terminate()
-{
- LogDebug("terminating view logic");
- if (m_model) {
- hideWidget();
- } else {
- LogError("Widget model not created");
+ Evas* canvas = evas_object_evas_get(m_window);
+
+ if (!createEwkView(canvas)) {
+ return false;
}
- LogDebug("done");
+
+ return true;
}
void ViewLogic::prepareView(WidgetModel* m, const std::string &startUrl)
Assert(m);
m_model = m;
- m_startUrl = ViewModule::UriSupport::getUri(m_model, startUrl);
+ m_startUrl = startUrl;
Assert(NULL != m_ewkContext);
Assert(m_window);
ADD_PROFILING_POINT("initializeSupport", "start");
initializeSupport();
ADD_PROFILING_POINT("initializeSupport", "stop");
- setStartPage();
ewkClientInit(m_currentEwkView);
ADD_PROFILING_POINT("prepareEwkView", "start");
prepareEwkView(m_currentEwkView);
ADD_PROFILING_POINT("prepareEwkView", "stop");
initializePluginLoading();
+ initializeXwindowHandle();
}
void ViewLogic::showWidget()
{
LogDebug("showing widget");
Assert(NULL != m_currentEwkView && "ewk_view not created at this point");
- if (m_currentUri.empty()) {
+ std::string url =
+ ViewModule::UriSupport::getUri(m_model, m_startUrl);
+ if (url.empty()) {
LogError("Localized current URI doesn't exist");
return;
}
-
- LogInfo("m_currentUri: " << m_currentUri);
+ LogDebug("url : " << url);
// load page
- ewk_view_url_set(m_currentEwkView, m_currentUri.c_str());
+ ewk_view_url_set(m_currentEwkView, url.c_str());
if (!m_cbs->bufferSet.empty()) {
m_cbs->bufferSet(m_currentEwkView);
LogDebug("hiding widget");
ViewModule::StorageSupport::deinitializeStorage(m_model);
m_appsSupport->deinitialize();
-
m_vibrationSupport->deinitialize();
+ m_webNotificationSupport->deinitialize();
+ system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE);
- while (m_ewkViewList.size()) {
- LogInfo("pop webview: " << m_ewkViewList.back());
+ while (!m_ewkViewList.empty()) {
+ LogDebug("pop webview: " << m_ewkViewList.back());
removeEwkView(m_ewkViewList.back());
}
m_ewkViewList.clear();
void ViewLogic::suspendWidget()
{
- LogInfo("Pausing widget");
+ LogDebug("Pausing widget");
Assert(m_model);
- LogDebug("Request bundle to suspend");
- PluginModuleSupport::suspend(m_ewkContext);
-
if (!m_currentEwkView) {
LogWarning("Cannot suspend widget without view");
} else {
setEwkViewInvisible(m_currentEwkView);
+
if (!m_isBackgroundSupport) {
+ FOREACH(it, m_ewkViewList) {
+ if (*it != m_currentEwkView) {
+ suspendWebkit(*it);
+ }
+ }
+
suspendWebkit(m_currentEwkView);
}
}
- evas_object_focus_set(m_currentEwkView, EINA_FALSE);
-
// call user callback
if (!m_cbs->suspend.empty()) {
m_cbs->suspend(true);
}
-};
+}
void ViewLogic::resumeWidget()
{
- LogInfo("Resume widget");
+ LogDebug("Resume widget");
Assert(m_model);
- LogDebug("Request bundle to resume");
- PluginModuleSupport::resume(m_ewkContext);
-
- if (m_currentEwkView) {
+ if (m_currentEwkView)
+ {
setEwkViewVisible(m_currentEwkView);
+
if (!m_isBackgroundSupport) {
+ FOREACH(it, m_ewkViewList) {
+ if (*it != m_currentEwkView) {
+ resumeWebkit(*it);
+ }
+ }
+
resumeWebkit(m_currentEwkView);
}
}
- /* window system team recomend removing this win_raise code. */
+ /* window system team recomend removing this win_raise code. */
/*
- if (m_window) {
- elm_win_raise(m_window);
- }
- */
- evas_object_focus_set(m_currentEwkView, EINA_TRUE);
+ * if (m_window) {
+ * elm_win_raise(m_window);
+ * }
+ */
// call user callback
if (!m_cbs->resume.empty()) {
m_cbs->resume(true);
}
-};
+}
void ViewLogic::resetWidget()
{
- LogInfo("Resetting Widget");
+ LogDebug("Resetting Widget");
- // destory all webview
- while (m_ewkViewList.size()) {
- LogInfo("pop webview: " << m_ewkViewList.back());
- removeEwkView(m_ewkViewList.back());
- }
- m_ewkViewList.clear();
+ // handling case of WebProcess is locked
+ if (m_isPopupReplyWait) {
+ // resume web application
+ LogDebug("WebProcess is locked");
+ if (m_currentEwkView) {
+ setEwkViewVisible(m_currentEwkView);
+ if (!m_isBackgroundSupport) {
+ resumeWebkit(m_currentEwkView);
+ }
+ }
+ // webview activated
+ elm_win_activate(m_window);
- // create new webview
- createEwkView(evas_object_evas_get(m_window));
- setStartPage();
- ewkClientInit(m_currentEwkView);
- prepareEwkView(m_currentEwkView);
+ // call user callback
+ if (!m_cbs->reset.empty()) {
+ m_cbs->reset(false);
+ }
+ } else {
+ // reset web application
+ // destory all webview
+ while (!m_ewkViewList.empty()) {
+ LogDebug("pop webview: " << m_ewkViewList.back());
+ removeEwkView(m_ewkViewList.back());
+ }
+ m_ewkViewList.clear();
+ m_currentEwkView = NULL;
- // check if current url is service url for this tizen service
- std::string requestedUri =
- ViewModule::UriSupport::getUri(m_model, m_startUrl);
- DPL::OptionalString servicedUri = ViewModule::UriSupport::localizeURI(
- DPL::FromUTF8String(requestedUri.c_str()),
- m_model);
+ // create new webview
+ createEwkView(evas_object_evas_get(m_window));
+ ewkClientInit(m_currentEwkView);
+ prepareEwkView(m_currentEwkView);
- initializePluginLoading();
+ // check if current url is service url for this tizen service
+ std::string url =
+ ViewModule::UriSupport::getUri(m_model, m_startUrl);
- // webview activated
- PluginModuleSupport::resume(m_ewkContext);
- m_currentUri = DPL::ToUTF8String(*servicedUri);
- ewk_view_url_set(m_currentEwkView, m_currentUri.c_str());
- elm_win_activate(m_window);
- evas_object_focus_set(m_currentEwkView, EINA_TRUE);
+ initializePluginLoading();
+ // webview activated
+ ewk_view_url_set(m_currentEwkView, url.c_str());
+ elm_win_activate(m_window);
- // call user callback
- if (!m_cbs->reset.empty()) {
- m_cbs->reset(true);
- }
- if (!m_cbs->bufferSet.empty()) {
- m_cbs->bufferSet(m_currentEwkView);
+ // call user callback
+ if (!m_cbs->reset.empty()) {
+ m_cbs->reset(true);
+ }
+ if (!m_cbs->bufferSet.empty()) {
+ m_cbs->bufferSet(m_currentEwkView);
+ }
}
}
} else {
if (1 >= m_ewkViewList.size()) {
// If there is no previous page, widget move to backgroud.
- LogInfo("Widget move to backgroud");
+ LogDebug("Widget move to backgroud");
elm_win_lower(m_window);
} else {
// Back to previous webview
- LogInfo("Widget move to previous webview");
+ LogDebug("Widget move to previous webview");
m_closedEwkView = m_currentEwkView;
ecore_idler_add(windowCloseIdlerCallback, this);
}
void ViewLogic::reloadStartPage()
{
- LogInfo("Reload Start Page");
+ LogDebug("Reload Start Page");
// prevent fail to load plugin bundle side
m_isBackgroundReload = true;
- PluginModuleSupport::resume(m_ewkContext);
- if (m_ewkViewList.size() != 0) {
- while (m_ewkViewList.size() > 0) {
+ if (!m_ewkViewList.empty()) {
+ while (!m_ewkViewList.empty()) {
if (!m_cbs->bufferUnset.empty()) {
m_cbs->bufferUnset(m_currentEwkView);
}
createEwkView(evas_object_evas_get(m_window));
ewkClientInit(m_currentEwkView);
- setStartPage();
prepareEwkView(m_currentEwkView);
initializePluginLoading();
// load page
- ewk_view_url_set(m_currentEwkView, m_currentUri.c_str());
+ std::string url = ViewModule::UriSupport::getUri(m_model, m_startUrl);
+ ewk_view_url_set(m_currentEwkView, url.c_str());
// show ewkView
if (!m_cbs->bufferSet.empty()) {
m_cbs->bufferSet(m_currentEwkView);
}
- LogInfo("Reloading Start Page is done!");
+ LogDebug("Reloading Start Page is done!");
}
Evas_Object* ViewLogic::getCurrentWebview()
{
- LogInfo("get current webview");
+ LogDebug("get current webview");
return m_currentEwkView;
}
void ViewLogic::fireJavascriptEvent(int event, void* data)
{
- PluginModuleSupport::dispatchJavaScriptEvent(
+ ViewLogicMessageSupport::dispatchJavaScriptEvent(
m_ewkContext,
static_cast<WrtPlugins::W3C::CustomEventType>(event),
data);
m_cbs = cbs;
}
-void ViewLogic::initializeEwkContext(Ewk_Context* newEwkContext)
+void ViewLogic::checkSyncMessageFromBundle(
+ const char* name,
+ const char* /*body*/,
+ char** returnData)
{
- LogInfo("initializeEwkContext called");
- Assert(newEwkContext && "Ewk_Context provided can not be null");
- // bundle callback setting
- ewk_context_message_from_injected_bundle_callback_set(
- newEwkContext,
- contextMessageFromInjectedBundleCallback,
- static_cast<void*>(this));
+ LogDebug("didReceiveSynchronousMessage called");
+ Assert(name);
- // proxy server setting
- char *proxyAddress = vconf_get_str(VCONFKEY_NETWORK_PROXY);
- if ((!proxyAddress) || (strlen(proxyAddress) == 0)
- || (strstr(proxyAddress, "0.0.0.0")))
- {
- LogInfo("proxy address is empty");
- ewk_context_proxy_uri_set(newEwkContext, NULL);
- } else {
- LogInfo("proxy address [" << proxyAddress << "]");
- ewk_context_proxy_uri_set(newEwkContext, proxyAddress);
+ LogDebug("received : " << name);
+ if (!strcmp(name, Message::TizenScheme::GET_WINDOW_HANDLE)) {
+ if (m_window) {
+ Ecore_X_Window handle = elm_win_xwindow_get(m_window);
+ if (handle != 0) {
+ std::stringstream ss;
+ ss << handle;
+ std::string ret = ss.str();
+ if (returnData) {
+ *returnData = strdup(ret.c_str());
+ }
+ } else {
+ LogDebug("X window isn't exist");
+ }
+ }
}
+}
- if (proxyAddress) {
- free(proxyAddress);
- proxyAddress = NULL;
- }
+void ViewLogic::checkAsyncMessageFromBundle(const char* name, const char* body)
+{
+ Assert(name);
+ _D("received : %s", name);
- // theme setting
- const char *theme = elm_theme_get(NULL);
- if (theme) {
- m_theme = theme;
- LogInfo("theme is " << m_theme);
- }
+ if (!strcmp(name, Message::ToUIProcess::BLOCKED_URL)) {
+ // Currently WebProcess informs obly about blocked
+ // URI - URI localization and security chekcs are
+ // done by WebProcess itself (see: wrt-injected-bundle.cpp
+ // and bundle_uri_handling.cpp)
+ requestUrlBlocked(std::string(body));
+ } else if (!strcmp(name, Message::TizenScheme::CLEAR_ALL_COOKIES)) {
+ Ewk_Cookie_Manager* cookieManager =
+ ewk_context_cookie_manager_get(m_ewkContext);
+ if (!cookieManager) {
+ _E("Fail to get cookieManager");
+ return;
+ }
+ ewk_cookie_manager_cookies_clear(cookieManager);
+ } else if (!strcmp(name, IPCMessageSupport::TIZEN_CHANGE_USERAGENT)) {
+ std::string msgBody = (body) ? (body) : "";
- // Ewk download callback (WKContextDownloadClient)
- ewk_context_did_start_download_callback_set(
- newEwkContext,
- didStartDownloadCallback,
- this);
+ std::string strId = msgBody.substr(0, msgBody.find_first_of('_'));
+ std::string strBody = msgBody.substr(msgBody.find_first_of('_')+1);
+ _D("Id: %s , Body %s", strId.c_str(), strBody.c_str());
- ewk_context_vibration_client_callbacks_set(
- newEwkContext,
- vibrationVibrateCallback,
- vibrationCancelCallback,
- this);
+ ewk_view_user_agent_set(m_currentEwkView, strBody.c_str());
+ _D("get UA: %s", ewk_view_user_agent_get(m_currentEwkView));
- ewk_context_certificate_file_set(m_ewkContext,
- "/opt/usr/share/certs/ca-certificate.crt");
+ IPCMessageSupport::replyAsyncMessageToWebProcess(m_ewkContext,
+ atoi(strId.c_str()),
+ "success");
+ return;
+ } else if (!strcmp(name, IPCMessageSupport::TIZEN_DELETE_ALL_COOKIES)) {
+ std::string msgBody = (body) ? (body) : "";
+ std::string strId = msgBody.substr(0, msgBody.find_first_of('_'));
+ std::string strBody = msgBody.substr(msgBody.find_first_of('_')+1);
+
+ Ewk_Cookie_Manager* cookieManager =
+ ewk_context_cookie_manager_get(m_ewkContext);
+ if (!cookieManager) {
+ _E("Fail to get cookieManager");
+ IPCMessageSupport::replyAsyncMessageToWebProcess(
+ m_ewkContext,
+ atoi(strId.c_str()),
+ "error");
+ return;
+ }
+ ewk_cookie_manager_cookies_clear(cookieManager);
+ IPCMessageSupport::replyAsyncMessageToWebProcess(m_ewkContext,
+ atoi(strId.c_str()),
+ "success");
+ return;
+ } else if (!strcmp(name, IPCMessageSupport::TIZEN_EXIT) ||
+ !strcmp(name, IPCMessageSupport::TIZEN_HIDE))
+ {
+ bool ret =
+ ViewModule::SchemeSupport::HandleTizenScheme(name,
+ m_window,
+ m_currentEwkView);
+ if (ret == false) {
+ _E("Fail to handle tizen scheme %s", name);
+ }
+ // Not need to send reply
+ return;
+ } else {
+ _W("Not defined message");
+ }
+}
- // set to member value
- m_ewkContext = newEwkContext;
+void ViewLogic::downloadData(const char* url)
+{
+ LogDebug("enter");
+ if (!url) {
+ return;
+ }
+ m_appsSupport->downloadRequest(url, NULL, NULL);
}
-void ViewLogic::finalizeEwkContext()
+void ViewLogic::activateVibration(bool on, uint64_t time)
{
- LogInfo("finalizeEwkContext called");
- ewk_context_message_from_injected_bundle_callback_set(
- m_ewkContext,
- NULL,
- NULL);
- ewk_context_did_start_download_callback_set(
- m_ewkContext,
- NULL,
- NULL);
- ewk_context_vibration_client_callbacks_set(
- m_ewkContext,
- NULL,
- NULL,
- NULL);
-// ewk_context_delete(m_ewkContext);
-// m_ewkContext = 0;
+ LogDebug("enter");
+ if (on) {
+ m_vibrationSupport->startVibration(static_cast<long>(time));
+ } else {
+ m_vibrationSupport->stopVibration();
+ }
}
void ViewLogic::initializeSupport()
{
// background support
- if( m_model->SettingList.Get().getBackgroundSupport()
- == BackgroundSupport_Enable ) {
+ if (m_model->SettingList.Get().getBackgroundSupport()
+ == BackgroundSupport_Enable)
+ {
LogDebug("Background support enabled, set process active");
- pid_t pid = getpid();
- sysman_inform_active(pid);
+ sysman_inform_active(getpid());
m_isBackgroundSupport = true;
}
-#ifndef DEPRECATED_SETTING_STRING
- else {
- WrtDB::WidgetDAOReadOnly dao(m_model->TizenId);
- WrtDB::PropertyDAOReadOnly::WidgetPropertyValue bgEnableValue =
- dao.getPropertyValue(DPL::String(BACKGROUND_ENABLED));
-
- if(!bgEnableValue.IsNull() && !bgEnableValue->compare(L"true")) {
- //skip suspendWidget
- LogDebug("Background support enabled, set process active");
- pid_t pid = getpid();
- sysman_inform_active(pid);
- m_isBackgroundSupport = true;
- }
- }
-#endif
+ system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_FONT_TYPE,
+ systemSettingsChangedCallback,
+ this);
- // set local stroage database path
- WrtDB::WidgetDAOReadOnly dao(m_model->TizenId);
- ewk_context_web_storage_path_set(m_ewkContext,
- dao.getPrivateLocalStoragePath().c_str());
- // memory saving mode
- int result;
- vconf_get_int(
- WrtDB::VconfConfig::GetVconfKeyMemorySavingMode(
- m_model->TizenId).c_str(),
- &result);
- ewk_context_memory_saving_mode_set(
- m_ewkContext,
- static_cast<WrtDB::SettingsType>(result) ==
- WrtDB::SETTINGS_TYPE_ON ? EINA_TRUE : EINA_FALSE);
- m_schemeSupport.reset(new SchemeSupport(m_model->Type.Get().appType));
ViewModule::StorageSupport::initializeStorage(m_model);
- m_appsSupport->initialize(m_model);
+ m_appsSupport->initialize(m_model, elm_win_xwindow_get(m_window));
m_securityOriginSupport.reset(new ViewModule::SecurityOriginSupport(m_model));
-
+ m_certificateSupport.reset(new ViewModule::CertificateSupport(m_model));
m_vibrationSupport->initialize();
+ m_webNotificationSupport->initialize(m_model->TzPkgId.Get());
}
void ViewLogic::initializePluginLoading()
{
// inform wrt information for plugin loading to web process
- PluginModuleSupport::start(
+ ViewLogicMessageSupport::start(
m_ewkContext,
m_model->TizenId,
elm_config_scale_get(),
ApplicationDataSingleton::Instance().getEncodedBundle(),
- m_theme.c_str(),
- m_model->SettingList.Get().isEncrypted());
+ m_theme.c_str());
+}
+
+void ViewLogic::initializeXwindowHandle()
+{
+ if (m_window) {
+ unsigned int handle = elm_win_xwindow_get(m_window);
+ ViewLogicMessageSupport::setXwindowHandle(
+ m_ewkContext,
+ handle);
+ }
}
-void ViewLogic::ewkClientInit(Evas_Object *wkView) {
+void ViewLogic::ewkClientInit(Evas_Object *wkView)
+{
Assert(NULL != wkView && "ewk_view not created at this point");
- FOREACH(it, m_ewkCallbacksMap) {
+ FOREACH(it, m_ewkCallbacksMap)
+ {
evas_object_smart_callback_add(
wkView,
it->first.c_str(),
wkView,
orientationLockCallback,
this);
+ ewk_view_exceeded_database_quota_callback_set(
+ wkView,
+ exceededDatabaseQuotaCallback,
+ this);
+ ewk_view_exceeded_indexed_database_quota_callback_set(
+ wkView,
+ exceededIndexedDatabaseQuotaCallback,
+ this);
+ ewk_view_exceeded_local_file_system_quota_callback_set(
+ wkView,
+ exceededLocalFileSystemQuotaCallback,
+ this);
+ ea_object_event_callback_add(wkView,
+ EA_CALLBACK_BACK,
+ eaKeyCallback,
+ this);
+ ea_object_event_callback_add(wkView,
+ EA_CALLBACK_MORE,
+ eaKeyCallback,
+ this);
+#if 0 // FIXME!!! elm_access_object_register has not landed yet
+ // Always register access object even application doesn't support
+ // accessibility. In case of accessibility isn't supported, efl_assist
+ // shows warning message by syspopup.
+ // initScreenReaderSupport is related method. (window_data.cpp)
+ elm_access_object_register(wkView, m_window);
+#endif
}
-void ViewLogic::ewkClientDeinit(Evas_Object *wkView) {
+void ViewLogic::ewkClientDeinit(Evas_Object *wkView)
+{
LogDebug("ewkClientDeinit");
Assert(NULL != wkView && "ewk_view not created at this point");
- FOREACH(it, m_ewkCallbacksMap) {
+ FOREACH(it, m_ewkCallbacksMap)
+ {
evas_object_smart_callback_del(
wkView,
it->first.c_str(),
it->second);
}
- ewk_view_orientation_lock_callback_set(
- wkView,
- NULL,
- NULL);
+ ewk_view_orientation_lock_callback_set(wkView, NULL, NULL);
+ ewk_view_exceeded_database_quota_callback_set(wkView, NULL, NULL);
+ ewk_view_exceeded_indexed_database_quota_callback_set(wkView, NULL, NULL);
+ ewk_view_exceeded_local_file_system_quota_callback_set(wkView, NULL, NULL);
+ ea_object_event_callback_del(wkView,
+ EA_CALLBACK_BACK,
+ eaKeyCallback);
+ ea_object_event_callback_del(wkView,
+ EA_CALLBACK_MORE,
+ eaKeyCallback);
+ if (m_orientationThresholdTimer) {
+ ecore_timer_del(m_orientationThresholdTimer);
+ m_orientationThresholdTimer = NULL;
+ }
+ // FIXME!!!! elm_access_object_unregister has not landed in
+ // tizen 3.0 elementary yet
+ // elm_access_object_unregister(wkView);
}
bool ViewLogic::createEwkView(Evas* canvas)
{
- LogDebug("createEwkVeiw");
+ LogDebug("createEwkView");
Assert(canvas);
ADD_PROFILING_POINT("ewk_view_add_with_context", "start");
Evas_Object* newEwkView = ewk_view_add_with_context(
- canvas,
- m_ewkContext);
+ canvas,
+ m_ewkContext);
ADD_PROFILING_POINT("ewk_view_add_with_context", "stop");
if (!newEwkView) {
LogError("View creation failed");
Wrt::Popup::PopupInvoker().showInfo(
- "Info", "View creation failed","close");
+ "Info", "View creation failed", "close");
return false;
}
ewkCookieManager =
ewk_context_cookie_manager_get(m_ewkContext);
ewk_cookie_manager_accept_policy_set(ewkCookieManager,
- EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
+ EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
+
+ if (m_currentEwkView) {
+ setEwkViewInvisible(m_currentEwkView);
+ }
- LogInfo("push webview: " << newEwkView);
+ LogDebug("push webview: " << newEwkView);
m_ewkViewList.push_back(newEwkView);
m_currentEwkView = newEwkView;
return true;
}
-void ViewLogic::setStartPage()
-{
- /* Start URI (as other uris) is now localized
- * on WebProcess side */
- m_currentUri = m_startUrl;
-}
-
void ViewLogic::prepareEwkView(Evas_Object *wkView)
{
LogDebug("prepareEwkView called");
// set user agent
std::string customUserAgent = m_model->SettingList.Get().getUserAgent();
if (customUserAgent.empty()) {
- auto userAgentString =
- ViewModule::UserAgentSupport::getUserAgentFromVconf();
- if (!userAgentString.empty()) {
- LogDebug("Setting user agent as: " << userAgentString);
- ewk_view_user_agent_set(wkView, userAgentString.c_str());
- }
+ LogDebug("Setting user agent as: default");
+ ewk_view_user_agent_set(wkView, NULL);
+ std::string defaultUA = ewk_view_user_agent_get(wkView);
+ LogDebug("webkit's UA: " << defaultUA);
} else {
LogDebug("Setting custom user agent as: " << customUserAgent);
ewk_view_user_agent_set(wkView, customUserAgent.c_str());
// webkit NPAPI plugins is always on in wrt
ewk_settings_plugins_enabled_set(settings, EINA_TRUE);
-
- // The followings are not implemeted yet by webkit2
- // ewk_view_setting_accelerated_compositing_enable_set(EINA_TRUE);
- // ewk_view_mode_set();
- // ewk_view_setting_enable_specified_plugin_set(EINA_TRUE, FLASH_MIME_TYPE);
- // ewk_view_setting_html5video_external_player_enable_set(EINA_FALSE);
- // ewk_view_show_ime_on_autofocus_set(EINA_TRUE);
- // elm_webview_show_magnifier_set(EINA_FALSE);
ewk_settings_javascript_enabled_set(settings, EINA_TRUE);
ewk_settings_loads_images_automatically_set(settings, EINA_TRUE);
- ewk_settings_auto_fitting_set(settings, EINA_TRUE);
-
- // disable zoom option when user click the input field
- // this option is useful with the normal website
- // for the make user friendly, disable auto zoom in the webapp
- // The followings are not implemeted yet by webkit2
- // elm_webview_input_field_zoom_set(EINA_FALSE);
-
- // set cookie database path
- // The followings are not implemeted yet by webkit2
- // ewk_cookies_file_set(dao.getCookieDatabasePath().c_str()));
+ // WRT should not fit web contents to device width automatically as default.
+ // Fitting to device width should be handled by web content using viewport meta tag.
+ ewk_settings_auto_fitting_set(settings, EINA_FALSE);
+ ewk_settings_autofill_password_form_enabled_set(settings, EINA_TRUE);
+ ewk_settings_form_candidate_data_enabled_set(settings, EINA_TRUE);
- // set visibility to WebCore. This value will be used for html5.
- // also, this value will be changed in the suspend, resume
- // or create window, close window.
ewk_view_page_visibility_state_set(wkView,
EWK_PAGE_VISIBILITY_STATE_VISIBLE,
EINA_TRUE);
+
+ std::string encoding = DEFAULT_ENCODING;
+ OptionalWidgetStartFileInfo fileInfo =
+ W3CFileLocalization::getStartFileInfo(m_model->TizenId);
+#if 0 // FIXME!!!! ewk_settings_is_encoding_valid has not landed yet
+ if (!fileInfo.IsNull()) {
+ std::string file_encoding = DPL::ToUTF8String((*fileInfo).encoding);
+
+ if(EINA_TRUE == ewk_settings_is_encoding_valid(
+ file_encoding.c_str())){
+ encoding = file_encoding;
+ _D("Found custom encoding in DB: %s", encoding.c_str());
+ }
+
+ }
+#endif
+ _D("Setting encoding: %s", encoding.c_str());
+ if (ewk_settings_default_encoding_set(settings,encoding.c_str())) {
+ _D("Encoding set properly");
+ } else {
+ _E("Error while setting encoding");
+ }
+
+#ifdef CSP_ENABLED
+ if (m_model->SecurityModelVersion.Get() ==
+ WrtDB::WidgetSecurityModelVersion::WIDGET_SECURITY_MODEL_V2)
+ {
+ // setting CSP policy rules
+ DPL::OptionalString policy = m_model->CspReportOnlyPolicy.Get();
+ if (!policy.IsNull()) {
+ LogDebug("CSP report only policy present in manifest: " << *policy);
+ ewk_view_content_security_policy_set(
+ wkView,
+ DPL::ToUTF8String(*policy).c_str(),
+ EWK_REPORT_ONLY);
+ }
+
+ policy = m_model->CspPolicy.Get();
+ if (!policy.IsNull()) {
+ LogDebug("CSP policy present in manifest: " << *policy);
+ ewk_view_content_security_policy_set(
+ wkView,
+ DPL::ToUTF8String(*policy).c_str(),
+ EWK_ENFORCE_POLICY);
+ } else {
+ ewk_view_content_security_policy_set(
+ wkView,
+ DEFAULT_CSP_POLICY,
+ EWK_ENFORCE_POLICY);
+ }
+ }
+#endif
}
void ViewLogic::removeEwkView(Evas_Object *wkView)
{
- LogInfo("removeEwkView called");
+ LogDebug("removeEwkView called");
Assert(wkView);
Assert(0 != m_ewkViewList.size());
m_ewkViewList.remove(wkView);
}
-void ViewLogic::resumeEwkView(Evas_Object *wkView)
-{
- LogInfo("resumeEwkView called");
- Assert(wkView);
-
- // register webview callback
- ewkClientInit(wkView);
-
- // resume webkit
- resumeWebkit(wkView);
-
- return;
-}
-
-void ViewLogic::suspendEwkView(Evas_Object *wkView)
-{
- LogInfo("suspendEwkView called");
- Assert(wkView);
-
- // suspend webkit
- suspendWebkit(wkView);
-
- // unregister webview callbacks
- ewkClientDeinit(wkView);
-
- return;
-}
-
void ViewLogic::setEwkViewInvisible(Evas_Object *wkView)
{
- LogInfo("setEwkViewInvisible called");
+ LogDebug("setEwkViewInvisible called");
Assert(wkView);
ewk_view_page_visibility_state_set(wkView,
void ViewLogic::setEwkViewVisible(Evas_Object *wkView)
{
- LogInfo("setEwkViewVisible called");
+ LogDebug("setEwkViewVisible called");
Assert(wkView);
ewk_view_page_visibility_state_set(wkView,
void ViewLogic::resumeWebkit(Evas_Object *wkView)
{
- LogDebug("resumeWebkit");
+ LogDebug("resumeWebkit : " << wkView);
Assert(wkView);
- // resume NPAPI plugin
- // The followings are not implemeted yet by webkit2
- // ewk_view_pause_or_resume_plugins(false);
- // ewk_view_pause_or_resume_video_audio(false);
- // ewk_view_javascript_resume();
- // ewk_view_enable_render();
- // ewk_view_reduce_plugins_frame_rate(false);
ewk_view_resume(wkView);
+ // FIXME!!!! ewk_view_foreground_set has not landed yet
+ // ewk_view_foreground_set(wkView, true);
return;
}
void ViewLogic::suspendWebkit(Evas_Object *wkView)
{
- LogDebug("suspendWebkit");
+ LogDebug("suspendWebkit : " << wkView);
Assert(wkView);
- // suspend the followings
- // The followings are not implemeted yet by webkit2
- // ewk_view_pause_or_resume_plugins(true);
- // ewk_view_pause_or_resume_video_audio(true);
ewk_view_suspend(wkView);
+ // FIXME!!!! ewk_view_foreground_set has not landed in the
+ // tizen 3.0 elementary project yet
+ // ewk_view_foreground_set(wkView, false);
return;
}
-void ViewLogic::contextMessageFromInjectedBundleCallback(
- const char* name,
- const char* body,
- char** returnData,
- void* clientInfo)
-{
- LogDebug("contextMessageFromInjectedBundleCallback called");
- Assert(clientInfo);
- ViewLogic* This = static_cast<ViewLogic*>(clientInfo);
- // didRecieveMessageFromInjectedBundleCallback - returnData is null
- // didReceiveSynchronousMessageCallback - returnData isn't null
- // WKContextInjectedBundleClient bundleClient = {
- // kWKContextInjectedBundleClientCurrentVersion,
- // static_cast<void*>(this),
- // &didRecieveMessageFromInjectedBundleCallback,
- // &didReceiveSynchronousMessageCallback
- // };
- if (NULL == returnData) {
- This->didRecieveMessageFromInjectedBundle(name, body);
- } else {
- This->didReceiveSynchronousMessage(name, body, returnData);
- }
-}
-
-void ViewLogic::didStartDownloadCallback(
- const char* downloadUrl,
- void* data)
-{
- LogDebug("didStartDownloadCallback called");
- Assert(data);
- ViewLogic* This = static_cast<ViewLogic*>(data);
- Assert(downloadUrl);
- LogDebug("download url = " << downloadUrl);
- This->m_appsSupport->downloadRequest(
- downloadUrl,
- NULL,
- NULL);
-}
-
void ViewLogic::loadStartedCallback(
- void* data,
- Evas_Object* obj,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
{
LogDebug("loadStartedCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- evas_object_focus_set(This->m_currentEwkView, EINA_TRUE);
// call loadFinish callback to wrt-client
if (!This->m_cbs->loadStart.empty()) {
This->m_cbs->loadStart(obj);
}
-
}
void ViewLogic::loadFinishedCallback(
- void* data,
- Evas_Object* obj,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
{
LogDebug("loadFinishedCallback called");
Assert(data);
const char* url = ewk_view_url_get(This->m_currentEwkView);
if (NULL == url || strlen(url) == 0) {
LogError("url is empty");
- } else {
- DPL::OptionalString jsOptionalString =
- ViewModule::PasswordSupport::jsForAutoFillData(url);
- if (jsOptionalString.IsNull()) {
- LogError("Fail to get JS String");
- } else {
- std::string jsStr = DPL::ToUTF8String(*jsOptionalString).c_str();
-
- if(EINA_FALSE == ewk_view_script_execute(
- This->m_currentEwkView,
- jsStr.c_str(),
- didRunJavaScriptCallback,
- This))
- {
- LogError("JS for auto fill data failed.");
- }
- }
+ return;
}
// call loadFinish callback to wrt-client
// set only encoded bundle
double scale = elm_config_scale_get();
- PluginModuleSupport::setCustomProperties(
+ ViewLogicMessageSupport::setCustomProperties(
This->m_ewkContext,
&scale,
ApplicationDataSingleton::Instance().getEncodedBundle());
- // check if 'appsevice' event is registed at the current frames.
- // If so, dispatch the event to frames.
- PluginModuleSupport::dispatchJavaScriptEvent(
- This->m_ewkContext,
- WrtPlugins::W3C::ServiceCustomEvent,
- NULL);
// In this case, widget is reloaded in the background.
// After finished load, bundle should disconnent callback.
if (This->m_isBackgroundReload) {
- PluginModuleSupport::suspend(This->m_ewkContext);
ewk_view_suspend(This->m_currentEwkView);
This->m_isBackgroundReload = false;
}
}
-void ViewLogic::titleChangedCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+void ViewLogic::loadProgressStartedCallback(
+ void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
{
- LogDebug("titleChangedCallback called");
+ _D("loadProgressStartedCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- Assert(eventInfo);
- const char* title = static_cast<char*>(eventInfo);
-
- if (0 == strlen(title)) {
- LogDebug("title data is empty");
- return;
+ if (!This->m_cbs->progressStarted.empty()) {
+ This->m_cbs->progressStarted();
}
- LogDebug("Title = [" << title << "]");
- This->m_schemeSupport->HandleTizenScheme(title,
- This->m_window,
- This->m_currentEwkView);
}
+
void ViewLogic::loadProgressCallback(
- void* /*data*/,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo)
{
+ _D("loadProgressCallback called");
+ Assert(data);
+ Assert(eventInfo);
+ ViewLogic const * const view = static_cast<ViewLogic const * const>(data);
double* progress = static_cast<double*>(eventInfo);
LogDebug("didChangeProgressCallback progress = " << *progress);
+ if (!view->m_cbs->progress.empty()) {
+ Assert(obj);
+ view->m_cbs->progress(obj, *progress);
+ }
}
void ViewLogic::loadProgressFinishedCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
{
LogDebug("didFinishProgressCallback");
Assert(data);
}
void ViewLogic::processCrashedCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
- LogInfo("processCrashedCallback");
+ LogDebug("processCrashedCallback");
Assert(data);
ViewLogic const * const view =
- static_cast<ViewLogic const * const>(data);
+ static_cast<ViewLogic const * const>(data);
if (!view->m_cbs->webCrash.empty()) {
view->m_cbs->webCrash();
}
}
void ViewLogic::createWindowCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo)
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo)
{
LogDebug("createWindowCallback");
Assert(data);
Evas_Object* newEwkView = This->m_currentEwkView;
// initialize new ewkview
- This->setStartPage();
This->ewkClientInit(newEwkView);
This->prepareEwkView(newEwkView);
}
void ViewLogic::closeWindowCallback(
- void* data,
- Evas_Object* obj,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
{
LogDebug("closeWindowCallback");
ViewLogic* This = static_cast<ViewLogic*>(data);
}
void ViewLogic::policyNavigationDecideCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo)
{
LogDebug("policyNavigationDecideCallback called");
Assert(data);
Ewk_Policy_Decision* policyDecision =
static_cast<Ewk_Policy_Decision*>(eventInfo);
- if (This->m_schemeSupport->filterURIByScheme(policyDecision,
- false,
- This->m_model,
- This->m_window,
- This->m_currentEwkView))
+ // handle blocked url
+ const char* url = ewk_policy_decision_url_get(policyDecision);
+
+ // call user delegate callback
+ if (!This->m_cbs->navigationDecide.empty()) {
+ std::string navigationUri(url);
+ This->m_cbs->navigationDecide(obj, navigationUri);
+ if (!navigationUri.compare(0, 6, SCHEME_BOX_SLASH)) {
+ ewk_policy_decision_ignore(policyDecision);
+ return;
+ }
+ }
+
+ if (url && strlen(url) != 0) {
+ if (This->m_blockedUri == url) {
+ LogDebug("Blocked url = " << url);
+ This->m_blockedUri = std::string();
+ ewk_policy_decision_ignore(policyDecision);
+ return;
+ }
+ }
+
+ if (ViewModule::SchemeSupport::filterURIByScheme(policyDecision,
+ false,
+ This->m_window,
+ This->m_currentEwkView))
{
LogDebug("use");
ewk_policy_decision_use(policyDecision);
} else {
// check whether this is new empty window
const char* activeUrl = ewk_view_url_get(This->m_currentEwkView);
- if(!activeUrl || 0 == strlen(activeUrl)) {
+ if (!activeUrl || 0 == strlen(activeUrl)) {
/*
* The view is empty and scheme has been handled externally. When
* user gets back from the external application he'd see blank page
* and the previous one is shown. This is not an elegant solution
* but we don't have a better one.
*/
- LogInfo("Scheme has been handled externally. Removing empty view.");
+ LogDebug("Scheme has been handled externally. Removing empty view.");
if (ewk_view_back_possible(This->m_currentEwkView)) {
// go back to previous WKPage
ewk_view_back(This->m_currentEwkView);
} else {
// stop current WKPage
ewk_view_stop(This->m_currentEwkView);
+ This->m_closedEwkView = This->m_currentEwkView;
ecore_idler_add(windowCloseIdlerCallback, This);
}
}
}
void ViewLogic::policyNewWindowDecideCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
LogDebug("policyNewWindowDecideCallback called");
Assert(data);
Ewk_Policy_Decision* policyDecision =
static_cast<Ewk_Policy_Decision*>(eventInfo);
- if (This->m_schemeSupport->filterURIByScheme(policyDecision,
- true,
- This->m_model,
- This->m_window,
- This->m_currentEwkView))
+ // handle blocked url
+ const char* url = ewk_policy_decision_url_get(policyDecision);
+ if (url && strlen(url) != 0) {
+ if (This->m_blockedUri == url) {
+ LogDebug("Blocked url = " << url);
+ This->m_blockedUri = std::string();
+ ewk_policy_decision_ignore(policyDecision);
+ return;
+ }
+ }
+
+ if (ViewModule::SchemeSupport::filterURIByScheme(policyDecision,
+ true,
+ This->m_window,
+ This->m_currentEwkView))
{
ewk_policy_decision_use(policyDecision);
} else {
}
void ViewLogic::pageResponseDecideCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
LogDebug("pageResponseDecideCallback called");
Assert(data);
ewk_policy_decision_suspend(policyDecision);
// get uri information
- const char* url = ewk_policy_decision_url_get(policyDecision);
+ const char* url = ewk_policy_decision_url_get(policyDecision);
if (NULL == url || strlen(url) == 0) {
LogDebug("url data is empty");
ewk_policy_decision_use(policyDecision);
}
void ViewLogic::contextmenuCustomizeCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
LogDebug("contextmenuCustomizeCallback called");
Assert(data);
Ewk_Context_Menu* menu = static_cast<Ewk_Context_Menu*>(eventInfo);
if ((This->m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) &&
(This->m_model->SettingList.Get().getContextMenu()
- == ContextMenu_Disable))
+ == ContextMenu_Disable))
{
LogDebug("ContextMenu Disable!!");
for (unsigned int idx = 0; idx < ewk_context_menu_item_count(menu);) {
- Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu, idx);
+ Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu,
+ idx);
Assert(item);
ewk_context_menu_item_remove(menu, item);
}
} else {
LogDebug("ContextMenu Enable!!");
- for (unsigned int idx = 0; idx < ewk_context_menu_item_count(menu);) {
- Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu, idx);
- Assert(item);
+ unsigned int menu_num = ewk_context_menu_item_count(menu);
+ unsigned int idx = 0;
+ do {
+ Ewk_Context_Menu_Item* item = ewk_context_menu_nth_item_get(menu,
+ idx);
+ if (!item) {
+ idx++;
+ continue;
+ }
Ewk_Context_Menu_Item_Tag tag = ewk_context_menu_item_tag_get(item);
switch (tag) {
- case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW:
- ewk_context_menu_item_remove(menu, item);
- break;
+ case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW:
+ ewk_context_menu_item_remove(menu, item);
+ continue;
- case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB:
- ewk_context_menu_item_remove(menu, item);
- break;
+ case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW:
+ ewk_context_menu_item_remove(menu, item);
+ continue;
- default:
- idx++;
- break;
- }
- }
- }
-}
+ case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW:
+ ewk_context_menu_item_remove(menu, item);
+ continue;
-void ViewLogic::formSubmitCallback(
- void* /*data*/,
- Evas_Object* /*obj*/,
- void* eventInfo)
-{
- LogDebug("formSubmitCallback called");
- Assert(eventInfo);
- Ewk_Form_Data* formData = static_cast<Ewk_Form_Data*>(eventInfo);
+ case EWK_CONTEXT_MENU_ITEM_TAG_OPEN_MEDIA_IN_NEW_WINDOW:
+ ewk_context_menu_item_remove(menu, item);
+ continue;
- const char* uri = ewk_form_data_url_get(formData);
- if (!uri) {
- LogError("URL is empty");
- return;
- }
+ case EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB:
+ ewk_context_menu_item_remove(menu, item);
+ continue;
- Eina_Hash* userData = ewk_form_data_values_get(formData);
- ViewModule::PasswordSupport::submitClicked(uri, userData);
+ case EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK:
+ ewk_context_menu_item_remove(menu, item);
+ continue;
+
+ default:
+ idx++;
+ break;
+ }
+ } while (idx < menu_num);
+ }
}
void ViewLogic::geolocationPermissionRequestCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
Assert(eventInfo);
- Ewk_Geolocation_Permission_Data* permissionRequest =
- static_cast<Ewk_Geolocation_Permission_Data*>(eventInfo);
+ Ewk_Geolocation_Permission_Request* permissionRequest =
+ static_cast<Ewk_Geolocation_Permission_Request*>(eventInfo);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- SecurityOriginDB::FEATURE_GEOLOCATION)
- == WrtDB::SETTINGS_TYPE_OFF)
- {
- ewk_geolocation_permission_request_allow_set(
- ewk_geolocation_permission_request_get(permissionRequest),
- EINA_FALSE);
+ if (This->m_model->GeolocationUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+ ewk_geolocation_permission_request_set(permissionRequest, EINA_FALSE);
return;
}
- ViewModule::GeolocationSupport::Webkit2::geolocationPermissionRequest(
- This->m_window,
+ ViewModule::GeolocationSupport::geolocationPermissionRequest(
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
eventInfo);
}
void ViewLogic::notificationShowCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
- LogDebug("notificationShowCallback called");
- Assert(data);
- ViewLogic* This = static_cast<ViewLogic*>(data);
-
Assert(eventInfo);
- Ewk_Notification* noti = static_cast<Ewk_Notification*>(eventInfo);
-
- using namespace ViewModule::WebNotification;
+ Ewk_Notification* ewkNotification =
+ static_cast<Ewk_Notification*>(eventInfo);
+ ViewModule::WebNotificationDataPtr notiData(
+ new ViewModule::WebNotificationData(ewkNotification));
- WebNotificationDataPtr notiData(
- new WebNotificationData(
- This->m_model,
- ewk_notification_id_get(noti)));
+ _D("notification id : %u", notiData->getEwkNotiId());
+ _D("notification iconURL : %s", notiData->getIconUrl());
+ _D("notification title : %s", notiData->getTitle());
+ _D("notification body : %s", notiData->getBody());
- DPL::OptionalString string =
- DPL::FromUTF8String(ewk_notification_icon_url_get(noti));
- if (!string.IsNull()) {
- notiData->m_iconURL = DPL::ToUTF8String(*string);
- }
- string = DPL::FromUTF8String(ewk_notification_title_get(noti));
- if (!string.IsNull()) {
- notiData->m_title = DPL::ToUTF8String(*string);
- }
- string = DPL::FromUTF8String(ewk_notification_body_get(noti));
- if (!string.IsNull()) {
- notiData->m_body = DPL::ToUTF8String(*string);
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ if (This->m_webNotificationSupport->show(notiData)) {
+ ewk_notification_showed(This->m_ewkContext, notiData->getEwkNotiId());
}
-
- LogInfo("notification id : " << notiData->m_id);
- LogInfo("notification iconURL : " << notiData->m_iconURL);
- LogInfo("notification title : " << notiData->m_title);
- LogInfo("notification body : " << notiData->m_body);
-
- showWebNotification(notiData);
- ewk_notification_showed(This->m_ewkContext, ewk_notification_id_get(noti));
}
void ViewLogic::notificationCancelCallback(
- void* /*data*/,
- Evas_Object* /*obj*/,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo)
{
- LogDebug("notificationCancelCallback called");
+ Assert(eventInfo);
+ uint64_t ewkNotiId = *static_cast<uint64_t*>(eventInfo);
+
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ Ewk_Notification* ewkNotification =
+ static_cast<Ewk_Notification*>(
+ This->m_webNotificationSupport->hide(ewkNotiId));
+ if (ewkNotification) {
+ Assert(obj);
+ Eina_List* list = NULL;
+ list = eina_list_append(list, ewkNotification);
+ ewk_view_notification_closed(obj, list);
+ eina_list_free(list);
+ }
}
void ViewLogic::notificationPermissionRequestCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
LogDebug("notificationPermissionRequestCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- SecurityOriginDB::FEATURE_WEB_NOTIFICATION)
- == WrtDB::SETTINGS_TYPE_OFF)
- {
- Ewk_Notification_Permission_Request* request =
- static_cast<Ewk_Notification_Permission_Request*>(eventInfo);
- ewk_notification_permission_request_response(
- This->m_ewkContext,
- request,
- EINA_FALSE);
- return;
- }
Assert(eventInfo);
- ViewModule::WebNotification::webNotificationPermissionRequest(
- This->m_window,
+ ViewModule::WebNotificationPermissionSupport::permissionRequest(
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
- This->m_ewkContext,
eventInfo);
return;
}
-void ViewLogic::vibrationVibrateCallback(uint64_t time, void* data)
-{
- LogDebug("vibrationVibrateCallback called");
- Assert(data);
- ViewLogic* This = static_cast<ViewLogic*>(data);
- This->m_vibrationSupport->startVibration(static_cast<long>(time));
- return;
-}
-
-void ViewLogic::vibrationCancelCallback(void* data)
-{
- LogDebug("vibrationCancelCallback called");
- Assert(data);
- ViewLogic* This = static_cast<ViewLogic*>(data);
-
- This->m_vibrationSupport->stopVibration();
-
- return;
-}
-
// EWK Orientation Callback
Eina_Bool ViewLogic::orientationLockCallback(
- Evas_Object* obj,
- Eina_Bool /*needLock*/,
- int orientation,
- void* data)
+ Evas_Object* obj,
+ Eina_Bool needLock,
+ int orientation,
+ void* data)
{
LogDebug("orientationLockCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- if (orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_PRIMARY) {
- LogDebug("orientation is portrait-primary");
- elm_win_rotation_with_resize_set(This->m_window, 0);
- ewk_view_orientation_send(obj, 0);
- } else if(orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_PRIMARY) {
- LogDebug("orientation is landscape-primary");
- elm_win_rotation_with_resize_set(This->m_window, 270);
- ewk_view_orientation_send(obj, 90);
- } else if(orientation & EWK_SCREEN_ORIENTATION_PORTRAIT_SECONDARY) {
- LogDebug("orientation is portrait-secondary");
- elm_win_rotation_with_resize_set(This->m_window, 180);
- ewk_view_orientation_send(obj, 180);
- } else if(orientation & EWK_SCREEN_ORIENTATION_LANDSCAPE_SECONDARY) {
- LogDebug("orientation is landscape-secondary");
- elm_win_rotation_with_resize_set(This->m_window, 90);
- ewk_view_orientation_send(obj, -90);
+ if (This->m_orientationThresholdTimer) {
+ LogDebug("previous orientationLock isn't finished");
+ // Previous API call isn't finished. Keep angle and run it.
+ if (needLock == EINA_TRUE) {
+ // Screen.lockOrientation
+ This->m_deferredRotateAngle = orientation;
+ } else {
+ // Screen.unlockOrientation
+ This->m_deferredRotateAngle =
+ ViewModule::OrientationSupport::DEFERRED_ORIENTATION_UNLOCK;
+ }
+ return EINA_TRUE;
+ }
+
+ This->m_rotateAngle = orientation;
+
+ if (needLock == EINA_TRUE) {
+ // Screen.lockOrientation
+ int w3cAngle =
+ ViewModule::OrientationSupport::getW3COrientationAngle(orientation);
+ int winAngle =
+ ViewModule::OrientationSupport::getWinOrientationAngle(orientation);
+ ViewModule::OrientationSupport::setEwkOrientation(obj, w3cAngle);
+ if (!This->m_cbs->setOrientation.empty()) {
+ This->m_cbs->setOrientation(winAngle);
+ }
} else {
- LogDebug("Wrong orientation is set");
- return EINA_FALSE;
+ // Screen.unlockOrientation
+ if (This->m_model->SettingList.Get().getRotationValue() ==
+ Screen_AutoRotation)
+ {
+ if (!This->m_cbs->setOrientation.empty()) {
+ This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
+ }
+ This->m_rotateAngle = 0;
+ }
}
return EINA_TRUE;
}
-
// Fullscreen API callbacks
void ViewLogic::enterFullscreenCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo)
{
- LogInfo("enterFullscreenCallback called");
+ LogDebug("enterFullscreenCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- if (!This->m_cbs->toggleFullscreen.empty()) {
- This->m_cbs->toggleFullscreen(true);
+ ViewLogicMessageSupport::setViewmodes(
+ This->m_ewkContext,
+ "fullscreen");
+
+ if (eventInfo) {
+ This->m_isFullscreenByPlatform =
+ *static_cast<Eina_Bool*>(eventInfo) == EINA_TRUE;
+ }
+ if (!This->m_cbs->enterFullscreen.empty()) {
+ This->m_cbs->enterFullscreen(obj);
}
}
+
void ViewLogic::exitFullscreenCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
{
- LogInfo("exitFullscreenCallback called");
+ LogDebug("exitFullscreenCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- if (!This->m_cbs->toggleFullscreen.empty()) {
- This->m_cbs->toggleFullscreen(false);
+ ViewLogicMessageSupport::setViewmodes(
+ This->m_ewkContext,
+ Message::ToInjectedBundle::SET_VIEWMODES_MSGBODY_EXIT);
+
+ This->m_isFullscreenByPlatform = false;
+ if (!This->m_cbs->exitFullscreen.empty()) {
+ This->m_cbs->exitFullscreen(obj);
}
}
void ViewLogic::imeChangedCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
LogDebug("enter");
Assert(data);
}
void ViewLogic::imeOpenedCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
{
LogDebug("enter");
Assert(data);
args.width = This->m_imeWidth;
args.height = This->m_imeHeight;
This->fireJavascriptEvent(
- static_cast<int>(SoftKeyboardChangeCustomEvent),
- &args);
+ static_cast<int>(SoftKeyboardChangeCustomEvent),
+ &args);
}
void ViewLogic::imeClosedCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* /*eventInfo*/)
+ void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
{
LogDebug("enter");
Assert(data);
using namespace WrtPlugins::W3C;
SoftKeyboardChangeArgs args;
args.state = IME_STATE_OFF;
-
This->fireJavascriptEvent(
- static_cast<int>(SoftKeyboardChangeCustomEvent),
- &args);
+ static_cast<int>(SoftKeyboardChangeCustomEvent),
+ &args);
}
void ViewLogic::usermediaPermissionRequestCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+ 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);
+ ViewModule::UsermediaSupport::usermediaPermissionRequest(
+ This->m_currentEwkView,
+ This->m_securityOriginSupport->getSecurityOriginDAO(),
+ eventInfo);
}
-
// helper method
CustomHandlerDB::CustomHandlerPtr getCustomHandlerFromData(void* data)
{
Assert(data);
Ewk_Custom_Handlers_Data* handler =
- static_cast<Ewk_Custom_Handlers_Data*>(data);
- CustomHandlerDB::CustomHandlerPtr customHandler(new CustomHandlerDB::CustomHandler());
+ static_cast<Ewk_Custom_Handlers_Data*>(data);
+ CustomHandlerDB::CustomHandlerPtr customHandler(
+ new CustomHandlerDB::CustomHandler());
const char* base_url = ewk_custom_handlers_data_base_url_get(handler);
if (base_url) {
LogDebug("base url: " << base_url);
* @param customHandler
*/
void saveUserResponse(Wrt::Popup::PopupResponse response,
- CustomHandlerDB::CustomHandlerPtr customHandler)
+ CustomHandlerDB::CustomHandlerPtr customHandler)
{
switch (response) {
- case Wrt::Popup::YES_DO_REMEMBER:
- LogDebug("User allowed, remember");
- customHandler->user_decision = static_cast<CustomHandlerDB::HandlerState>
- (CustomHandlerDB::Agreed | CustomHandlerDB::DecisionSaved);
- break;
- case Wrt::Popup::YES_DONT_REMEMBER:
- LogDebug("User allowed, don't remember");
- customHandler->user_decision = CustomHandlerDB::Agreed;
- break;
- case Wrt::Popup::NO_DO_REMEMBER:
- LogDebug("User didn't allow, remember");
- customHandler->user_decision = static_cast<CustomHandlerDB::HandlerState>
- (CustomHandlerDB::Declined | CustomHandlerDB::DecisionSaved);
- break;
- case Wrt::Popup::NO_DONT_REMEMBER:
- LogDebug("User didn't allow, don't remember");
- customHandler->user_decision = CustomHandlerDB::Declined;
- break;
+ case Wrt::Popup::YES_DO_REMEMBER:
+ LogDebug("User allowed, remember");
+ customHandler->user_decision =
+ static_cast<CustomHandlerDB::HandlerState>
+ (CustomHandlerDB::Agreed | CustomHandlerDB::DecisionSaved);
+ break;
+ case Wrt::Popup::YES_DONT_REMEMBER:
+ LogDebug("User allowed, don't remember");
+ customHandler->user_decision = CustomHandlerDB::Agreed;
+ break;
+ case Wrt::Popup::NO_DO_REMEMBER:
+ LogDebug("User didn't allow, remember");
+ customHandler->user_decision =
+ static_cast<CustomHandlerDB::HandlerState>
+ (CustomHandlerDB::Declined | CustomHandlerDB::DecisionSaved);
+ break;
+ case Wrt::Popup::NO_DONT_REMEMBER:
+ LogDebug("User didn't allow, don't remember");
+ customHandler->user_decision = CustomHandlerDB::Declined;
+ break;
}
}
//have to be separated
//TODO attach database only one at the start (not in every callback?)
void ViewLogic::protocolHandlerRegistrationCallback(void* data,
- Evas_Object* obj,
+ Evas_Object* /*obj*/,
void* eventInfo)
{
Assert(data);
LogDebug("enter");
CustomHandlerDB::CustomHandlerPtr customHandler =
- getCustomHandlerFromData(eventInfo);
+ getCustomHandlerFromData(eventInfo);
std::string scheme = DPL::ToUTF8String(customHandler->target);
if (scheme.empty()) {
bool matched = false;
//scheme on whiteList
for (int i = 0; i < protocolWhiteListLenth; ++i) {
- if (0 == strcmp(protocolWhiteList[i], scheme.c_str()))
- {
+ if (0 == strcmp(protocolWhiteList[i], scheme.c_str())) {
LogDebug("Match found, protocol can be handled");
matched = true;
}
}
int l = 4;
char c = scheme[l];
- while (c != '\0')
- {
+ while (c != '\0') {
if (c < 'a' || c > 'z') {
LogWarning("Wrong char inside scheme. "
<< "Only lowercase ASCII letters accepted");
This->attachToCustomHandlersDao();
CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
CustomHandlerDB::CustomHandlerPtr handler =
- handlersDao.getProtocolHandler(customHandler->target,
- customHandler->url,
- customHandler->base_url);
+ handlersDao.getProtocolHandler(customHandler->target,
+ customHandler->url,
+ customHandler->base_url);
if (handler && (handler->user_decision & CustomHandlerDB::DecisionSaved)) {
LogDebug("Protocol already registered - nothing to do");
} else {
LogDebug("Protocol handler not found");
Wrt::Popup::PopupResponse response =
- GlobalSettings::PopupsTestModeEnabled() ? Wrt::Popup::YES_DO_REMEMBER :
- Wrt::Popup::PopupInvoker().askYesNoCheckbox(
- PROTOCOL_HANDLER_ASK_TITLE,
- PROTOCOL_HANDLER_ASK_MSG,
- PROTOCOL_HANDLER_ASK_REMEMBER);
+ GlobalSettings::PopupsTestModeEnabled() ? Wrt::Popup::
+ YES_DO_REMEMBER :
+ Wrt::Popup::PopupInvoker().askYesNoCheckbox(
+ PROTOCOL_HANDLER_ASK_TITLE,
+ PROTOCOL_HANDLER_ASK_MSG,
+ PROTOCOL_HANDLER_ASK_REMEMBER);
saveUserResponse(response, customHandler);
- if (customHandler->user_decision == CustomHandlerDB::Declined)
+ if (customHandler->user_decision == CustomHandlerDB::Declined) {
return;
- handlersDao.registerProtocolHandler(*(customHandler.get()));
+ }
if (customHandler->user_decision & CustomHandlerDB::Agreed) {
//TODO remove old default handler somehow from appsvc
LogDebug("Registering appservice entry");
int ret = appsvc_set_defapp(APPSVC_OPERATION_VIEW,
- NULL,
- DPL::ToUTF8String(customHandler->target).c_str(),
- DPL::ToUTF8String(This->m_model->TizenId).c_str());
- if (APPSVC_RET_OK != ret)
- {
+ NULL,
+ DPL::ToUTF8String(
+ customHandler->target).c_str(),
+ DPL::ToUTF8String(This->m_model->
+ TizenId).c_str());
+ if (APPSVC_RET_OK != ret) {
LogWarning("Appsvc entry failed: " << ret);
+ //no database change
+ return;
}
}
+ handlersDao.registerProtocolHandler(*(customHandler.get()));
+
LogDebug("Protocal saved");
}
}
void ViewLogic::protocolHandlerIsRegisteredCallback(void* data,
- Evas_Object* obj,
+ Evas_Object* /*obj*/,
void* eventInfo)
{
LogDebug("enter");
- CustomHandlerDB::CustomHandlerPtr customHandler = getCustomHandlerFromData(eventInfo);
+ CustomHandlerDB::CustomHandlerPtr customHandler = getCustomHandlerFromData(
+ eventInfo);
ViewLogic* This = static_cast<ViewLogic*>(data);
LogDebug("Creating handlers dao");
This->attachToCustomHandlersDao();
CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
- CustomHandlerDB::CustomHandlerPtr handler =
- handlersDao.getProtocolHandler(customHandler->target,
- customHandler->url,
- customHandler->base_url);
+ CustomHandlerDB::CustomHandlerPtr handler =
+ handlersDao.getProtocolHandler(customHandler->target,
+ customHandler->url,
+ customHandler->base_url);
if (handler) {
- if (handler->user_decision & CustomHandlerDB::Agreed)
+ if (handler->user_decision & CustomHandlerDB::Agreed) {
ewk_custom_handlers_data_result_set(
- static_cast<Ewk_Custom_Handlers_Data*>(data),
+ static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
EWK_CUSTOM_HANDLERS_REGISTERED);
- else
+ } else {
ewk_custom_handlers_data_result_set(
- static_cast<Ewk_Custom_Handlers_Data*>(data),
+ static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
EWK_CUSTOM_HANDLERS_DECLINED);
- } else
- ewk_custom_handlers_data_result_set(
- static_cast<Ewk_Custom_Handlers_Data*>(data),
- EWK_CUSTOM_HANDLERS_NEW);
+ }
+ } else {
+ ewk_custom_handlers_data_result_set(
+ static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
+ EWK_CUSTOM_HANDLERS_NEW);
+ }
This->detachFromCustomHandlersDao();
}
void ViewLogic::protocolHandlerUnregistrationCallback(void* data,
- Evas_Object* obj,
+ Evas_Object* /*obj*/,
void* eventInfo)
{
LogDebug("enter");
CustomHandlerDB::CustomHandlerPtr customHandler =
- getCustomHandlerFromData(eventInfo);
+ getCustomHandlerFromData(eventInfo);
ViewLogic* This = static_cast<ViewLogic*>(data);
LogDebug("Creating handlers dao");
This->attachToCustomHandlersDao();
handlersDao.getProtocolHandler(customHandler->target,
customHandler->url,
customHandler->base_url);
+ This->detachFromCustomHandlersDao();
if (handlerCheck) {
- if (handlerCheck->user_decision & CustomHandlerDB::Agreed)
- appsvc_unset_defapp(DPL::ToUTF8String(This->m_model->TizenId).c_str());
-
+ if (handlerCheck->user_decision & CustomHandlerDB::Agreed) {
+ int ret = appsvc_unset_defapp(
+ DPL::ToUTF8String(This->m_model->TizenId).c_str());
+ if (APPSVC_RET_OK != ret) {
+ LogWarning("Failed to unregister appsvc entry");
+ return;
+ }
+ }
+ //if appsvc ok change custom_handlers_db
handlersDao.unregisterProtocolHandler(customHandler->target,
customHandler->url,
customHandler->base_url);
- } else
+ } else {
LogDebug("Nothing to unregister");
-
- This->detachFromCustomHandlersDao();
+ }
}
void ViewLogic::contentHandlerRegistrationCallback(void* data,
- Evas_Object* obj,
+ Evas_Object* /*obj*/,
void* eventInfo)
{
Assert(data);
LogDebug("enter");
CustomHandlerDB::CustomHandlerPtr customHandler =
- getCustomHandlerFromData(eventInfo);
+ getCustomHandlerFromData(eventInfo);
std::string mimeType = DPL::ToUTF8String(customHandler->target);
if (mimeType.empty()) {
LogError("No mimeType provided.");
return;
}
- for (int i = 0; i < contentBlackListLenth; ++i)
- {
- if (0 == strcmp(contentBlackList[i], mimeType.c_str()))
- {
+ for (int i = 0; i < contentBlackListLenth; ++i) {
+ if (0 == strcmp(contentBlackList[i], mimeType.c_str())) {
LogWarning("mimeType blacklisted");
//throw SecurityException
return;
LogDebug("Creating handlers dao");
This->attachToCustomHandlersDao();
CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
- CustomHandlerDB::CustomHandlerPtr handler =
- handlersDao.getContentHandler(customHandler->target,
- customHandler->url,
- customHandler->base_url);
+ CustomHandlerDB::CustomHandlerPtr handler =
+ handlersDao.getContentHandler(customHandler->target,
+ customHandler->url,
+ customHandler->base_url);
if (handler && (handler->user_decision & CustomHandlerDB::DecisionSaved)) {
LogDebug("Protocol already registered - nothing to do");
} else {
LogDebug("Protocol handler not found");
Wrt::Popup::PopupResponse response =
- GlobalSettings::PopupsTestModeEnabled() ? Wrt::Popup::YES_DO_REMEMBER :
- Wrt::Popup::PopupInvoker().askYesNoCheckbox(
- CONTENT_HANDLER_ASK_TITLE,
- CONTENT_HANDLER_ASK_MSG,
- CONTENT_HANDLER_AKS_REMEMBER);
+ GlobalSettings::PopupsTestModeEnabled() ? Wrt::Popup::
+ YES_DO_REMEMBER :
+ Wrt::Popup::PopupInvoker().askYesNoCheckbox(
+ CONTENT_HANDLER_ASK_TITLE,
+ CONTENT_HANDLER_ASK_MSG,
+ CONTENT_HANDLER_AKS_REMEMBER);
saveUserResponse(response, customHandler);
- if (customHandler->user_decision == CustomHandlerDB::Declined)
+ if (customHandler->user_decision == CustomHandlerDB::Declined) {
return;
- handlersDao.registerContentHandler(*(customHandler.get()));
+ }
if (customHandler->user_decision & CustomHandlerDB::Agreed) {
//TODO remove old default handler somehow from appsvc
LogDebug("Registering appservice entry");
int ret = appsvc_set_defapp(APPSVC_OPERATION_VIEW,
- DPL::ToUTF8String(customHandler->target).c_str(),
- NULL,
- DPL::ToUTF8String(This->m_model->TizenId).c_str());
- if (APPSVC_RET_OK != ret)
- {
+ DPL::ToUTF8String(
+ customHandler->target).c_str(),
+ NULL,
+ DPL::ToUTF8String(This->m_model->
+ TizenId).c_str());
+ if (APPSVC_RET_OK != ret) {
LogWarning("Appsvc entry failed: " << ret);
+ return;
}
}
+ handlersDao.registerContentHandler(*(customHandler.get()));
LogDebug("Content saved");
}
This->detachFromCustomHandlersDao();
}
void ViewLogic::contentHandlerIsRegisteredCallback(void* data,
- Evas_Object* obj,
+ Evas_Object* /*obj*/,
void* eventInfo)
{
LogDebug("enter");
This->attachToCustomHandlersDao();
CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
- CustomHandlerDB::CustomHandlerPtr handler =
- handlersDao.getContentHandler(customHandler->target,
- customHandler->url,
- customHandler->base_url);
+ CustomHandlerDB::CustomHandlerPtr handler =
+ handlersDao.getContentHandler(customHandler->target,
+ customHandler->url,
+ customHandler->base_url);
if (handler) {
- if (handler->user_decision & CustomHandlerDB::Agreed)
+ if (handler->user_decision & CustomHandlerDB::Agreed) {
ewk_custom_handlers_data_result_set(
- static_cast<Ewk_Custom_Handlers_Data*>(data),
+ static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
EWK_CUSTOM_HANDLERS_REGISTERED);
- else
+ } else {
ewk_custom_handlers_data_result_set(
- static_cast<Ewk_Custom_Handlers_Data*>(data),
+ static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
EWK_CUSTOM_HANDLERS_DECLINED);
- } else
- ewk_custom_handlers_data_result_set(
- static_cast<Ewk_Custom_Handlers_Data*>(data),
- EWK_CUSTOM_HANDLERS_NEW);
+ }
+ } else {
+ ewk_custom_handlers_data_result_set(
+ static_cast<Ewk_Custom_Handlers_Data*>(eventInfo),
+ EWK_CUSTOM_HANDLERS_NEW);
+ }
This->detachFromCustomHandlersDao();
}
void ViewLogic::contentHandlerUnregistrationCallback(void* data,
- Evas_Object* obj,
+ Evas_Object* /*obj*/,
void* eventInfo)
{
LogDebug("enter");
CustomHandlerDB::CustomHandlerPtr customHandler =
- getCustomHandlerFromData(eventInfo);
+ getCustomHandlerFromData(eventInfo);
ViewLogic* This = static_cast<ViewLogic*>(data);
LogDebug("Creating handlers dao");
This->attachToCustomHandlersDao();
CustomHandlerDB::CustomHandlerDAO handlersDao(This->m_model->TizenId);
- CustomHandlerDB::CustomHandlerPtr handlerCheck =
- handlersDao.getContentHandler(customHandler->target,
- customHandler->url,
- customHandler->base_url);
- if (handlerCheck) {
- if (handlerCheck->user_decision & CustomHandlerDB::Agreed)
- appsvc_unset_defapp(DPL::ToUTF8String(This->m_model->TizenId).c_str());
-
- handlersDao.unregisterContentHandler(customHandler->target,
- customHandler->url,
- customHandler->base_url);
- } else
- LogDebug("Nothing to unregister");
+ CustomHandlerDB::CustomHandlerPtr handlerCheck =
+ handlersDao.getContentHandler(customHandler->target,
+ customHandler->url,
+ customHandler->base_url);
This->detachFromCustomHandlersDao();
+ if (handlerCheck) {
+ if (handlerCheck->user_decision & CustomHandlerDB::Agreed) {
+ int ret = appsvc_unset_defapp(
+ DPL::ToUTF8String(This->m_model->TizenId).c_str());
+ if (APPSVC_RET_OK != ret) {
+ LogWarning("Failed to unregister mime handler from appsvc");
+ return;
+ }
+ }
+ handlersDao.unregisterContentHandler(customHandler->target,
+ customHandler->url,
+ customHandler->base_url);
+ } else {
+ LogDebug("Nothing to unregister");
+ }
}
void ViewLogic::didRunJavaScriptCallback(
- Evas_Object* /*obj*/,
- const char* result,
- void* /*userData*/)
+ Evas_Object* /*obj*/,
+ const char* result,
+ void* /*userData*/)
{
- LogInfo("didRunJavaScriptCallback called");
- LogInfo("result = " << result);
+ LogDebug("didRunJavaScriptCallback called");
+ LogDebug("result = " << result);
+}
+
+void ViewLogic::eaKeyCallback(void* data, Evas_Object* obj, void* eventInfo)
+{
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+
+ Ea_Callback_Type keyType =
+ static_cast<Ea_Callback_Type>(reinterpret_cast<intptr_t>(eventInfo));
+
+ LogDebug("Key = [" << keyType << "]");
+
+ std::string keyName;
+ if (keyType == EA_CALLBACK_BACK) {
+ Assert(obj);
+#if 0 // FIXME!!!! ewk_view_text_selection_clear has not landed yet
+ // Call fullscreen exit API
+ // In case of fullscreen is entered by platform(default video tag),
+ // automatically exit fullscreen when backkey is selected
+ if (This->m_isFullscreenByPlatform) {
+ ewk_view_fullscreen_exit(obj);
+ return;
+ }
+
+ // Call text selection clear API
+ // In case of current state is selection mode,
+ // application doesn't need to handle back key
+ if (EINA_TRUE == ewk_view_text_selection_clear(obj)) {
+ return;
+ }
+#endif
+ keyName = KeyName::BACK;
+ } else if (keyType == EA_CALLBACK_MORE) {
+ keyName = KeyName::MENU;
+ } else {
+ return;
+ }
+
+ if (This->m_model->SettingList.Get().getHWkeyEvent() == HWkeyEvent_Enable)
+ {
+ DispatchEventSupport::dispatchHwKeyEvent(obj, keyName);
+ }
+ This->m_cbs->hwkey(keyName);
+
+ return;
}
Eina_Bool ViewLogic::windowCloseIdlerCallback(void* data)
return ECORE_CALLBACK_CANCEL;
}
-int ViewLogic::appcoreLowMemoryCallback(void *data)
+Eina_Bool ViewLogic::exceededDatabaseQuotaCallback(Evas_Object* obj,
+ Ewk_Security_Origin* origin,
+ const char* ,
+ unsigned long long ,
+ void* data)
{
- LogInfo("appcoreLowMemoryCallback");
+ LogDebug("exceededDatabaseQuotaCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
+ Assert(obj);
- if (NULL == This->m_ewkContext) {
- LogInfo("ewk isn't initialize at this moment");
- } else {
- // Crash may occur on specific situation
- // So use the followings after they become stable
- //ewk_context_cache_clear(This->m_ewkContext);
- //ewk_context_notify_low_memory(This->m_ewkContext);
+ if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+ ewk_view_exceeded_database_quota_reply(obj, EINA_FALSE);
+ return EINA_TRUE;
}
- return 0;
+ ViewModule::WebStorageSupport::createPermissionRequest(
+ This->m_currentEwkView,
+ This->m_securityOriginSupport->getSecurityOriginDAO(),
+ obj,
+ origin,
+ ewk_view_exceeded_database_quota_reply);
+ return EINA_TRUE;
}
-void ViewLogic::databaseUsagePermissionRequestCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+Eina_Bool ViewLogic::exceededIndexedDatabaseQuotaCallback(Evas_Object* obj,
+ Ewk_Security_Origin* origin,
+ long long ,
+ void* data)
{
- LogDebug("databaseUsagePermissionRequestCallback called");
+ LogDebug("exceededIndexedDatabaseQuotaCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
- Assert(eventInfo);
+ Assert(obj);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- SecurityOriginDB::FEATURE_WEB_DATABASE)
- == WrtDB::SETTINGS_TYPE_OFF)
- {
- // default value is deny
- return;
+ if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+ ewk_view_exceeded_indexed_database_quota_reply(obj, EINA_FALSE);
+ return EINA_TRUE;
}
- ViewModule::WebStorageSupport::webStorageCreatePermissionRequest(
- This->m_window,
+
+ ViewModule::WebStorageSupport::createPermissionRequest(
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
- eventInfo);
- return;
- }
+ obj,
+ origin,
+ ewk_view_exceeded_indexed_database_quota_reply);
+ return EINA_TRUE;
+}
-void ViewLogic::fileSystemPermissionRequestCallback(
- void* data,
- Evas_Object* /*obj*/,
- void* eventInfo)
+Eina_Bool ViewLogic::exceededLocalFileSystemQuotaCallback(Evas_Object* obj,
+ Ewk_Security_Origin* origin,
+ long long ,
+ void* data)
{
- LogDebug("fileSystemPermissionRequestCallback called");
+ LogDebug("exceededLocalFileSystemQuotaCallback called");
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
+ Assert(obj);
- if (This->m_securityOriginSupport->isNeedPermissionCheck(
- SecurityOriginDB::FEATURE_FILE_SYSTEM_ACCESS)
- == WrtDB::SETTINGS_TYPE_OFF)
- {
- Ewk_Context_File_System_Permission* fileSystemPermission =
- static_cast<Ewk_Context_File_System_Permission*>(eventInfo);
- ewk_context_file_system_permission_allow_set(fileSystemPermission,
- EINA_FALSE);
- return;
+
+ if (This->m_model->WebStorageUsage.Get() == WrtDB::SETTINGS_TYPE_OFF) {
+ ewk_view_exceeded_local_file_system_quota_reply(obj, EINA_FALSE);
+ return EINA_TRUE;
}
- Assert(eventInfo);
- ViewModule::FileSystemSupport::fileSystemPermissionRequest(
- This->m_window,
+ ViewModule::WebStorageSupport::createPermissionRequest(
+ This->m_currentEwkView,
This->m_securityOriginSupport->getSecurityOriginDAO(),
- eventInfo);
+ obj,
+ origin,
+ ewk_view_exceeded_local_file_system_quota_reply);
+ return EINA_TRUE;
}
void ViewLogic::certificateConfirmRequestCallback(
Assert(data);
ViewLogic* This = static_cast<ViewLogic*>(data);
Assert(eventInfo);
- Ewk_Certificate_Policy_Decision* certificatePolicyDecision =
- static_cast<Ewk_Certificate_Policy_Decision*>(eventInfo);
-
- bool status = This->askUserForCertificateConfirm();
- if(!status) {
- ewk_certificate_policy_decision_allowed_set(
- certificatePolicyDecision,
- EINA_FALSE);
- }
- else {
- ewk_certificate_policy_decision_allowed_set(
- certificatePolicyDecision,
- EINA_TRUE);
- }
+ ViewModule::CertificateConfirmSupport::certificatePermissionRequest(
+ This->m_currentEwkView,
+ This->m_certificateSupport->getCertificateDAO(),
+ eventInfo);
}
-bool ViewLogic::askUserForCertificateConfirm()
+void ViewLogic::authenticationChallengeRequestCallback(
+ void* data,
+ Evas_Object* /*obj*/,
+ void* eventInfo)
{
- return Wrt::Popup::PopupInvoker().askYesNo(
- CERTIFICATE_CONFIRM_REQUEST_ASK_TITLE,
- CERTIFICATE_CONFIRM_REQUEST_ASK_BODY);
-}
+ LogDebug("authenticationChallengeRequestCallback called");
+ Assert(data);
+ Assert(eventInfo);
-void ViewLogic::didRecieveMessageFromInjectedBundle(
- const char* name,
- const char* /*body*/)
-{
- LogDebug("did recive message " << name);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ const char* url = ewk_view_url_get(This->m_currentEwkView);
+ if (!url || strlen(url) == 0) {
+ Ewk_Auth_Challenge* authChallenge = static_cast<Ewk_Auth_Challenge*>(eventInfo);
+ ewk_auth_challenge_credential_cancel(authChallenge);
+ return;
+ }
+ ViewModule::AuthenticationChallengeSupport::authenticationChallengeRequest(
+ This->m_currentEwkView,
+ url,
+ eventInfo);
}
-void ViewLogic::didReceiveSynchronousMessage(
- const char* name,
- const char* body,
- char** returnData)
+void ViewLogic::viewFrameRenderedCallback(
+ void* /*data*/,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
{
- LogDebug("didReceiveSynchronousMessage called");
- Assert(name);
- Assert(returnData);
+ static bool logEnable = (getenv("WRT_FRAME_RENDERED_LOG_ENABLE") != NULL);
- if (!body) {
- LogDebug("body is empty");
- *returnData = NULL;
- return;
- }
- if (!strcmp(name, uriBlockedMessageName)) {
- LogDebug("received : " << uriBlockedMessageName);
- // Currently WebProcess informs obly about blocked
- // URI - URI localization and security chekcs are
- // done by WebProcess itself (see: wrt-wk2-bundle.cpp
- // and bundle_uri_handling.cpp)
- rememberBlockedURI(DPL::FromUTF8String(body));
- *returnData = NULL;
- } else if (!strcmp(name, uriChangedMessageName)) {
- LogDebug("received : " << uriChangedMessageName);
- std::string ret = requestUriChanged(DPL::FromUTF8String(body));
- *returnData = strdup(ret.c_str());
+ if (logEnable)
+ {
+ LogDebug("enter");
}
}
-void ViewLogic::rememberBlockedURI(const DPL::String& inputURI)
+void ViewLogic::mediacontrolRotateHorizontal(void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
{
- m_blockedUri = DPL::ToUTF8String(inputURI);
- LogInfo("set blocked uri to open browser later : " << m_blockedUri);
- return;
+ LogDebug("mediacontrolRotateHorizontal called");
+ Assert(data);
+ Assert(obj);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ ViewModule::OrientationSupport::setEwkOrientation(
+ obj,
+ OrientationAngle::W3C::Landscape::PRIMARY);
+ if (!This->m_cbs->setOrientation.empty()) {
+ This->m_cbs->setOrientation(
+ OrientationAngle::Window::Landscape::PRIMARY);
+ }
}
-std::string ViewLogic::requestUriChanged(const DPL::String& changedURL)
+void ViewLogic::mediacontrolRotateVertical(void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
{
- using namespace ViewModule::SecuritySupport;
+ LogDebug("mediacontrolRotateVertical called");
+ Assert(data);
+ Assert(obj);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ ViewModule::OrientationSupport::setEwkOrientation(
+ obj,
+ OrientationAngle::W3C::Portrait::PRIMARY);
+ if (!This->m_cbs->setOrientation.empty()) {
+ This->m_cbs->setOrientation(
+ OrientationAngle::Window::Portrait::PRIMARY);
+ }
+}
- std::string url = DPL::ToUTF8String(changedURL);
- LogInfo("URL = [" << url << "]");
+void ViewLogic::mediacontrolRotateExit(void* data,
+ Evas_Object* obj,
+ void* /*eventInfo*/)
+{
+ LogDebug("mediacontrolRotateExit called");
+ Assert(data);
+ Assert(obj);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
- // check WARP
- // If url is same to URICHANGE_BLOCKED_URL,
- // this url has been already blocked by willsend.
- // So current page should be moved to previous page
- if (url == URICHANGE_BLOCKED_URL)
- {
- if (m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP)
- {
- // block this page and open it in browser
- LogDebug("Request was blocked by WARP: " << url.c_str());
- if (!m_blockedUri.empty()) {
- LogDebug("open browser : " << m_blockedUri);
- bundle* bundleData = bundle_create();
- appsvc_set_operation(bundleData, APPSVC_OPERATION_VIEW);
- appsvc_set_uri(bundleData, m_blockedUri.c_str());
- CONTROLLER_POST_EVENT(
- ApplicationLauncher,
- ApplicationLauncherEvents::LaunchApplicationByAppService(
- bundleData,
- NULL,
- NULL));
- m_blockedUri = std::string();
+ int w3cAngle = 0;
+ int winAngle = 0;
+ if (This->m_rotateAngle == 0) {
+ // application hasn't call orientation lock
+ WidgetSettingScreenLock screenLock =
+ This->m_model->SettingList.Get().getRotationValue();
+ if (screenLock == Screen_Portrait) {
+ w3cAngle = OrientationAngle::W3C::Portrait::PRIMARY;
+ winAngle = OrientationAngle::Window::Portrait::PRIMARY;
+ } else if (screenLock == Screen_Landscape) {
+ w3cAngle = OrientationAngle::W3C::Landscape::PRIMARY;
+ winAngle = OrientationAngle::Window::Landscape::PRIMARY;
+ } else if (screenLock == Screen_AutoRotation) {
+ if (!This->m_cbs->setOrientation.empty()) {
+ This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
}
+ return;
}
- if (ewk_view_back_possible(m_currentEwkView)) {
- // go back to previous page
- ewk_view_back(m_currentEwkView);
- } else {
- // stop current page
- ewk_view_stop(m_currentEwkView);
- ecore_idler_add(windowCloseIdlerCallback, this);
- }
+ } else {
+ // Restore previous orientation
+ w3cAngle =
+ ViewModule::OrientationSupport::getW3COrientationAngle(
+ This->m_rotateAngle);
+ winAngle =
+ ViewModule::OrientationSupport::getWinOrientationAngle(
+ This->m_rotateAngle);
+ }
- // This is used in case of returning previous page
- m_currentUri = url;
- return URICHANGE_PLUGIN_NO_CHANGE;
+ ViewModule::OrientationSupport::setEwkOrientation(obj, w3cAngle);
+ if (!This->m_cbs->setOrientation.empty()) {
+ This->m_cbs->setOrientation(winAngle);
}
- m_currentUri = url;
+}
+
+Eina_Bool ViewLogic::orientationThresholdTimerCallback(void* data)
+{
+ LogDebug("orientationThresholdTimerCallback");
+ ViewLogic* This = static_cast<ViewLogic*>(data);
- // Check if this url with 'http' or 'https' is included in whitelist,
- // which has lists of accessible external documents and
- // used for ONLY Tizen app
- std::string matchedScheme;
- std::string matchedUri;
- pcrecpp::RE(PATTERN_URI_CHANGE).PartialMatch(url.c_str(),
- &matchedUri,
- &matchedScheme);
- ViewModule::Scheme scheme(matchedScheme);
- if (scheme.GetType() == ViewModule::Scheme::HTTP ||
- scheme.GetType() == ViewModule::Scheme::HTTPS)
+ if (This->m_deferredRotateAngle ==
+ ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY)
{
- if (m_model->Type.Get().appType == WrtDB::APP_TYPE_TIZENWEBAPP) {
- if (!checkWhitelist(url.c_str())) {
- LogInfo("This uri is not included in white document list");
- return URICHANGE_PLUGIN_STOP_ONLY;
+ // There is no defered orientation API call
+ This->m_orientationThresholdTimer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+ }
+
+ if (This->m_deferredRotateAngle != This->m_rotateAngle) {
+ This->m_rotateAngle = This->m_deferredRotateAngle;
+ int w3cAngle = 0;
+ int winAngle = 0;
+ if (This->m_rotateAngle == 0) {
+ WidgetSettingScreenLock screenLock =
+ This->m_model->SettingList.Get().getRotationValue();
+ if (screenLock == Screen_Portrait) {
+ w3cAngle = OrientationAngle::W3C::Portrait::PRIMARY;
+ winAngle = OrientationAngle::Window::Portrait::PRIMARY;
+ } else if (screenLock == Screen_Landscape) {
+ w3cAngle = OrientationAngle::W3C::Landscape::PRIMARY;
+ winAngle = OrientationAngle::Window::Landscape::PRIMARY;
+ } else if (screenLock == Screen_AutoRotation) {
+ if (!This->m_cbs->setOrientation.empty()) {
+ This->m_cbs->setOrientation(OrientationAngle::Window::UNLOCK);
+ }
+ This->m_orientationThresholdTimer = NULL;
+ return ECORE_CALLBACK_CANCEL;
}
- LogInfo("This url is included in WhiteList");
} else {
- // For WAC app, WRT should block access of device api
- // for external documents
- return URICHANGE_PLUGIN_STOP_ONLY;
+ // Restore previous orientation
+ w3cAngle =
+ ViewModule::OrientationSupport::getW3COrientationAngle(
+ This->m_rotateAngle);
+ winAngle =
+ ViewModule::OrientationSupport::getWinOrientationAngle(
+ This->m_rotateAngle);
+ }
+
+ ViewModule::OrientationSupport::setEwkOrientation(
+ This->m_currentEwkView,
+ w3cAngle);
+ if (!This->m_cbs->setOrientation.empty()) {
+ This->m_cbs->setOrientation(winAngle);
}
+ This->m_deferredRotateAngle =
+ ViewModule::OrientationSupport::DEFERRED_ORIENTATION_EMPTY;
+ return ECORE_CALLBACK_RENEW;
}
- // register javascript object for plugins to be used
- LogInfo("Register Plugin Objects");
- return URICHANGE_PLUGIN_RESTART;
+ This->m_orientationThresholdTimer = NULL;
+ return ECORE_CALLBACK_CANCEL;
+}
+
+void ViewLogic::popupReplyWaitStart(void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
+{
+ LogDebug("called");
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ This->m_isPopupReplyWait = true;
+}
+
+void ViewLogic::popupReplyWaitFinish(void* data,
+ Evas_Object* /*obj*/,
+ void* /*eventInfo*/)
+{
+ LogDebug("called");
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+ This->m_isPopupReplyWait = false;
+}
+
+void ViewLogic::requestUrlBlocked(const std::string& blockedUrl)
+{
+ LogDebug("enter");
+
+ // block this page and open it in browser
+ LogDebug("Request was blocked : " << blockedUrl);
+ service_h serviceHandle = NULL;
+ service_create(&serviceHandle);
+ service_set_operation(serviceHandle, SERVICE_OPERATION_VIEW);
+ service_set_uri(serviceHandle, blockedUrl.c_str());
+ CONTROLLER_POST_EVENT(
+ ApplicationLauncher,
+ ApplicationLauncherEvents::LaunchApplicationByAppService(
+ serviceHandle,
+ NULL,
+ NULL));
+ // set block url. This is used on load finished callback
+ m_blockedUri = blockedUrl;
}
void ViewLogic::windowClose()
// get latest ewkView
m_currentEwkView = m_ewkViewList.back();
- const char* uri = ewk_view_url_get(m_currentEwkView);
- if (NULL == uri || 0 == strlen(uri)) {
- m_currentUri.clear();
- } else {
- m_currentUri = uri;
- }
- // resume ewkView
- /* In case we support many pages in parallel
- then view is not suspended*/
- //resumeEwkView(m_currentEwkView);
+ setEwkViewVisible(m_currentEwkView);
// show ewkView
if (!m_cbs->bufferSet.empty()) {
}
}
+void ViewLogic::systemSettingsChangedCallback(system_settings_key_e key,
+ void* data)
+{
+ LogDebug("systemSettingsChanged");
+ LogDebug("System setting Key is [" << key << "]");
+
+ Assert(data);
+ ViewLogic* This = static_cast<ViewLogic*>(data);
+
+ if (SYSTEM_SETTINGS_KEY_FONT_TYPE == key) {
+ if (!This->m_currentEwkView) {
+ LogError("ewkView isn't initialized");
+ return;
+ }
+ ewk_view_use_settings_font(This->m_currentEwkView);
+ } else {
+ LogError("Unregister system callback is called");
+ }
+}
+