#include "atom/browser/api/atom_api_window.h"
#include "atom/common/native_mate_converters/value_converter.h"
+#include "atom/browser/api/atom_api_browser_view.h"
#include "atom/browser/api/atom_api_menu.h"
#include "atom/browser/api/atom_api_web_contents.h"
#include "atom/browser/browser.h"
#include "content/public/common/content_switches.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
+#include "tizen/common/env_variables.h"
#include "ui/gfx/geometry/rect.h"
#if defined(TOOLKIT_VIEWS)
void Window::WillDestroyNativeObject() {
// Close all child windows before closing current window.
- v8::Locker locker(isolate());
+ if (!::tizen::is_single_process)
+ v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
for (v8::Local<v8::Value> value : child_windows_.Values(isolate())) {
mate::Handle<Window> child;
FROM_HERE, GetDestroyClosure());
}
+void Window::OnWindowEndSession() {
+ Emit("session-end");
+}
+
void Window::OnWindowBlur() {
Emit("blur");
}
Emit("swipe", direction);
}
+void Window::OnWindowSheetBegin() {
+ Emit("sheet-begin");
+}
+
+void Window::OnWindowSheetEnd() {
+ Emit("sheet-end");
+}
+
void Window::OnWindowEnterHtmlFullScreen() {
Emit("enter-html-full-screen");
}
}
#endif
+#if defined(OS_TIZEN)
+void Window::OnSuspend() {
+ Emit("app-on-suspend");
+}
+
+void Window::OnResume() {
+ Emit("app-on-resume");
+}
+
+void Window::OnAppControl() {
+ Emit("app-on-appcontrol");
+}
+#endif
+
// static
mate::WrappableBase* Window::New(mate::Arguments* args) {
if (!Browser::Get()->is_ready()) {
return child_windows_.Values(isolate());
}
+v8::Local<v8::Value> Window::GetBrowserView() const {
+ if (browser_view_.IsEmpty()) {
+ return v8::Null(isolate());
+ }
+
+ return v8::Local<v8::Value>::New(isolate(), browser_view_);
+}
+
+void Window::SetBrowserView(v8::Local<v8::Value> value) {
+ mate::Handle<BrowserView> browser_view;
+ if (value->IsNull()) {
+ window_->SetBrowserView(nullptr);
+ browser_view_.Reset();
+ } else if (mate::ConvertFromV8(isolate(), value, &browser_view)) {
+ window_->SetBrowserView(browser_view->view());
+ browser_view_.Reset(isolate(), value);
+ }
+}
+
bool Window::IsModal() const {
return window_->is_modal();
}
window_->RefreshTouchBarItem(item_id);
}
+void Window::SetEscapeTouchBarItem(const mate::PersistentDictionary& item) {
+ window_->SetEscapeTouchBarItem(item);
+}
+
int32_t Window::ID() const {
return weak_map_id();
}
v8::Local<v8::Value> Window::WebContents(v8::Isolate* isolate) {
- if (web_contents_.IsEmpty())
+ if (web_contents_.IsEmpty()) {
return v8::Null(isolate);
- else
- return v8::Local<v8::Value>::New(isolate, web_contents_);
+ }
+
+ return v8::Local<v8::Value>::New(isolate, web_contents_);
}
void Window::RemoveFromParentChildWindows() {
#endif
.SetMethod("getParentWindow", &Window::GetParentWindow)
.SetMethod("getChildWindows", &Window::GetChildWindows)
+ .SetMethod("getBrowserView", &Window::GetBrowserView)
+ .SetMethod("setBrowserView", &Window::SetBrowserView)
.SetMethod("isModal", &Window::IsModal)
.SetMethod("getNativeWindowHandle", &Window::GetNativeWindowHandle)
.SetMethod("getBounds", &Window::GetBounds)
.SetMethod("setVibrancy", &Window::SetVibrancy)
.SetMethod("_setTouchBarItems", &Window::SetTouchBar)
.SetMethod("_refreshTouchBarItem", &Window::RefreshTouchBarItem)
+ .SetMethod("_setEscapeTouchBarItem", &Window::SetEscapeTouchBarItem)
#if defined(OS_WIN)
.SetMethod("hookWindowMessage", &Window::HookWindowMessage)
.SetMethod("isWindowMessageHooked", &Window::IsWindowMessageHooked)