virtual std::string getTitle(void) const = 0;
/**
+ * Suspend current webview.
+ */
+ virtual void suspend(void) = 0;
+
+ /**
+ * Resume current webview.
+ */
+ virtual void resume(void) = 0;
+
+ /**
+ * @return true if current webview is suspended, false otherwise
+ */
+ virtual bool isSuspended(void) const = 0;
+
+ /**
* Stop loading current page.
*/
virtual void stopLoading(void) = 0;
: m_window()
{}
- virtual int exec(const std::string& url)=0;
+ virtual int exec(const std::string& url) = 0;
std::shared_ptr<T> getMainWindow(){return m_window;};
/**
*/
void setMainWindow(T *rawPtr){ m_window=std::shared_ptr<T>(rawPtr);}
virtual void destroyUI() { }
+
+ virtual void suspend() = 0;
+ virtual void resume() = 0;
+
protected:
std::shared_ptr<T> m_window;
};
static void app_pause(void *){
BROWSER_LOGD("%s", __PRETTY_FUNCTION__);
+
+ std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
+ std::dynamic_pointer_cast
+ <
+ tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
+ tizen_browser::core::AbstractService
+ >
+ (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
+ mainUi->suspend();
}
static void app_resume(void *){
BROWSER_LOGD("%s", __PRETTY_FUNCTION__);
+
+ std::shared_ptr<tizen_browser::base_ui::AbstractMainWindow<Evas_Object>> mainUi =
+ std::dynamic_pointer_cast
+ <
+ tizen_browser::base_ui::AbstractMainWindow<Evas_Object>,
+ tizen_browser::core::AbstractService
+ >
+ (tizen_browser::core::ServiceManager::getInstance().getService("org.tizen.browser.simpleui"));
+ mainUi->resume();
}
int main(int argc, char* argv[])try
{
BROWSER_LOGD("[%s:%d] ", __PRETTY_FUNCTION__, __LINE__);
M_ASSERT(m_viewManager);
+ if(m_webEngine->isSuspended())
+ m_webEngine->resume();
m_webPageUI->switchViewToWebPage(m_webEngine->getLayout(), m_webEngine->getURI(), m_webEngine->getTitle());
}
virtual ~SimpleUI();
virtual int exec(const std::string& url);
virtual std::string getName();
+ void suspend() {m_webEngine->suspend();}
+ void resume() {m_webEngine->resume();}
void destroyUI();
private:
return std::string("");
}
+void WebKitEngineService::suspend()
+{
+ if(tabsCount()>0) {
+ M_ASSERT(m_currentWebView);
+ m_currentWebView->suspend();
+ }
+}
+
+void WebKitEngineService::resume()
+{
+ if(tabsCount()>0) {
+ M_ASSERT(m_currentWebView);
+ m_currentWebView->resume();
+ }
+}
+
+bool WebKitEngineService::isSuspended() const
+{
+ M_ASSERT(m_currentWebView);
+ return m_currentWebView->isSuspended();
+}
+
void WebKitEngineService::stopLoading(void)
{
M_ASSERT(m_currentWebView);
// if there was any running WebView
if (m_currentWebView) {
disconnectSignals(m_currentWebView);
+ suspend();
}
m_currentWebView = m_tabs[newTabId];
m_mostRecentTab.push_back(newTabId);
connectSignals(m_currentWebView);
+ resume();
titleChanged(m_currentWebView->getTitle());
uriChanged(m_currentWebView->getURI());
std::string getTitle(void) const;
+ void suspend(void);
+ void resume(void);
+ bool isSuspended(void) const;
+
void stopLoading(void);
void reload(void);
, m_ewkView(nullptr)
, m_isLoading(false)
, m_loadError(false)
+ , m_suspended(false)
, m_private(-1)
{
config.load("whatever");
setupEwkSettings();
registerCallbacks();
+ resume();
#else
m_ewkView = evas_object_rectangle_add(evas_object_evas_get(m_parent));
#endif
return m_title;
}
+void WebView::suspend()
+{
+ BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__);
+ M_ASSERT(m_ewkView);
+
+ ewk_view_suspend(m_ewkView);
+ m_suspended = true;
+}
+
+void WebView::resume()
+{
+ BROWSER_LOGD("%s:%d %s", __FILE__, __LINE__, __func__);
+ M_ASSERT(m_ewkView);
+
+ ewk_view_resume(m_ewkView);
+ m_suspended = false;
+}
+
void WebView::stopLoading(void)
{
#if defined(USE_EWEBKIT)
std::string getTitle(void);
+ void suspend(void);
+ void resume(void);
+ bool isSuspended(void) const { return m_suspended; }
+
void stopLoading(void);
void reload(void);
bool m_loadError;
// true if desktop view is enabled, false if mobile
bool m_desktopMode;
+ bool m_suspended;
int m_private;
config::DefaultConfig config;