LaunchScreen feature implementation
authorWojciech Kosowicz <w.kosowicz@samsung.com>
Wed, 7 Oct 2015 12:47:20 +0000 (14:47 +0200)
committerArkadiusz Szulakiewicz <a.szulakiewi@partner.samsung.com>
Tue, 24 Nov 2015 15:05:16 +0000 (16:05 +0100)
This commit is dependant on manifest-parser feautre:
https://review.tizen.org/gerrit/#/c/48846/

For more details
https://crosswalk-project.org/documentation/manifest/launch_screen.html

LaunchScreen feature implementation

This commit is dependant on manifest-parser feautre:
https://review.tizen.org/gerrit/#/c/48846/

For more details
https://crosswalk-project.org/documentation/manifest/launch_screen.html

extensions/extensions.gyp
extensions/internal/splash_screen/splash_screen.json [new file with mode: 0644]
extensions/internal/splash_screen/splash_screen_api.js [new file with mode: 0644]
extensions/internal/splash_screen/splash_screen_extension.cc [new file with mode: 0644]
extensions/renderer/object_tools_module.h
packaging/crosswalk-tizen.spec
runtime/browser/splash_screen.cc [new file with mode: 0644]
runtime/browser/splash_screen.h [new file with mode: 0644]
runtime/browser/web_application.cc
runtime/browser/web_application.h
runtime/runtime.gyp

index 5ff2945..871cd6e 100644 (file)
         },
       ],
     }, # end of target 'widget_plugin'
+    {
+      'target_name': 'splash_screen_plugin',
+      'type': 'shared_library',
+      'dependencies': [
+        '../common/common.gyp:xwalk_tizen_common',
+      ],
+      'sources': [
+        'internal/splash_screen/splash_screen_api.js',
+        'internal/splash_screen/splash_screen_extension.cc',
+      ],
+      'copies': [
+        {
+          'destination': '<(SHARED_INTERMEDIATE_DIR)',
+          'files': [
+            'internal/splash_screen/splash_screen.json'
+          ],
+        },
+      ],
+    }, # end of target 'splash_screen_plugin'
   ], # end of targets
 }
diff --git a/extensions/internal/splash_screen/splash_screen.json b/extensions/internal/splash_screen/splash_screen.json
new file mode 100644 (file)
index 0000000..e7a565d
--- /dev/null
@@ -0,0 +1,7 @@
+[
+  {
+    "name":"SplashScreen",
+    "lib":"libsplash_screen_plugin.so",
+    "entry_points":["window.screen.show"]
+  }
+]
diff --git a/extensions/internal/splash_screen/splash_screen_api.js b/extensions/internal/splash_screen/splash_screen_api.js
new file mode 100644 (file)
index 0000000..c77d79a
--- /dev/null
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+var native = new xwalk.utils.NativeManager(extension);
+
+window.screen.show = function() {
+  native.sendRuntimeMessage('tizen://hide_splash_screen');
+};
\ No newline at end of file
diff --git a/extensions/internal/splash_screen/splash_screen_extension.cc b/extensions/internal/splash_screen/splash_screen_extension.cc
new file mode 100644 (file)
index 0000000..19823e5
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include <list>
+#include <memory>
+#include <map>
+#include <vector>
+
+#include "extensions/public/XW_Extension.h"
+#include "extensions/public/XW_Extension_EntryPoints.h"
+#include "extensions/public/XW_Extension_Permissions.h"
+#include "extensions/public/XW_Extension_Runtime.h"
+#include "extensions/public/XW_Extension_SyncMessage.h"
+
+#include "common/application_data.h"
+#include "common/locale_manager.h"
+#include "common/logger.h"
+#include "common/string_utils.h"
+
+XW_Extension g_xw_extension = 0;
+const XW_CoreInterface* g_core = NULL;
+const XW_MessagingInterface* g_messaging = NULL;
+const XW_Internal_SyncMessagingInterface* g_sync_messaging = NULL;
+const XW_Internal_EntryPointsInterface* g_entry_points = NULL;
+const XW_Internal_RuntimeInterface* g_runtime = NULL;
+
+extern const char kSource_splash_screen_api[];
+
+extern "C" int32_t XW_Initialize(XW_Extension extension,
+                                 XW_GetInterface get_interface) {
+  g_xw_extension = extension;
+  g_core = reinterpret_cast<const XW_CoreInterface*>(
+      get_interface(XW_CORE_INTERFACE));
+  if (!g_core) {
+    LOGGER(ERROR)
+        << "Can't initialize extension: error getting Core interface.";
+    return XW_ERROR;
+  }
+
+  g_messaging = reinterpret_cast<const XW_MessagingInterface*>(
+      get_interface(XW_MESSAGING_INTERFACE));
+  if (!g_messaging) {
+    LOGGER(ERROR)
+        << "Can't initialize extension: error getting Messaging interface.";
+    return XW_ERROR;
+  }
+
+  g_sync_messaging =
+      reinterpret_cast<const XW_Internal_SyncMessagingInterface*>(
+          get_interface(XW_INTERNAL_SYNC_MESSAGING_INTERFACE));
+  if (!g_sync_messaging) {
+    LOGGER(ERROR)
+        << "Can't initialize extension: "
+        << "error getting SyncMessaging interface.";
+    return XW_ERROR;
+  }
+
+  g_entry_points = reinterpret_cast<const XW_Internal_EntryPointsInterface*>(
+      get_interface(XW_INTERNAL_ENTRY_POINTS_INTERFACE));
+  if (!g_entry_points) {
+    LOGGER(ERROR)
+        << "NOTE: Entry points interface not available in this version "
+        << "of Crosswalk, ignoring entry point data for extensions.\n";
+    return XW_ERROR;
+  }
+
+  g_runtime = reinterpret_cast<const XW_Internal_RuntimeInterface*>(
+      get_interface(XW_INTERNAL_RUNTIME_INTERFACE));
+  if (!g_runtime) {
+    LOGGER(ERROR)
+        << "NOTE: runtime interface not available in this version "
+        << "of Crosswalk, ignoring runtime variables for extensions.\n";
+    return XW_ERROR;
+  }
+
+  g_core->SetExtensionName(g_xw_extension, "SplashScreen");
+  const char* entry_points[] = {"window.screen.show", NULL};
+  g_entry_points->SetExtraJSEntryPoints(g_xw_extension, entry_points);
+  g_core->SetJavaScriptAPI(g_xw_extension, kSource_splash_screen_api);
+
+  return XW_OK;
+}
index 4567c3c..eb4609b 100644 (file)
@@ -34,4 +34,3 @@ class ObjectToolsModule : public XWalkNativeModule {
 }  // namespace extensions
 
 #endif  // XWALK_EXTENSIONS_RENDERER_OBJECT_TOOLS_MODULE_H_
