From 16b5d8ccddca0d91fe308eb1a803b9cb41fafc2f Mon Sep 17 00:00:00 2001 From: Prathmesh Date: Tue, 19 Jun 2018 16:32:52 +0530 Subject: [PATCH] Show window early for hosted web application - 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 --- atom/browser/api/atom_api_web_contents.cc | 8 ++++++++ atom/browser/native_window_efl.cc | 11 ++++++++--- atom/browser/native_window_efl.h | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index d81d2cb..a784f77 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -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"); } diff --git a/atom/browser/native_window_efl.cc b/atom/browser/native_window_efl.cc index 2f214b7..bcbe509 100644 --- a/atom/browser/native_window_efl.cc +++ b/atom/browser/native_window_efl.cc @@ -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() { diff --git a/atom/browser/native_window_efl.h b/atom/browser/native_window_efl.h index fc04293..b7f4024 100644 --- a/atom/browser/native_window_efl.h +++ b/atom/browser/native_window_efl.h @@ -112,6 +112,7 @@ class NativeWindowEfl : public NativeWindow { std::string title_; bool fullscreenable_; + bool visibilityStatus_; DISALLOW_COPY_AND_ASSIGN(NativeWindowEfl); }; -- 2.7.4