Implemented progressbar for web application
[platform/framework/web/crosswalk-tizen.git] / runtime / browser / web_application.cc
index 191023c..09b6ad1 100755 (executable)
@@ -143,6 +143,12 @@ const char* kDefaultCSPRule =
 const char* kResWgtPath = "res/wgt/";
 const char* kAppControlMain = "http://tizen.org/appcontrol/operation/main";
 
+#ifdef PROFILE_MOBILE
+// window signal callback
+const char *kEdjeShowProgressSignal = "show,progress,signal";
+const char *kEdjeHideProgressSignal = "hide,progress,signal";
+#endif
+
 const std::string kViewmodeTypeFullscreen = "fullscreen";
 const std::string kViewmodeTypeWindowed = "windowed";
 
@@ -1125,8 +1131,34 @@ void WebApplication::OnLoadStart(WebView* /*view*/) {
   LOGGER(DEBUG) << "LoadStart";
 }
 
+#ifdef PROFILE_MOBILE
+void WebApplication::OnLoadProgress(WebView* view, double persent) {
+  LOGGER(DEBUG) << "LoadProgress, progress ;"<<persent;
+
+  if ((app_data_->setting_info() != NULL &&
+       app_data_->setting_info()->progressbar_presence()) ||
+       (app_data_->widget_info() != NULL &&
+       app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed)) {
+    if (persent == 1.0) {
+      window_->SignalEmit(kEdjeHideProgressSignal, "");
+    } else {
+      window_->SignalEmit(kEdjeShowProgressSignal, "");
+      window_->UpdateProgress(persent);
+    }
+  }
+}
+#endif
+
 void WebApplication::OnLoadFinished(WebView* /*view*/) {
   LOGGER(DEBUG) << "LoadFinished";
+#ifdef PROFILE_MOBILE
+  if ((app_data_->setting_info() != NULL &&
+       app_data_->setting_info()->progressbar_presence()) ||
+       (app_data_->widget_info() != NULL &&
+       app_data_->widget_info()->view_modes() == kViewmodeTypeWindowed)) {
+    window_->SignalEmit(kEdjeHideProgressSignal, "");
+  }
+#endif
   splash_screen_->HideSplashScreen(SplashScreen::HideReason::LOADFINISHED);
 }