Show window early for hosted web application 89/181989/3
authorPrathmesh <prathmesh.m@samsung.com>
Tue, 19 Jun 2018 11:02:52 +0000 (16:32 +0530)
committerjaekuk lee <juku1999@samsung.com>
Wed, 20 Jun 2018 23:39:51 +0000 (23:39 +0000)
- If the window is not shown and the url is http or https
  (hosted web application), then show on load start
- Currently the window is shown when content is ready, but
  for hosted app the contents need to downloaded. So there
  will be some delay in showing window
- If the app is hosted, then show window on load start

Change-Id: I77948215a9bd501c43ff258a440c3d386c6f4389
Signed-off-by: Prathmesh <prathmesh.m@samsung.com>
atom/browser/api/atom_api_web_contents.cc
atom/browser/native_window_efl.cc
atom/browser/native_window_efl.h

index d81d2cb..a784f77 100644 (file)
@@ -742,6 +742,14 @@ void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
 }
 
 void WebContents::DidStartLoading() {
+#if defined(OS_TIZEN)
+  if (!owner_window()->IsVisible()) {
+    std::string scheme = web_contents()->GetURL().scheme();
+    if (std::string::npos != scheme.find("http")) {
+      owner_window()->Show();
+    }
+  }
+#endif
   Emit("did-start-loading");
 }
 
index 2f214b7..bcbe509 100644 (file)
@@ -112,7 +112,7 @@ NativeWindowEfl::NativeWindowEfl(
 #if defined(OS_TIZEN_TV_PRODUCT)
   CreateMouseCursor(box);
 #endif
-
+  visibilityStatus_ = false;
 }
 
 NativeWindowEfl::~NativeWindowEfl() {
@@ -122,6 +122,7 @@ NativeWindowEfl::~NativeWindowEfl() {
   eext_object_event_callback_del(web_view_, EEXT_CALLBACK_MORE,
       &HWBackKeyCallback);
 #endif
+  visibilityStatus_ = false;
 }
 
 #if defined(OS_TIZEN_TV_PRODUCT)
@@ -156,6 +157,7 @@ void NativeWindowEfl::Close() {
     evas_object_del(window_);
   window_ = nullptr;
 
+  visibilityStatus_ = false;
   CloseContents(web_contents());
 }
 
@@ -163,6 +165,8 @@ void NativeWindowEfl::CloseImmediately() {
   if(window_)
     evas_object_del(window_);
   window_ = nullptr;
+
+  visibilityStatus_ = false;
   NotifyWindowClosed();
 }
 
@@ -179,6 +183,7 @@ void NativeWindowEfl::Show() {
     LOG(ERROR) << "There's no available window or webview.";
   evas_object_show(window_);
   evas_object_show(web_view_);
+  visibilityStatus_ = true;
 }
 
 void NativeWindowEfl::ShowInactive() {
@@ -188,11 +193,11 @@ void NativeWindowEfl::ShowInactive() {
 void NativeWindowEfl::Hide() {
   evas_object_hide(web_view_);
   evas_object_hide(window_);
+  visibilityStatus_ = false;
 }
 
 bool NativeWindowEfl::IsVisible() {
-  NOTIMPLEMENTED();
-  return true;
+  return visibilityStatus_;
 }
 
 bool NativeWindowEfl::IsEnabled() {
index fc04293..b7f4024 100644 (file)
@@ -112,6 +112,7 @@ class NativeWindowEfl : public NativeWindow {
 
   std::string title_;
   bool fullscreenable_;
+  bool visibilityStatus_;
 
   DISALLOW_COPY_AND_ASSIGN(NativeWindowEfl);
 };