-
index 1c58738..0104426 100644 (file)
@@ -104,6 +104,10 @@ install -p -m 755 out/Default/xwalk_extension %{buildroot}%{_bindir}
 install -p -m 644 out/Default/lib/libwidget_plugin.so %{buildroot}%{extension_path}
 install -p -m 644 out/Default/gen/widget.json %{buildroot}%{extension_path}
 
+# screen_plugin
+install -p -m 644 out/Default/lib/libsplash_screen_plugin.so %{buildroot}%{extension_path}
+install -p -m 644 out/Default/gen/splash_screen.json %{buildroot}%{extension_path}
+
 # xwalk_runtime
 install -p -m 755 out/Default/xwalk_runtime %{buildroot}%{_bindir}
 ln -s %{_bindir}/xwalk_runtime %{buildroot}%{_bindir}/wrt
@@ -129,6 +133,8 @@ rm -fr %{buildroot}
 %attr(644,root,root) %{_libdir}/libxwalk_injected_bundle.so
 %attr(644,root,root) %{extension_path}/libwidget_plugin.so
 %attr(644,root,root) %{extension_path}/widget.json
+%attr(644,root,root) %{extension_path}/libsplash_screen_plugin.so
+%attr(644,root,root) %{extension_path}/splash_screen.json
 %attr(755,root,root) %{_bindir}/xwalk_extension
 %attr(755,root,root) %{_bindir}/xwalk_runtime
 %attr(755,root,root) %{_bindir}/wrt
diff --git a/runtime/browser/splash_screen.cc b/runtime/browser/splash_screen.cc
new file mode 100644 (file)
index 0000000..318c07b
--- /dev/null
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#include "runtime/browser/splash_screen.h"
+
+#include <algorithm>
+#include <map>
+#include <string>
+
+#if defined(HAVE_X11)
+#include <Ecore_X.h>
+#elif defined(HAVE_WAYLAND)
+#include <Ecore_Wayland.h>
+#endif
+#include <Evas_Legacy.h>
+
+#include "common/logger.h"
+#include "manifest_handlers/splash_screen_handler.h"
+#include "runtime/browser/native_window.h"
+
+using ScreenOrientation = runtime::NativeWindow::ScreenOrientation;
+
+namespace {
+
+enum class BorderOption { REPEAT = 1, STRETCH, ROUND };
+
+wgt::parse::ScreenOrientation ChooseOrientation(
+    const std::map<wgt::parse::ScreenOrientation,
+    wgt::parse::SplashScreenData>& splash_map,
+    ScreenOrientation screen_orientation) {
+  auto orientation_pair = splash_map.end();
+
+  if (screen_orientation ==
+      runtime::NativeWindow::ScreenOrientation::PORTRAIT_PRIMARY) {
+     orientation_pair =
+         splash_map.find(wgt::parse::ScreenOrientation::PORTRAIT);
+  } else {
+    orientation_pair =
+        splash_map.find(wgt::parse::ScreenOrientation::LANDSCAPE);
+  }
+  if (orientation_pair == splash_map.end())
+        orientation_pair = splash_map.find(wgt::parse::ScreenOrientation::AUTO);
+
+  if (orientation_pair != splash_map.end()) return orientation_pair->first;
+  return wgt::parse::ScreenOrientation::NONE;
+}
+
+bool ParseImageBorder(const std::vector<std::string>& borders,
+                      std::vector<int>* border_values,
+                      std::vector<BorderOption>* border_options) {
+  std::map<std::string, BorderOption> scaling_string;
+  scaling_string["repeat"] = BorderOption::REPEAT;
+  scaling_string["stretch"] = BorderOption::STRETCH;
+  scaling_string["round"] = BorderOption::ROUND;
+
+  for (const auto& border : borders) {
+    std::string::size_type px_index = border.find("px");
+    if (px_index != std::string::npos) {
+      std::string border_value(border.begin(), border.begin() + px_index);
+      border_values->push_back(std::atoi(border_value.c_str()));
+    }
+    for (const auto& border_string_val : scaling_string) {
+      std::string::size_type index = border.find(border_string_val.first);
+      if (index != std::string::npos) {
+        border_options->push_back(border_string_val.second);
+      }
+    }
+  }
+
+  LOGGER(DEBUG) << "Image border values:";
+  for (const auto& border_value : *border_values) {
+    LOGGER(DEBUG) << border_value;
+  }
+  LOGGER(DEBUG) << "Image border scaling values:";
+  for (const auto& border_option : *border_options) {
+    LOGGER(DEBUG) << static_cast<int>(border_option);
+  }
+
+  return !border_values->empty() && !border_options->empty();
+}
+
+}  // namespace
+
+namespace runtime {
+
+SplashScreen::SplashScreen(
+    runtime::NativeWindow* window,
+    std::shared_ptr<const wgt::parse::SplashScreenInfo> ss_info,
+    const std::string& app_path)
+    : window_(window),
+      ss_info_(ss_info),
+      image_(nullptr),
+      background_(nullptr),
+      is_active_(false) {
+  LOGGER(DEBUG) << "start of create splash screen";
+  if (ss_info == nullptr) return;
+  auto splash_map = ss_info->splash_screen_data();
+  auto used_orientation =
+      ChooseOrientation(splash_map, window->natural_orientation());
+  if (used_orientation == wgt::parse::ScreenOrientation::NONE) return;
+
+  auto dimensions = GetDimensions();
+
+  SetBackground(splash_map[used_orientation], window->evas_object(),
+                     dimensions, app_path);
+  SetImage(splash_map[used_orientation], window->evas_object(),
+                     dimensions, app_path);
+  is_active_ = true;
+}
+
+
+void SplashScreen::HideSplashScreen(HideReason reason) {
+  if (!is_active_) return;
+  if (reason == HideReason::RENDERED &&
+      ss_info_->ready_when() != wgt::parse::ReadyWhen::FIRSTPAINT) {
+    return;
+  }
+  if (reason == HideReason::LOADFINISHED &&
+      ss_info_->ready_when() != wgt::parse::ReadyWhen::COMPLETE) {
+    return;
+  }
+  if (reason == HideReason::CUSTOM &&
+      ss_info_->ready_when() != wgt::parse::ReadyWhen::CUSTOM) {
+    return;
+  }
+
+  evas_object_hide(background_);
+  evas_object_hide(image_);
+  evas_object_del(background_);
+  evas_object_del(image_);
+  background_ = nullptr;
+  image_ = nullptr;
+  is_active_ = false;
+}
+
+std::pair<int, int> SplashScreen::GetDimensions() {
+  int w, h;
+#if defined(HAVE_X11)
+  uint16_t pid = getpid();
+  ecore_x_window_prop_property_set(elm_win_xwindow_get(window_.evas_object()),
+                                   ECORE_X_ATOM_NET_WM_PID,
+                                   ECORE_X_ATOM_CARDINAL, 32, &pid, 1);
+  ecore_x_vsync_animator_tick_source_set(
+      elm_win_xwindow_get(window_.evas_object()));
+  ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+#elif defined(HAVE_WAYLAND)
+  ecore_wl_screen_size_get(&w, &h);
+#endif
+  evas_object_resize(background_, w, h);
+  return std::make_pair(w, h);
+}
+
+void SplashScreen::SetBackground(
+    const wgt::parse::SplashScreenData& splash_data, Evas_Object* parent,
+    const SplashScreenBound& bound, const std::string& app_path) {
+  background_ = elm_bg_add(parent);
+  if (!background_) return;
+  evas_object_resize(background_, bound.first, bound.second);
+
+  if (splash_data.background_color != nullptr) {
+    elm_bg_color_set(background_,
+                     splash_data.background_color->red,
+                     splash_data.background_color->green,
+                     splash_data.background_color->blue);
+  }
+
+  std::vector<int> border_values;
+  std::vector<BorderOption> border_options;
+
+  if (!splash_data.background_image.empty() &&
+      ParseImageBorder(
+          splash_data.image_border, &border_values, &border_options)) {
+    const std::string& background_image_path =
+        splash_data.background_image.front();
+
+    background_image_ = elm_image_add(background_);
+    evas_object_image_file_set(background_image_,
+                               (app_path + background_image_path).c_str(),
+                               NULL);
+    elm_image_aspect_fixed_set(background_image_, 0);
+    evas_object_image_border_center_fill_set(background_image_,
+                                             EVAS_BORDER_FILL_DEFAULT);
+
+    evas_object_resize(background_image_, bound.first, bound.second);
+
+    int border_l, border_r, border_t, border_b;
+    switch (border_values.size()) {
+      case 1:
+        border_l = border_r = border_t = border_b = -border_values[0];
+        break;
+      case 2:
+        border_t = border_b =  border_values[0];
+        border_l = border_r =  border_values[1];
+        break;
+      case 4:
+        border_t = border_values[0];
+        border_r = border_values[1];
+        border_b = border_values[2];
+        border_l = border_values[3];
+        break;
+      default:
+        border_l = border_r = border_t = border_b = 0;
+    }
+    evas_object_image_border_set(background_image_,
+                                 border_l,
+                                 border_r,
+                                 border_t,
+                                 border_b);
+    // TODO(a.szulakiewi): add scaling of horizontal and vertical borders
+  }
+
+  evas_object_show(background_);
+  evas_object_show(background_image_);
+}
+
+void SplashScreen::SetImage(
+    const wgt::parse::SplashScreenData& splash_data, Evas_Object* parent,
+    const SplashScreenBound& bound, const std::string& app_path) {
+  if (!background_) return;
+  image_ = elm_image_add(background_);
+  if (!image_) return;
+
+  const std::string& image_path = splash_data.image.front();
+  elm_image_file_set(image_, (app_path + image_path).c_str(), NULL);
+  evas_object_resize(image_, bound.first, bound.second);
+  evas_object_show(image_);
+}
+}  // namespace runtime
diff --git a/runtime/browser/splash_screen.h b/runtime/browser/splash_screen.h
new file mode 100644 (file)
index 0000000..90fa986
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+#ifndef XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_
+#define XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_
+
+#include <map>
+#include <memory>
+#include <utility>
+#include <string>
+#include <vector>
+
+#include <Elementary.h>
+
+#include "manifest_handlers/splash_screen_handler.h"
+#include "runtime/browser/native_window.h"
+
+namespace runtime {
+
+class SplashScreen {
+ public:
+  typedef std::pair<int, int> SplashScreenBound;
+  enum class HideReason { RENDERED, LOADFINISHED, CUSTOM };
+
+  SplashScreen(NativeWindow* window,
+               std::shared_ptr<const wgt::parse::SplashScreenInfo> ss_info,
+               const std::string& app_path);
+  void HideSplashScreen(HideReason reason);
+
+ private:
+  std::pair<int, int> GetDimensions();
+  void SetBackground(const wgt::parse::SplashScreenData& splash_data,
+                     Evas_Object* parent, const SplashScreenBound& bound,
+                     const std::string& app_path);
+
+  void SetImage(const wgt::parse::SplashScreenData& splash_data,
+                Evas_Object* parent, const SplashScreenBound& bound,
+                const std::string& app_path);
+
+  std::shared_ptr<const wgt::parse::SplashScreenInfo> ss_info_;
+  NativeWindow* window_;
+  Evas_Object* image_;
+  Evas_Object* background_;
+  Evas_Object* background_image_;
+  bool is_active_;
+};
+}  // namespace runtime
+#endif  // XWALK_RUNTIME_BROWSER_SPLASH_SCREEN_H_
index c894cac..6be84b1 100755 (executable)
 #include "runtime/browser/popup_string.h"
 #include "runtime/browser/vibration_manager.h"
 #include "runtime/browser/web_view.h"
