// If the content is NULL, this call will just delete the previous object.
// If the If you wish to preserve it,
// issue elm_object_part_content_unset() on it first.
+ evas_object_show(content);
elm_object_part_content_unset(focus_, "elm.swallow.content");
elm_object_part_content_set(focus_, "elm.swallow.content", content);
elm_object_focus_set(focus_, EINA_TRUE);
// Reset to context
ClearViewStack();
WebView* view = new WebView(window_, ewk_context_);
- view->LoadUrl("index.html");
+ view->LoadUrl("file:///index.html");
view_stack_.push_front(view);
window_->SetContent(view->evas_object());
} else {
}
void WebApplication::ClearViewStack() {
+ window_->SetContent(NULL);
auto it = view_stack_.begin();
while (it != view_stack_.end()) {
(*it)->Suspend();
void WebApplication::Resume() {
if (view_stack_.size() > 0 && view_stack_.front() != NULL)
- view_stack_.front()->Resume();
+ view_stack_.front()->SetVisibility(true);
+
+ // TODO(sngn.lee) : should be check the background support option
+ // if background suuport options was on, skip below code
+
+ auto it = view_stack_.begin();
+ for ( ; it != view_stack_.end(); ++it) {
+ (*it)->Resume();
+ }
}
void WebApplication::Suspend() {
if (view_stack_.size() > 0 && view_stack_.front() != NULL)
- view_stack_.front()->Suspend();
+ view_stack_.front()->SetVisibility(false);
+
+ // TODO(sngn.lee) : should be check the background support option
+ // if background suuport options was on, skip below code
+ auto it = view_stack_.begin();
+ for ( ; it != view_stack_.end(); ++it) {
+ (*it)->Suspend();
+ }
}
void WebApplication::OnCreatedNewWebView(WebView* view, WebView* new_view) {
- view->Suspend();
if (view_stack_.size() > 0 && view_stack_.front() != NULL)
- view_stack_.front()->Suspend();
+ view_stack_.front()->SetVisibility(false);
- // TODO(sngn.lee): check the background support option
- // new_view.AlwaysRun(false);
view_stack_.push_front(new_view);
window_->SetContent(new_view->evas_object());
}
}
}
- delete view;
-
if (view_stack_.size() == 0) {
// TODO(sngn.lee): terminate the webapp
} else if (current != view_stack_.front()) {
+ view_stack_.front()->SetVisibility(true);
window_->SetContent(view_stack_.front()->evas_object());
}
+
+ delete view;
}
std::string WebApplication::GetDataPath() const {
: window_(window),
context_(context),
ewk_view_(NULL),
- listener_(NULL),
- always_run_(false) {
+ listener_(NULL) {
Initialize();
}
}
void WebView::Suspend() {
- // change the visibility
- ewk_view_visibility_set(ewk_view_, EINA_FALSE);
-
- if (!always_run_) {
- // suspend webview
- ewk_view_suspend(ewk_view_);
- }
+ // suspend webview
+ ewk_view_suspend(ewk_view_);
}
void WebView::Resume() {
- if (!always_run_) {
- // resume webview
- ewk_view_resume(ewk_view_);
- }
- // change the visiblity
- ewk_view_visibility_set(ewk_view_, EINA_TRUE);
+ // resume webview
+ ewk_view_resume(ewk_view_);
}
void WebView::Reload() {
ewk_view_reload(ewk_view_);
}
-void WebView::AlwaysRun(bool run) {
- always_run_ = run;
+void WebView::SetVisibility(bool show) {
+ ewk_view_visibility_set(ewk_view_, show ? EINA_TRUE : EINA_FALSE);
}
+
bool WebView::EvalJavascript(const std::string& script) {
return ewk_view_script_execute(ewk_view_, script.c_str(), NULL, NULL);
}