platform/shared/common/RhodesApp.h in rhodes-1.5.5 vs platform/shared/common/RhodesApp.h in rhodes-2.0.0.beta1

- old
+ new

@@ -4,16 +4,14 @@ #include "logging/RhoLog.h" #include "common/RhoThread.h" #include "net/INetRequest.h" #include "common/IRhoClassFactory.h" -#if defined(RHO_HTTPD_COMMON_IMPL) #include "net/HttpServer.h" -#endif #include "rubyext/GeoLocation.h" #include "SplashScreen.h" - +#include "AppMenu.h" #undef DEFAULT_LOGCATEGORY #define DEFAULT_LOGCATEGORY "RhodesApp" struct shttpd_ctx; @@ -33,29 +31,31 @@ common::CAutoPtr<common::IRhoClassFactory> m_ptrFactory; common::CAutoPtr<net::INetRequest> m_NetRequest; String m_strListeningPorts; -#if !defined(RHO_HTTPD_COMMON_IMPL) - struct shttpd_ctx * m_shttpdCtx; -#else common::CAutoPtr<net::CHttpServer> m_httpServer; -#endif - String m_strRhoRootPath, m_strLoadingPagePath, m_strLoadingPngPath, m_strBlobsDirPath; + String m_strRhoRootPath, m_strLoadingPagePath, m_strLoadingPngPath, m_strBlobsDirPath, m_strDBDirPath; String m_strHomeUrl, m_strStartUrl, m_strOptionsUrl, m_strRhobundleReloadUrl, m_strFirstStartUrl; String m_strRhoMessage; int m_currentTabIndex; String m_currentUrls[5]; - common::CMutex m_mxViewMenuItems; - Hashtable<String,String> m_hashViewMenuItems; String m_strAppBackUrl; Vector<ICallbackObject*> m_arCallbackObjects; rubyext::CGeoLocation m_oGeoLocation; CSplashScreen m_oSplashScreen; + common::CMutex m_mxPushCallback; + String m_strPushCallback, m_strPushCallbackParams; + + common::CMutex m_mxScreenRotationCallback; + String m_strScreenRotationCallback, m_strScreenRotationCallbackParams; + + CAppMenu m_oAppMenu; + public: ~CRhodesApp(void); static CRhodesApp* Create(const String& strRootPath); static void Destroy(); @@ -64,10 +64,11 @@ void stopApp(); String canonicalizeRhoUrl(const String& strUrl) ; void keepLastVisitedUrl(String strUrl); void navigateToUrl( const String& strUrl); + void navigateBack(); const String& getRhobundleReloadUrl(); const String& getStartUrl(); const String& getOptionsUrl(); const String& getCurrentUrl(int index = 0); @@ -75,21 +76,24 @@ const String& getHomeUrl(){ return m_strHomeUrl; } const String& getLoadingPngPath(){return m_strLoadingPngPath;} const String& getLoadingPagePath(){return m_strLoadingPagePath; } const String& getBlobsDirPath(){return m_strBlobsDirPath; } + const String& getDBDirPath(){return m_strDBDirPath; } + String resolveDBFilesPath(const String& strFilePath); const String& getRhoRootPath(){return m_strRhoRootPath;} const String& getAppBackUrl(){return m_strAppBackUrl;} + void setAppBackUrl(const String& url); void callCameraCallback(String strCallbackUrl, const String& strImagePath, const String& strError, boolean bCancel ); void callDateTimeCallback(String strCallbackUrl, long lDateTime, const char* szData, int bCancel ); void callAppActiveCallback(boolean bActive); + void callPopupCallback(String strCallbackUrl, const String &id, const String &title); - void setViewMenu(unsigned long valMenu); - void addViewMenuItem( const String& strLabel, const String& strLink ); - + CAppMenu& getAppMenu (void) { return m_oAppMenu; } + boolean sendLog(); String addCallbackObject(ICallbackObject* pCallbackObject, String strName); unsigned long getCallbackObject(int nIndex); @@ -97,10 +101,19 @@ rubyext::CGeoLocation& getGeo(){ return m_oGeoLocation;} CSplashScreen& getSplashScreen(){return m_oSplashScreen;} void runCallbackInThread(const String& strCallback, const String& strBody); + + void setPushNotification(String strUrl, String strParams ); + boolean callPushCallback(String strData); + + void setScreenRotationNotification(String strUrl, String strParams); + void callScreenRotationCallback(int width, int height, int degrees); + + void loadUrl(String url); + private: virtual void run(); void initHttpServer(); void initAppUrls(); @@ -138,10 +151,12 @@ void rho_http_redirect(void* httpContext, const char* szUrl); void rho_http_senderror(void* httpContext, int nError, const char* szMsg); void rho_http_sendresponse(void* httpContext, const char* szBody); int rho_http_snprintf(char *buf, size_t buflen, const char *fmt, ...); + +void rho_rhodesapp_navigate_back(); char* rho_http_normalizeurl(const char* szUrl); void rho_http_free(void* data); void rho_rhodesapp_callCameraCallback(const char* strCallbackUrl, const char* strImagePath, @@ -150,15 +165,23 @@ void rho_rhodesapp_callAppActiveCallback(int nActive); unsigned long rho_rhodesapp_GetCallbackObject(int nIndex); void rho_rhodesapp_setViewMenu(unsigned long valMenu); const char* rho_rhodesapp_getappbackurl(); + +int rho_rhodesapp_callPushCallback(const char* szData); + +void rho_rhodesapp_callScreenRotationCallback(int width, int height, int degrees); +void rho_rhodesapp_callPopupCallback(const char *strCallbackUrl, const char *id, const char *title); + int rho_conf_send_log(); int rho_base64_encode(const char *src, int srclen, char *dst); int rho_base64_decode(const char *src, int srclen, char *dst); void rho_net_request(const char *url); + +void rho_rhodesapp_load_url(const char *url); #ifdef __cplusplus }; #endif //__cplusplus