+#include "runtime/browser/splash_screen.h"
 
 #ifndef INJECTED_BUNDLE_PATH
-  #error INJECTED_BUNDLE_PATH is not set.
+#error INJECTED_BUNDLE_PATH is not set.
 #endif
 
 namespace runtime {
@@ -59,7 +60,7 @@ const char* kConsoleMessageLogTag = "ConsoleMessage";
 const char* kDebugKey = "debug";
 const char* kPortKey = "port";
 
-const char* kAppControlEventScript = \
+const char* kAppControlEventScript =
     "(function(){"
     "var __event = document.createEvent(\"CustomEvent\");\n"
     "__event.initCustomEvent(\"appcontrol\", true, true);\n"
@@ -68,7 +69,7 @@ const char* kAppControlEventScript = \
     "for (var i=0; i < window.frames.length; i++)\n"
     "{ window.frames[i].document.dispatchEvent(__event); }"
     "})()";
-const char* kBackKeyEventScript = \
+const char* kBackKeyEventScript =
     "(function(){"
     "var __event = document.createEvent(\"CustomEvent\");\n"
     "__event.initCustomEvent(\"tizenhwkey\", true, true);\n"
@@ -78,7 +79,7 @@ const char* kBackKeyEventScript = \
     "for (var i=0; i < window.frames.length; i++)\n"
     "{ window.frames[i].document.dispatchEvent(__event); }"
     "})()";
-const char* kMenuKeyEventScript = \
+const char* kMenuKeyEventScript =
     "(function(){"
     "var __event = document.createEvent(\"CustomEvent\");\n"
     "__event.initCustomEvent(\"tizenhwkey\", true, true);\n"
@@ -90,14 +91,10 @@ const char* kMenuKeyEventScript = \
     "})()";
 const char* kFullscreenPrivilege = "http://tizen.org/privilege/fullscreen";
 const char* kFullscreenFeature = "fullscreen";
-const char* kNotificationPrivilege =
-    "http://tizen.org/privilege/notification";
-const char* kLocationPrivilege =
-    "http://tizen.org/privilege/location";
-const char* kStoragePrivilege =
-    "http://tizen.org/privilege/unlimitedstorage";
-const char* kUsermediaPrivilege =
-    "http://tizen.org/privilege/mediacapture";
+const char* kNotificationPrivilege = "http://tizen.org/privilege/notification";
+const char* kLocationPrivilege = "http://tizen.org/privilege/location";
+const char* kStoragePrivilege = "http://tizen.org/privilege/unlimitedstorage";
+const char* kUsermediaPrivilege = "http://tizen.org/privilege/mediacapture";
 const char* kNotiIconFile = "noti_icon.png";
 
 const char* kVisibilitySuspendFeature = "visibility,suspend";
@@ -121,13 +118,11 @@ const char* kDefaultCSPRule =
 
 bool FindPrivilege(common::ApplicationData* app_data,
                    const std::string& privilege) {
-  if (app_data->permissions_info().get() == NULL)
-    return false;
+  if (app_data->permissions_info().get() == NULL) return false;
   auto it = app_data->permissions_info()->GetAPIPermissions().begin();
   auto end = app_data->permissions_info()->GetAPIPermissions().end();
-  for ( ; it != end; ++it) {
-    if (*it == privilege)
-      return true;
+  for (; it != end; ++it) {
+    if (*it == privilege) return true;
   }
   return false;
 }
@@ -141,17 +136,15 @@ static void SendDownloadRequest(const std::string& url) {
 
 static void InitializeNotificationCallback(Ewk_Context* ewk_context,
                                            WebApplication* app) {
-  auto show = [](Ewk_Context*,
-                 Ewk_Notification* noti,
-                 void* user_data) {
+  auto show = [](Ewk_Context*, Ewk_Notification* noti, void* user_data) {
     WebApplication* self = static_cast<WebApplication*>(user_data);
-    if (self == NULL)
-      return;
+    if (self == NULL) return;
     uint64_t id = ewk_notification_id_get(noti);
-    std::string title(ewk_notification_title_get(noti) ?
-                      ewk_notification_title_get(noti) : "");
-    std::string body(ewk_notification_body_get(noti) ?
-                     ewk_notification_body_get(noti) : "");
+    std::string title(ewk_notification_title_get(noti)
+                          ? ewk_notification_title_get(noti)
+                          : "");
+    std::string body(
+        ewk_notification_body_get(noti) ? ewk_notification_body_get(noti) : "");
     std::string icon_path = self->data_path() + "/" + kNotiIconFile;
     if (!ewk_notification_icon_save_as_png(noti, icon_path.c_str())) {
       icon_path = "";
@@ -159,16 +152,11 @@ static void InitializeNotificationCallback(Ewk_Context* ewk_context,
     if (NotificationManager::GetInstance()->Show(id, title, body, icon_path))
       ewk_notification_showed(id);
   };
-  auto hide = [](Ewk_Context*,
-                 uint64_t noti_id,
-                 void *) {
+  auto hide = [](Ewk_Context*, uint64_t noti_id, void*) {
     NotificationManager::GetInstance()->Hide(noti_id);
     ewk_notification_closed(noti_id, EINA_FALSE);
   };
-  ewk_context_notification_callbacks_set(ewk_context,
-                                         show,
-                                         hide,
-                                         app);
+  ewk_context_notification_callbacks_set(ewk_context, show, hide, app);
 }
 
 static Eina_Bool ExitAppIdlerCallback(void* data) {
@@ -201,8 +189,8 @@ static bool ProcessWellKnownScheme(const std::string& url) {
     return false;
   }
 
-  std::unique_ptr<common::AppControl>
-      request(common::AppControl::MakeAppcontrolFromURL(url));
+  std::unique_ptr<common::AppControl> request(
+      common::AppControl::MakeAppcontrolFromURL(url));
   if (request.get() == NULL || !request->LaunchRequest()) {
     LOGGER(ERROR) << "Fail to send appcontrol request";
     SLoggerE("Fail to send appcontrol request [%s]", url.c_str());
@@ -218,27 +206,27 @@ WebApplication::WebApplication(
     NativeWindow* window, std::unique_ptr<common::ApplicationData> app_data)
     : launched_(false),
       debug_mode_(false),
-      ewk_context_(ewk_context_new_with_injected_bundle_path(
-          INJECTED_BUNDLE_PATH)),
+      ewk_context_(
+          ewk_context_new_with_injected_bundle_path(INJECTED_BUNDLE_PATH)),
       window_(window),
       appid_(app_data->app_id()),
       locale_manager_(new common::LocaleManager()),
       app_data_(std::move(app_data)),
       terminator_(NULL) {
-  std::unique_ptr<char, decltype(std::free)*>
-    path {app_get_data_path(), std::free};
+  std::unique_ptr<char, decltype(std::free)*> path{app_get_data_path(),
+                                                   std::free};
   app_data_path_ = path.get();
-
+  LOGGER(ERROR) << "path is " << path.get();
+  splash_screen_.reset(new SplashScreen(
+      window_, app_data_->splash_screen_info(), app_data_->application_path()));
   resource_manager_.reset(
       new common::ResourceManager(app_data_.get(), locale_manager_.get()));
-  resource_manager_->set_base_resource_path(
-      app_data_->application_path());
+  resource_manager_->set_base_resource_path(app_data_->application_path());
   Initialize();
 }
 
 WebApplication::~WebApplication() {
-  if (ewk_context_)
-    ewk_context_delete(ewk_context_);
+  if (ewk_context_) ewk_context_delete(ewk_context_);
 }
 
 bool WebApplication::Initialize() {
@@ -254,8 +242,8 @@ bool WebApplication::Initialize() {
   // set persistent storage path
   std::string cookie_path = data_path() + ".cookie";
   ewk_cookie_manager_persistent_storage_set(
-                                      cookie_manager, cookie_path.c_str(),
-                                      EWK_COOKIE_PERSISTENT_STORAGE_SQLITE);
+      cookie_manager, cookie_path.c_str(),
+      EWK_COOKIE_PERSISTENT_STORAGE_SQLITE);
 
   // vibration callback
   auto vibration_start_callback = [](uint64_t ms, void*) {
@@ -264,71 +252,59 @@ bool WebApplication::Initialize() {
   auto vibration_stop_callback = [](void* /*user_data*/) {
     platform::VibrationManager::GetInstance()->Stop();
   };
-  ewk_context_vibration_client_callbacks_set(ewk_context_,
-                                             vibration_start_callback,
-                                             vibration_stop_callback,
-                                             NULL);
+  ewk_context_vibration_client_callbacks_set(
+      ewk_context_, vibration_start_callback, vibration_stop_callback, NULL);
 
   auto download_callback = [](const char* downloadUrl, void* /*data*/) {
     SendDownloadRequest(downloadUrl);
   };
-  ewk_context_did_start_download_callback_set(ewk_context_,
-                                              download_callback,
+  ewk_context_did_start_download_callback_set(ewk_context_, download_callback,
                                               this);
   InitializeNotificationCallback(ewk_context_, this);
 
   if (FindPrivilege(app_data_.get(), kFullscreenPrivilege)) {
     ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                                kFullscreenFeature,
-                                                true);
+                                                kFullscreenFeature, true);
   }
 
   if (app_data_->setting_info() != NULL &&
       app_data_->setting_info()->background_support_enabled()) {
+    ewk_context_tizen_extensible_api_string_set(
+        ewk_context_, kVisibilitySuspendFeature, true);
     ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                                kVisibilitySuspendFeature,
-                                                true);
-    ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                                kBackgroundMusicFeature,
-                                                true);
+                                                kBackgroundMusicFeature, true);
   }
   ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                              kMediastreamRecordFeature,
-                                              true);
+                                              kMediastreamRecordFeature, true);
   ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                              kEncryptedDatabaseFeature,
-                                              true);
+                                              kEncryptedDatabaseFeature, true);
   if (app_data_->setting_info() != NULL &&
-      app_data_->setting_info()->screen_orientation()
-      == wgt::parse::SettingInfo::ScreenOrientation::AUTO) {
+      app_data_->setting_info()->screen_orientation() ==
+          wgt::parse::SettingInfo::ScreenOrientation::AUTO) {
     ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                                kRotationLockFeature,
-                                                true);
+                                                kRotationLockFeature, true);
   } else if (app_data_->setting_info() != NULL &&
-             app_data_->setting_info()->screen_orientation()
-             == wgt::parse::SettingInfo::ScreenOrientation::PORTRAIT) {
-    window_->SetRotationLock(
-        NativeWindow::ScreenOrientation::PORTRAIT_PRIMARY);
+             app_data_->setting_info()->screen_orientation() ==
+                 wgt::parse::SettingInfo::ScreenOrientation::PORTRAIT) {
+    window_->SetRotationLock(NativeWindow::ScreenOrientation::PORTRAIT_PRIMARY);
   } else if (app_data_->setting_info() != NULL &&
-             app_data_->setting_info()->screen_orientation()
-             == wgt::parse::SettingInfo::ScreenOrientation::LANDSCAPE) {
+             app_data_->setting_info()->screen_orientation() ==
+                 wgt::parse::SettingInfo::ScreenOrientation::LANDSCAPE) {
     window_->SetRotationLock(
         NativeWindow::ScreenOrientation::LANDSCAPE_PRIMARY);
   }
 
   if (app_data_->setting_info() != NULL &&
-      app_data_->setting_info()->sound_mode()
-      == wgt::parse::SettingInfo::SoundMode::EXCLUSIVE) {
-    ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                                kSoundModeFeature,
+      app_data_->setting_info()->sound_mode() ==
+          wgt::parse::SettingInfo::SoundMode::EXCLUSIVE) {
+    ewk_context_tizen_extensible_api_string_set(ewk_context_, kSoundModeFeature,
                                                 true);
   }
 
   if (app_data_->setting_info() != NULL &&
       app_data_->setting_info()->background_vibration()) {
-    ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                                kBackgroundVibrationFeature,
-                                                true);
+    ewk_context_tizen_extensible_api_string_set(
+        ewk_context_, kBackgroundVibrationFeature, true);
   }
 
   if (app_data_->widget_info() != NULL &&
@@ -343,8 +319,7 @@ bool WebApplication::Initialize() {
   // TODO(sngn.lee): find the proxy url
   // ewk_context_proxy_uri_set(ewk_context_, ... );
 
-  if (app_data_->csp_info() != NULL ||
-      app_data_->csp_report_info() != NULL ||
+  if (app_data_->csp_info() != NULL || app_data_->csp_report_info() != NULL ||
       app_data_->allowed_navigation_info() != NULL) {
     security_model_version_ = 2;
     if (app_data_->csp_info() == NULL ||
@@ -357,8 +332,7 @@ bool WebApplication::Initialize() {
         !app_data_->csp_report_info()->security_rules().empty()) {
       csp_report_rule_ = app_data_->csp_report_info()->security_rules();
     }
-    ewk_context_tizen_extensible_api_string_set(ewk_context_,
-                                                kCSPFeature,
+    ewk_context_tizen_extensible_api_string_set(ewk_context_, kCSPFeature,
                                                 EINA_TRUE);
   } else {
     security_model_version_ = 1;
@@ -373,13 +347,11 @@ void WebApplication::Launch(std::unique_ptr<common::AppControl> appcontrol) {
   SetupWebView(view);
 
   // send widget info to injected bundle
-  ewk_send_widget_info(ewk_context_, appid_.c_str(),
-                       elm_config_scale_get(),
-                       elm_theme_get(NULL),
-                       "");
+  ewk_send_widget_info(ewk_context_, appid_.c_str(), elm_config_scale_get(),
+                       elm_theme_get(NULL), "");
 
   std::unique_ptr<common::ResourceManager::Resource> res =
-    resource_manager_->GetStartResource(appcontrol.get());
+      resource_manager_->GetStartResource(appcontrol.get());
   view->SetDefaultEncoding(res->encoding());
 
   STEP_PROFILE_END("OnCreate -> URL Set");
@@ -406,7 +378,7 @@ void WebApplication::Launch(std::unique_ptr<common::AppControl> appcontrol) {
 void WebApplication::AppControl(
     std::unique_ptr<common::AppControl> appcontrol) {
   std::unique_ptr<common::ResourceManager::Resource> res =
-    resource_manager_->GetStartResource(appcontrol.get());
+      resource_manager_->GetStartResource(appcontrol.get());
 
   bool do_reset = res->should_reset();
 
@@ -447,7 +419,7 @@ void WebApplication::ClearViewStack() {
   window_->SetContent(NULL);
   WebView* front = view_stack_.front();
   auto it = view_stack_.begin();
-  for ( ; it != view_stack_.end(); ++it) {
+  for (; it != view_stack_.end(); ++it) {
     if (*it != front) {
       (*it)->Suspend();
       delete *it;
@@ -467,7 +439,7 @@ void WebApplication::Resume() {
   }
 
   auto it = view_stack_.begin();
-  for ( ; it != view_stack_.end(); ++it) {
+  for (; it != view_stack_.end(); ++it) {
     (*it)->Resume();
   }
 }
@@ -483,7 +455,7 @@ void WebApplication::Suspend() {
   }
 
   auto it = view_stack_.begin();
-  for ( ; it != view_stack_.end(); ++it) {
+  for (; it != view_stack_.end(); ++it) {
     (*it)->Suspend();
   }
 }
@@ -505,9 +477,8 @@ void WebApplication::OnCreatedNewWebView(WebView* /*view*/, WebView* new_view) {
   window_->SetContent(new_view->evas_object());
 }
 
-void WebApplication::OnClosedWebView(WebView * view) {
-  if (view_stack_.size() == 0)
-    return;
+void WebApplication::OnClosedWebView(WebView* view) {
+  if (view_stack_.size() == 0) return;
 
   WebView* current = view_stack_.front();
   if (current == view) {
@@ -528,16 +499,15 @@ void WebApplication::OnClosedWebView(WebView * view) {
 
   // Delete after the callback context(for ewk view) was not used
   ecore_idler_add([](void* view) {
-      WebView* obj = static_cast<WebView*>(view);
-      delete obj;
-      return EINA_FALSE;
-    }, view);
+                    WebView* obj = static_cast<WebView*>(view);
+                    delete obj;
+                    return EINA_FALSE;
+                  },
+                  view);
 }
 
-void WebApplication::OnReceivedWrtMessage(
-    WebView* /*view*/,
-    Ewk_IPC_Wrt_Message_Data* msg) {
-
+void WebApplication::OnReceivedWrtMessage(WebView* /*view*/,
+                                          Ewk_IPC_Wrt_Message_Data* msg) {
   Eina_Stringshare* msg_id = ewk_ipc_wrt_message_data_id_get(msg);
   Eina_Stringshare* msg_ref_id = ewk_ipc_wrt_message_data_reference_id_get(msg);
   Eina_Stringshare* msg_type = ewk_ipc_wrt_message_data_type_get(msg);
@@ -548,7 +518,7 @@ void WebApplication::OnReceivedWrtMessage(
   LOGGER(DEBUG) << "RecvMsg: type = " << msg_type;
   LOGGER(DEBUG) << "RecvMsg: value = " << msg_value;
 
-  #define TYPE_IS(x) (!strcmp(msg_type, x))
+#define TYPE_IS(x) (!strcmp(msg_type, x))
   if (TYPE_IS("tizen://hide")) {
     // One Way Message
     window_->InActive();
@@ -586,8 +556,12 @@ void WebApplication::OnReceivedWrtMessage(
       LOGGER(ERROR) << "Failed to send response";
     }
     ewk_ipc_wrt_message_data_del(ans);
+  } else if (TYPE_IS("tizen://hide_splash_screen")) {
+    splash_screen_->HideSplashScreen(SplashScreen::HideReason::CUSTOM);
   }
-  #undef TYPE_IS
+
+
+#undef TYPE_IS
 
   eina_stringshare_del(msg_value);
   eina_stringshare_del(msg_type);
@@ -596,20 +570,19 @@ void WebApplication::OnReceivedWrtMessage(
 }
 
 void WebApplication::OnOrientationLock(
-    WebView* view,
-    bool lock,
+    WebView* view, bool lock,
     NativeWindow::ScreenOrientation preferred_rotation) {
-  if (view_stack_.size() == 0)
-    return;
+  if (view_stack_.size() == 0) return;
 
   // Only top-most view can set the orientation relate operation
-  if (view_stack_.front() != view)
-    return;
-
-  auto orientaion_setting = app_data_->setting_info() != NULL ?
-                            app_data_->setting_info()->screen_orientation() :
-                            // TODO(sngn.lee): check default value
-                            wgt::parse::SettingInfo::ScreenOrientation::AUTO;
+  if (view_stack_.front() != view) return;
+
+  auto orientaion_setting =
+      app_data_->setting_info() != NULL
+          ? app_data_->setting_info()->screen_orientation()
+          :
+          // TODO(sngn.lee): check default value
+          wgt::parse::SettingInfo::ScreenOrientation::AUTO;
   if (orientaion_setting != wgt::parse::SettingInfo::ScreenOrientation::AUTO) {
     return;
   }
@@ -622,9 +595,9 @@ void WebApplication::OnOrientationLock(
 }
 
 void WebApplication::OnHardwareKey(WebView* view, const std::string& keyname) {
-  bool enabled = app_data_->setting_info() != NULL ?
-                 app_data_->setting_info()->hwkey_enabled() :
-                 true;
+  bool enabled = app_data_->setting_info() != NULL
+                     ? app_data_->setting_info()->hwkey_enabled()
+                     : true;
   if (enabled && kKeyNameBack == keyname) {
     view->EvalJavascript(kBackKeyEventScript);
   } else if (enabled && kKeyNameMenu == keyname) {
@@ -636,7 +609,7 @@ void WebApplication::OnLanguageChanged() {
   locale_manager_->UpdateSystemLocale();
   ewk_context_cache_clear(ewk_context_);
   auto it = view_stack_.begin();
-  for ( ; it != view_stack_.end(); ++it) {
+  for (; it != view_stack_.end(); ++it) {
     (*it)->Reload();
   }
 }
@@ -649,14 +622,14 @@ void WebApplication::OnConsoleMessage(const std::string& msg, int level) {
     int dlog_level = DLOG_DEBUG;
     switch (level) {
       case EWK_CONSOLE_MESSAGE_LEVEL_WARNING:
-          dlog_level = DLOG_WARN;
-          break;
+        dlog_level = DLOG_WARN;
+        break;
       case EWK_CONSOLE_MESSAGE_LEVEL_ERROR:
-          dlog_level = DLOG_ERROR;
-          break;
+        dlog_level = DLOG_ERROR;
+        break;
       default:
-          dlog_level = DLOG_DEBUG;
-          break;
+        dlog_level = DLOG_DEBUG;
+        break;
     }
     LOGGER_RAW(dlog_level, kConsoleMessageLogTag) << msg;
   }
@@ -668,30 +641,33 @@ void WebApplication::OnLowMemory() {
 }
 
 bool WebApplication::OnContextMenuDisabled(WebView* /*view*/) {
-  return !(app_data_->setting_info() != NULL ?
-           app_data_->setting_info()->context_menu_enabled() :
-           true);
+  return !(app_data_->setting_info() != NULL
+               ? app_data_->setting_info()->context_menu_enabled()
+               : true);
 }
 
 void WebApplication::OnLoadStart(WebView* /*view*/) {
   LOGGER(DEBUG) << "LoadStart";
 }
+
 void WebApplication::OnLoadFinished(WebView* /*view*/) {
   LOGGER(DEBUG) << "LoadFinished";
+  splash_screen_->HideSplashScreen(SplashScreen::HideReason::LOADFINISHED);
 }
+
 void WebApplication::OnRendered(WebView* /*view*/) {
   STEP_PROFILE_END("URL Set -> Rendered");
   STEP_PROFILE_END("Start -> Launch Completed");
   LOGGER(DEBUG) << "Rendered";
+  splash_screen_->HideSplashScreen(SplashScreen::HideReason::RENDERED);
 }
 
 void WebApplication::LaunchInspector(common::AppControl* appcontrol) {
-  unsigned int port =
-    ewk_context_inspector_server_start(ewk_context_, 0);
+  unsigned int port = ewk_context_inspector_server_start(ewk_context_, 0);
   std::stringstream ss;
   ss << port;
   std::map<std::string, std::vector<std::string>> data;
-  data[kPortKey] = { ss.str() };
+  data[kPortKey] = {ss.str()};
   appcontrol->Reply(data);
 }
 
@@ -720,12 +696,11 @@ bool WebApplication::OnDidNavigation(WebView* /*view*/,
 }
 
 void WebApplication::OnNotificationPermissionRequest(
-    WebView*,
-    const std::string& url,
+    WebView*, const std::string& url,
     std::function<void(bool)> result_handler) {
   auto db = common::AppDB::GetInstance();
-  std::string reminder = db->Get(kDBPrivateSection,
-                                 kNotificationPermissionPrefix + url);
+  std::string reminder =
+      db->Get(kDBPrivateSection, kNotificationPermissionPrefix + url);
   if (reminder == "allowed") {
     result_handler(true);
     return;
@@ -748,25 +723,25 @@ void WebApplication::OnNotificationPermissionRequest(
   popup->SetBody(popup_string::kPopupBodyWebNotification);
   popup->SetCheckBox(popup_string::kPopupCheckRememberPreference);
   popup->SetResultHandler(
-    [db, result_handler, url](Popup* popup, void* /*user_data*/) {
-      bool result = popup->GetButtonResult();
-      bool remember = popup->GetCheckBoxResult();
-      if (remember) {
-        db->Set(kDBPrivateSection, kNotificationPermissionPrefix + url,
-                result ? "allowed" : "denied");
-      }
-      result_handler(result);
-    }, this);
+      [db, result_handler, url](Popup* popup, void* /*user_data*/) {
+        bool result = popup->GetButtonResult();
+        bool remember = popup->GetCheckBoxResult();
+        if (remember) {
+          db->Set(kDBPrivateSection, kNotificationPermissionPrefix + url,
+                  result ? "allowed" : "denied");
+        }
+        result_handler(result);
+      },
+      this);
   popup->Show();
 }
 
 void WebApplication::OnGeolocationPermissionRequest(
-    WebView*,
-    const std::string& url,
+    WebView*, const std::string& url,
     std::function<void(bool)> result_handler) {
   auto db = common::AppDB::GetInstance();
-  std::string reminder = db->Get(kDBPrivateSection,
-                                 kGeolocationPermissionPrefix + url);
+  std::string reminder =
+      db->Get(kDBPrivateSection, kGeolocationPermissionPrefix + url);
   if (reminder == "allowed") {
     result_handler(true);
     return;
@@ -793,26 +768,24 @@ void WebApplication::OnGeolocationPermissionRequest(
   popup->SetBody(popup_string::kPopupBodyGeoLocation);
   popup->SetCheckBox(popup_string::kPopupCheckRememberPreference);
   popup->SetResultHandler(
-    [db, result_handler, url](Popup* popup, void* /*user_data*/) {
-      bool result = popup->GetButtonResult();
-      bool remember = popup->GetCheckBoxResult();
-      if (remember) {
-        db->Set(kDBPrivateSection, kGeolocationPermissionPrefix + url,
-                result ? "allowed" : "denied");
-      }
-      result_handler(result);
-    }, this);
+      [db, result_handler, url](Popup* popup, void* /*user_data*/) {
+        bool result = popup->GetButtonResult();
+        bool remember = popup->GetCheckBoxResult();
+        if (remember) {
+          db->Set(kDBPrivateSection, kGeolocationPermissionPrefix + url,
+                  result ? "allowed" : "denied");
+        }
+        result_handler(result);
+      },
+      this);
   popup->Show();
 }
 
-
-void WebApplication::OnQuotaExceed(
-    WebView*,
-    const std::string& url,
-    std::function<void(bool)> result_handler) {
+void WebApplication::OnQuotaExceed(WebView*, const std::string& url,
+                                   std::function<void(bool)> result_handler) {
   auto db = common::AppDB::GetInstance();
-  std::string reminder = db->Get(kDBPrivateSection,
-                                 kQuotaPermissionPrefix + url);
+  std::string reminder =
+      db->Get(kDBPrivateSection, kQuotaPermissionPrefix + url);
   if (reminder == "allowed") {
     result_handler(true);
     return;
@@ -835,26 +808,23 @@ void WebApplication::OnQuotaExceed(
   popup->SetBody(popup_string::kPopupBodyWebStorage);
   popup->SetCheckBox(popup_string::kPopupCheckRememberPreference);
   popup->SetResultHandler(
-    [db, result_handler, url](Popup* popup, void* /*user_data*/) {
-      bool result = popup->GetButtonResult();
-      bool remember = popup->GetCheckBoxResult();
-      if (remember) {
-        db->Set(kDBPrivateSection, kQuotaPermissionPrefix + url,
-                result ? "allowed" : "denied");
-      }
-      result_handler(result);
-    }, this);
+      [db, result_handler, url](Popup* popup, void* /*user_data*/) {
+        bool result = popup->GetButtonResult();
+        bool remember = popup->GetCheckBoxResult();
+        if (remember) {
+          db->Set(kDBPrivateSection, kQuotaPermissionPrefix + url,
+                  result ? "allowed" : "denied");
+        }
+        result_handler(result);
+      },
+      this);
   popup->Show();
 }
 
 void WebApplication::OnAuthenticationRequest(
-      WebView*,
-      const std::string& /*url*/,
-      const std::string& /*message*/,
-      std::function<void(bool submit,
-                         const std::string& id,
-                         const std::string& password)
-                   > result_handler) {
+    WebView*, const std::string& /*url*/, const std::string& /*message*/,
+    std::function<void(bool submit, const std::string& id,
+                       const std::string& password)> result_handler) {
   Popup* popup = Popup::CreatePopup(window_);
   popup->SetButtonType(Popup::ButtonType::LoginCancelButton);
   popup->SetFirstEntry(popup_string::kPopupLabelAuthusername,
@@ -863,24 +833,22 @@ void WebApplication::OnAuthenticationRequest(
                         Popup::EntryType::PwEdit);
   popup->SetTitle(popup_string::kPopupTitleAuthRequest);
   popup->SetBody(popup_string::kPopupBodyAuthRequest);
-  popup->SetResultHandler(
-    [result_handler](Popup* popup, void* /*user_data*/) {
-      bool result = popup->GetButtonResult();
-      std::string id = popup->GetFirstEntryResult();
-      std::string passwd = popup->GetSecondEntryResult();
-      result_handler(result, id, passwd);
-    }, this);
+  popup->SetResultHandler([result_handler](Popup* popup, void* /*user_data*/) {
+                            bool result = popup->GetButtonResult();
+                            std::string id = popup->GetFirstEntryResult();
+                            std::string passwd = popup->GetSecondEntryResult();
+                            result_handler(result, id, passwd);
+                          },
+                          this);
   popup->Show();
 }
 
 void WebApplication::OnCertificateAllowRequest(
-      WebView*,
-      const std::string& /*url*/,
-      const std::string& pem,
-      std::function<void(bool allow)> result_handler) {
+    WebView*, const std::string& /*url*/, const std::string& pem,
+    std::function<void(bool allow)> result_handler) {
   auto db = common::AppDB::GetInstance();
-  std::string reminder = db->Get(kDBPrivateSection,
-                                 kCertificateAllowPrefix + pem);
+  std::string reminder =
+      db->Get(kDBPrivateSection, kCertificateAllowPrefix + pem);
   if (reminder == "allowed") {
     result_handler(true);
     return;
@@ -895,25 +863,25 @@ void WebApplication::OnCertificateAllowRequest(
   popup->SetBody(popup_string::kPopupBodyCert);
   popup->SetCheckBox(popup_string::kPopupCheckRememberPreference);
   popup->SetResultHandler(
-    [db, result_handler, pem](Popup* popup, void* /*user_data*/) {
-      bool result = popup->GetButtonResult();
-      bool remember = popup->GetCheckBoxResult();
-      if (remember) {
-        db->Set(kDBPrivateSection, kCertificateAllowPrefix + pem,
-                result ? "allowed" : "denied");
-      }
-      result_handler(result);
-    }, this);
+      [db, result_handler, pem](Popup* popup, void* /*user_data*/) {
+        bool result = popup->GetButtonResult();
+        bool remember = popup->GetCheckBoxResult();
+        if (remember) {
+          db->Set(kDBPrivateSection, kCertificateAllowPrefix + pem,
+                  result ? "allowed" : "denied");
+        }
+        result_handler(result);
+      },
+      this);
   popup->Show();
 }
 
 void WebApplication::OnUsermediaPermissionRequest(
-      WebView*,
-      const std::string& url,
-      std::function<void(bool)> result_handler) {
+    WebView*, const std::string& url,
+    std::function<void(bool)> result_handler) {
   auto db = common::AppDB::GetInstance();
-  std::string reminder = db->Get(kDBPrivateSection,
-                                 kUsermediaPermissionPrefix + url);
+  std::string reminder =
+      db->Get(kDBPrivateSection, kUsermediaPermissionPrefix + url);
   if (reminder == "allowed") {
     result_handler(true);
     return;
@@ -940,15 +908,16 @@ void WebApplication::OnUsermediaPermissionRequest(
   popup->SetBody(popup_string::kPopupBodyUserMedia);
   popup->SetCheckBox(popup_string::kPopupCheckRememberPreference);
   popup->SetResultHandler(
-    [db, result_handler, url](Popup* popup, void* /*user_data*/) {
-      bool result = popup->GetButtonResult();
-      bool remember = popup->GetCheckBoxResult();
-      if (remember) {
-        db->Set(kDBPrivateSection, kUsermediaPermissionPrefix + url,
-                result ? "allowed" : "denied");
-      }
-      result_handler(result);
-    }, this);
+      [db, result_handler, url](Popup* popup, void* /*user_data*/) {
+        bool result = popup->GetButtonResult();
+        bool remember = popup->GetCheckBoxResult();
+        if (remember) {
+          db->Set(kDBPrivateSection, kUsermediaPermissionPrefix + url,
+                  result ? "allowed" : "denied");
+        }
+        result_handler(result);
+      },
+      this);
   popup->Show();
 }
 
index 2997f74..36caeaa 100644 (file)
@@ -35,6 +35,7 @@ class ResourceManager;
 
 namespace runtime {
 class NativeWindow;
+class SplashScreen;
 
 class WebApplication : public WebView::EventListener {
  public:
@@ -49,18 +50,17 @@ class WebApplication : public WebView::EventListener {
   void Terminate();
 
   std::string data_path() const { return app_data_path_; }
-  void set_terminator(std::function<void(void)> terminator)
-      { terminator_ = terminator; }
+  void set_terminator(std::function<void(void)> terminator) {
+    terminator_ = terminator;
+  }
   bool launched() const { return launched_; }
 
   virtual void OnCreatedNewWebView(WebView* view, WebView* new_view);
-  virtual void OnClosedWebView(WebView * view);
-  virtual void OnReceivedWrtMessage(
-      WebView* view,
-      Ewk_IPC_Wrt_Message_Data* msg);
+  virtual void OnClosedWebView(WebView* view);
+  virtual void OnReceivedWrtMessage(WebView* view,
+                                    Ewk_IPC_Wrt_Message_Data* msg);
   virtual void OnOrientationLock(
-      WebView* view,
-      bool lock,
+      WebView* view, bool lock,
       NativeWindow::ScreenOrientation preferred_rotation);
   virtual void OnHardwareKey(WebView* view, const std::string& keyname);
   virtual void OnConsoleMessage(const std::string& msg, int level);
@@ -72,33 +72,22 @@ class WebApplication : public WebView::EventListener {
   virtual bool OnContextMenuDisabled(WebView* view);
   virtual bool OnDidNavigation(WebView* view, const std::string& url);
   virtual void OnNotificationPermissionRequest(
-      WebView* view,
-      const std::string& url,
+      WebView* view, const std::string& url,
       std::function<void(bool)> result_handler);
   virtual void OnGeolocationPermissionRequest(
-      WebView* view,
-      const std::string& url,
-      std::function<void(bool)> result_handler);
-  virtual void OnQuotaExceed(
-      WebView* view,
-      const std::string& url,
+      WebView* view, const std::string& url,
       std::function<void(bool)> result_handler);
+  virtual void OnQuotaExceed(WebView* view, const std::string& url,
+                             std::function<void(bool)> result_handler);
   virtual void OnAuthenticationRequest(
-      WebView* view,
-      const std::string& url,
-      const std::string& message,
-      std::function<void(bool submit,
-                         const std::string& id,
-                         const std::string& password)
-                   > result_handler);
+      WebView* view, const std::string& url, const std::string& message,
+      std::function<void(bool submit, const std::string& id,
+                         const std::string& password)> result_handler);
   virtual void OnCertificateAllowRequest(
-      WebView* view,
-      const std::string& url,
-      const std::string& pem,
+      WebView* view, const std::string& url, const std::string& pem,
       std::function<void(bool allow)> result_handler);
   virtual void OnUsermediaPermissionRequest(
-      WebView* view,
-      const std::string& url,
+      WebView* view, const std::string& url,
       std::function<void(bool)> result_handler);
 
  private:
@@ -116,6 +105,7 @@ class WebApplication : public WebView::EventListener {
   std::string appid_;
   std::string app_data_path_;
   std::list<WebView*> view_stack_;
+  std::unique_ptr<SplashScreen> splash_screen_;
   std::unique_ptr<common::LocaleManager> locale_manager_;
   std::unique_ptr<common::ApplicationData> app_data_;
   std::unique_ptr<common::ResourceManager> resource_manager_;
index b1edcd8..9c64060 100644 (file)
@@ -28,6 +28,8 @@
         'browser/web_view_impl.cc',
         'browser/popup.h',
         'browser/popup.cc',
+        'browser/splash_screen.h',
+        'browser/splash_screen.cc',
         'browser/popup_string.h',
         'browser/popup_string.cc',
         'browser/vibration_manager.h',
@@ -47,6 +49,8 @@
           'efl-extension',
           'elementary',
           'deviced',
+          'manifest-parser',
+          'manifest-handlers',
           'notification',
         ],
       },