if (atom::WindowList::IsEmpty())
NotifyAndShutdown();
- else
+ else {
+#if defined(OS_TIZEN)
+ tizen::TizenBrowserParts::Quit();
+#endif
atom::WindowList::CloseAllWindows();
+ }
}
void Browser::Exit(mate::Arguments* args) {
static Browser* Get();
// Try to close all windows and quit the application.
+#if defined(OS_TIZEN)
+ void Quit() override;
+#else
void Quit();
+#endif
// Exit the application immediately and set exit code.
void Exit(mate::Arguments* args);
#include "base/command_line.h"
#include "content/public/browser/web_contents.h"
#include "efl/window_factory.h"
+#include "tizen/browser/tizen_web_contents_view.h"
#include "tizen/common/application_data.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
}
Evas_Object* NativeWindowEfl::GetHostWindowDelegate(const content::WebContents* web_contents) {
- LOG(ERROR) << "NativeWindowEfl::GetHostWindowDelegate";
- return atom::AtomBrowserClient::GetTizenWebContentsView(web_contents)->evas_object();
+ auto web_contents_view = atom::AtomBrowserClient::GetTizenWebContentsView(web_contents);
+ if (!web_contents_view) {
+ LOG(ERROR) << "TizenWebContentsView should not be NULL; Exiting";
+ exit(0);
+ }
+ return web_contents_view->evas_object();
}
NativeWindowEfl::NativeWindowEfl(
const mate::Dictionary& options,
NativeWindow* parent)
: NativeWindow(inspectable_web_contents, options, parent),
+ web_contents_view_(atom::AtomBrowserClient::GetTizenWebContentsView(web_contents())),
fullscreenable_(true) {
options.Get(options::kTitle, &title_);
- window_ = efl::WindowFactory::GetHostWindow(web_contents());
+ DCHECK(web_contents_view_);
+
+ window_ = web_contents_view_->evas_object();
DCHECK(window_);
LOG(ERROR) << "There's no available window or webview.";
evas_object_show(window_);
evas_object_show(web_view_);
+ web_contents_view_->SetVisibility(true);
visibilityStatus_ = true;
}
void NativeWindowEfl::Hide() {
evas_object_hide(web_view_);
evas_object_hide(window_);
+ web_contents_view_->SetVisibility(false);
visibilityStatus_ = false;
}
#include <vector>
namespace content {
-
class WebContents;
-
} // namespace content
+namespace tizen {
+class TizenWebContentsView;
+} // namespace tizen
+
namespace atom {
class NativeWindowEfl : public NativeWindow {
Evas_Object* window_;
Evas_Object* web_view_;
+ tizen::TizenWebContentsView* web_contents_view_;
std::string title_;
bool fullscreenable_;
namespace atom {
+bool is_closing_ = false;
+
// static
base::LazyInstance<base::ObserverList<WindowListObserver>>::Leaky
WindowList::observers_ = LAZY_INSTANCE_INITIALIZER;
WindowVector& windows = GetInstance()->windows_;
windows.erase(std::remove(windows.begin(), windows.end(), window),
windows.end());
- if (GetLastWindow())
+ if (!is_closing_ && GetLastWindow())
GetLastWindow()->Show();
for (WindowListObserver& observer : observers_.Get())
observer.OnWindowRemoved(window);
// static
void WindowList::CloseAllWindows() {
+ is_closing_ = true;
WindowVector windows = GetInstance()->windows_;
for (const auto& window : windows)
if (!window->IsClosed())
// static
void WindowList::DestroyAllWindows() {
+ is_closing_ = true;
WindowVector windows = GetInstance()->windows_;
for (const auto& window : windows)
window->CloseContents(nullptr); // e.g. Destroy()
// Function is same as suspend. This will be called from app lifecycle suspend
void TizenBrowserParts::Suspend() {
+ atom::NativeWindow *last_window = atom::WindowList::GetLastWindow();
+ if (!last_window)
+ return;
+ last_window->Hide();
+
// If application is having background catagory enabled then do not suspend the app
if (app_data_->setting_info() != NULL && app_data_->setting_info()->background_support_enabled()) {
return;
}
- atom::NativeWindow *last_window = atom::WindowList::GetLastWindow();
- if (!last_window)
- return;
-
last_window->NotifySuspend();
auto rvh = last_window->web_contents()->GetRenderViewHost();
SuspendRVH(rvh);
// Function is same as resume. This will be called from app lifecycle resume
void TizenBrowserParts::Resume() {
+ atom::NativeWindow *last_window = atom::WindowList::GetLastWindow();
+ if (!last_window)
+ return;
+ last_window->Show();
+
// If application is having background catagory enabled then do not resume the app
// as its has not suspend
if (app_data_->setting_info() != NULL && app_data_->setting_info()->background_support_enabled()) {
return;
}
- atom::NativeWindow *last_window = atom::WindowList::GetLastWindow();
- if (!last_window)
- return;
last_window->NotifyResume();
auto rvh = last_window->web_contents()->GetRenderViewHost();
tizen::NativeWebRuntime::GetInstance().StartApplication();
}
+void TizenBrowserParts::Quit() {
+ atom::WindowList::GetLastWindow()->Hide();
+}
} // namespace tizen
CookieManager* GetCookieManager() { return cookie_manager_; }
protected:
+ virtual void Quit();
+
std::unique_ptr<common::LocaleManager> locale_manager_;
std::unique_ptr<common::ResourceManager> resource_manager_;
virtual ~TizenBrowserParts();
elm_win_resize_object_add(window, evas_object_);
}
+void TizenWebContentsView::SetVisibility(bool state) {
+ if (!rwhv())
+ return;
+
+ rwhv()->SetPageVisibility(state);
+}
+
+content::RenderWidgetHostViewEfl* TizenWebContentsView::rwhv() const {
+ return static_cast<content::RenderWidgetHostViewEfl*>(
+ web_contents_->GetRenderWidgetHostView());
+}
+
} // namespace tizen
#include <Evas.h>
+#include "content/browser/renderer_host/render_widget_host_view_efl.h"
#include "content/public/common/context_menu_params.h"
#include "content/public/browser/web_contents.h"
#include "ui/gfx/geometry/rect.h"
+namespace content {
+class RenderWidgetHostViewEfl;
+}
+
namespace tizen {
class TizenWebContentsView {
void HandleLongPressGesture(const content::ContextMenuParams&) {}
void ShowContextMenu(const content::ContextMenuParams&) {}
void OnSelectionRectReceived(const gfx::Rect& selection_rect) const {}
+ void SetVisibility(bool state);
Evas_Object* evas_object() { return evas_object_; }
private:
+ content::RenderWidgetHostViewEfl* rwhv() const;
content::WebContents* web_contents_;
Evas_Object* evas_object_;
};