#include <i_view_module.h>
#include <memory>
+#include <map>
+#include <string>
#include <dpl/log/log.h>
#include <dpl/assert.h>
#include <i_runnable_widget_object.h>
#include <common/view_logic_apps_support.h>
#include <common/view_logic_vibration_support.h>
+#include <system_settings.h>
#include <EWebKit2.h>
class SchemeSupport;
namespace ViewModule {
class SecurityOriginSupport;
+class CertificateSupport;
}
class ViewLogic : public ViewModule::IViewModule
ViewLogic();
virtual ~ViewLogic();
- void createWebView(Ewk_Context* context,
+ // IViewModule Impl
+ bool createWebView(Ewk_Context* context,
Evas_Object* window);
void destroyWebView();
- void initialize();
- void terminate();
void prepareView(WidgetModel* m, const std::string &startUrl);
void showWidget();
void hideWidget();
void resumeWidget();
void resetWidget();
void backward();
- void reload();
- void forward();
void reloadStartPage();
Evas_Object* getCurrentWebview();
void fireJavascriptEvent(int event, void* data);
void setUserCallbacks(const WRT::UserDelegatesPtr& cbs);
+ void checkSyncMessageFromBundle(
+ const char* name,
+ const char* body,
+ char** returnData);
+ void checkAsyncMessageFromBundle(
+ const char* name,
+ const char* body);
+ void downloadData(const char* url);
+ void activateVibration(bool on, uint64_t time);
- // Ewk_Context operations
- void initializeEwkContext(Ewk_Context* context);
- void finalizeEwkContext();
private:
void initializeSupport();
void initializePluginLoading();
+ void initializeXwindowHandle();
// EwkView operations
void ewkClientInit(Evas_Object *wkView);
void ewkClientDeinit(Evas_Object *wkView);
- void createEwkView();
- void setStartPage();
+ bool createEwkView(Evas* canvas);
void prepareEwkView(Evas_Object *wkView);
void removeEwkView(Evas_Object *wkView);
- void resumeEwkView(Evas_Object *wkView);
- void suspendEwkView(Evas_Object *wkView);
+ void setEwkViewVisible(Evas_Object *wkView);
+ void setEwkViewInvisible(Evas_Object *wkView);
void resumeWebkit(Evas_Object *wkView);
void suspendWebkit(Evas_Object *wkView);
- // message from injected bundle Callback
- static void contextMessageFromInjectedBundleCallback(
- const char* name,
- const char* body,
- char** returnData,
- void* userData);
-
- // EWK Context Callback
- static void didStartDownloadCallback(
- const char* downloadUrl,
- void* data);
-
// WKPageLoaderClient
static void loadStartedCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void loadFinishedCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void titleChangedCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void loadProgressStartedCallback(
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void loadProgressCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void loadProgressFinishedCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void processCrashedCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
// EWK Callback
static void createWindowCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void closeWindowCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
// EWK PolicyDecide Callback
static void policyNavigationDecideCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void policyNewWindowDecideCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void pageResponseDecideCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
// EWK ContextMenu Callback
static void contextmenuCustomizeCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
-
- // EWK FormClient Callback
- static void formSubmitCallback(
- void *data,
- Evas_Object *obj,
- void *eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
// EWK Geolocation Callback
static void geolocationPermissionRequestCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
// EWK Notification Callback
static void notificationShowCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void notificationCancelCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void notificationPermissionRequestCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
-
- // EWK Vibration Callback
- static void vibrationVibrateCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
- static void vibrationCancelCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
// EWK Orientation Callback
static Eina_Bool orientationLockCallback(
- Evas_Object* obj,
- Eina_Bool needLock,
- int orientation,
- void* data);
+ Evas_Object* obj,
+ Eina_Bool needLock,
+ int orientation,
+ void* data);
// EWK Fullscreen API callbacks
static void enterFullscreenCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
static void exitFullscreenCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
-
- // EWK IME Show/Hide Callback
- static void imeOpenCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
- static void imeCloseCallback(
- void* data,
- Evas_Object* obj,
- void* eventInfo);
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
- // JS execute callback
- static void didRunJavaScriptCallback(
- Evas_Object* obj,
- const char* result,
- void* userData);
+ // EWK IME Change/Show/Hide Callback
+ static void imeChangedCallback(
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void imeOpenedCallback(
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void imeClosedCallback(
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
- // idler callback
- static Eina_Bool windowCloseIdlerCallback(void *data);
+ // EWK Usermedia Callback
+ static void usermediaPermissionRequestCallback(
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
- // appcore event callback
- static int appcoreLowMemoryCallback(void *data);
- // database usage permission request callback
- static void databaseUsagePermissionRequestCallback(
+ // custom content/scheme handlers
+ static void protocolHandlerRegistrationCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void protocolHandlerIsRegisteredCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void protocolHandlerUnregistrationCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+
+ static void contentHandlerRegistrationCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void contentHandlerIsRegisteredCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void contentHandlerUnregistrationCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static Eina_Bool exceededDatabaseQuotaCallback(Evas_Object* obj,
+ Ewk_Security_Origin* origin,
+ const char* databaseName,
+ unsigned long long expectedQuota,
+ void* data);
+ static Eina_Bool exceededIndexedDatabaseQuotaCallback(Evas_Object* obj,
+ Ewk_Security_Origin* origin,
+ long long expectedQuota,
+ void* data);
+ static Eina_Bool exceededLocalFileSystemQuotaCallback(Evas_Object* obj,
+ Ewk_Security_Origin* origin,
+ long long expectedQuota,
+ void* data);
+ static void certificateConfirmRequestCallback(
+ void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void authenticationChallengeRequestCallback(
void* data,
Evas_Object* obj,
void* eventInfo);
- void databaseUsagePermissionRequest(
- void* eventInfo);
- bool askUserForDatabaseExceedPermission(
- Ewk_Context_Exceeded_Quota* exceededQuota);
- // file System Permission Request Callback
- static void fileSystemPermissionRequestCallback(
+ static void viewFrameRenderedCallback(
void* data,
Evas_Object* obj,
void* eventInfo);
- //bundle
- void didRecieveMessageFromInjectedBundle(
- const char* name,
- const char* body);
- void didReceiveSynchronousMessage(
- const char* name,
- const char* body,
- char** returnData);
+ static void mediacontrolRotateHorizontal(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void mediacontrolRotateVertical(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void mediacontrolRotateExit(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void popupReplyWaitStart(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+ static void popupReplyWaitFinish(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+
+ void attachToCustomHandlersDao();
+ void detachFromCustomHandlersDao();
+
+ // JS execute callback
+ static void didRunJavaScriptCallback(
+ Evas_Object* obj,
+ const char* result,
+ void* userData);
+
+ // event callback
+ static void eaKeyCallback(void* data,
+ Evas_Object* obj,
+ void* eventInfo);
+
+ // idler callback
+ static Eina_Bool windowCloseIdlerCallback(void *data);
+
+ // timer callback
+ static Eina_Bool orientationThresholdTimerCallback(void* data);
// security
- void rememberBlockedURI(const DPL::String& str);
- std::string requestUriChanged(const DPL::String& changedURL);
+ void requestUrlBlocked(const std::string& blockedUrl);
// window
void windowClose(void);
+ // system settings
+ static void systemSettingsChangedCallback(system_settings_key_e key, void* data);
Ewk_Context* m_ewkContext;
+ bool m_attachedToCustomHandlerDao;
std::list<Evas_Object*> m_ewkViewList;
Evas_Object* m_currentEwkView;
+ Evas_Object* m_closedEwkView;
Evas_Object* m_window;
WidgetModel* m_model;
- std::string m_currentUri;
std::string m_blockedUri;
+ std::string m_currentTitle;
std::string m_theme;
std::string m_startUrl;
WRT::UserDelegatesPtr m_cbs;
+ size_t m_imeWidth;
+ size_t m_imeHeight;
+ bool m_isBackgroundReload;
+ bool m_isBackgroundSupport;
+ int m_rotateAngle;
+ int m_deferredRotateAngle;
+ Ecore_Timer* m_orientationThresholdTimer;
+ bool m_isPopupReplyWait;
std::unique_ptr<SchemeSupport> m_schemeSupport;
std::unique_ptr<ViewModule::AppsSupport> m_appsSupport;
std::unique_ptr<ViewModule::VibrationSupport> m_vibrationSupport;
std::unique_ptr<ViewModule::SecurityOriginSupport> m_securityOriginSupport;
+ std::unique_ptr<ViewModule::CertificateSupport> m_certificateSupport;
+
+ static std::map<const std::string, const Evas_Smart_Cb> m_ewkCallbacksMap;
};
#endif //VIEW_LOGIC_H_