}
#endif
-#if defined(OS_MACOSX) || defined(OS_LINUX)
void Window::SetVisibleOnAllWorkspaces(bool visible) {
return window_->SetVisibleOnAllWorkspaces(visible);
}
bool Window::IsVisibleOnAllWorkspaces() {
return window_->IsVisibleOnAllWorkspaces();
}
-#endif
mate::Handle<WebContents> Window::GetWebContents(v8::Isolate* isolate) const {
return WebContents::CreateFrom(isolate, window_->GetWebContents());
.SetMethod("isMenuBarAutoHide", &Window::IsMenuBarAutoHide)
.SetMethod("setMenuBarVisibility", &Window::SetMenuBarVisibility)
.SetMethod("isMenuBarVisible", &Window::IsMenuBarVisible)
-#if defined(OS_MACOSX) || defined(OS_LINUX)
.SetMethod("setVisibleOnAllWorkspaces",
&Window::SetVisibleOnAllWorkspaces)
.SetMethod("isVisibleOnAllWorkspaces",
&Window::IsVisibleOnAllWorkspaces)
-#endif
#if defined(OS_MACOSX)
.SetMethod("showDefinitionForSelection",
&Window::ShowDefinitionForSelection)
void ShowDefinitionForSelection();
#endif
-#if defined(OS_MACOSX) || defined(OS_LINUX)
void SetVisibleOnAllWorkspaces(bool visible);
bool IsVisibleOnAllWorkspaces();
-#endif
// APIs for WebContents.
mate::Handle<WebContents> GetWebContents(v8::Isolate* isolate) const;
return true;
}
-void NativeWindow::SetVisibleOnAllWorkspaces(bool visible) {
-}
-
-bool NativeWindow::IsVisibleOnAllWorkspaces() {
- return false;
-}
-
bool NativeWindow::HasModalDialog() {
return has_dialog_attached_;
}
virtual void SetProgressBar(double progress) = 0;
virtual void SetOverlayIcon(const gfx::Image& overlay,
const std::string& description) = 0;
+ virtual void SetVisibleOnAllWorkspaces(bool visible) = 0;
+ virtual bool IsVisibleOnAllWorkspaces() = 0;
virtual bool IsClosed() const { return is_closed_; }
virtual void OpenDevTools();
virtual void SetMenuBarVisibility(bool visible);
virtual bool IsMenuBarVisible();
- // Visible on all workspaces.
- virtual void SetVisibleOnAllWorkspaces(bool visible);
- virtual bool IsVisibleOnAllWorkspaces();
-
// The same with closing a tab in a real browser.
//
// Should be called by platform code when user want to close the window.
bool is_kiosk_;
- bool is_visible_on_all_workspaces_;
-
NSInteger attention_request_id_; // identifier from requestUserAttention
// The presentation options before entering kiosk mode.
const mate::Dictionary& options)
: NativeWindow(web_contents, options),
is_kiosk_(false),
- is_visible_on_all_workspaces_(false),
attention_request_id_(0) {
int width = 800, height = 600;
options.Get(switches::kWidth, &width);
void NativeWindowMac::SetVisibleOnAllWorkspaces(bool visible) {
NSUInteger collectionBehavior = [window_ collectionBehavior];
- is_visible_on_all_workspaces_ = visible;
if (visible) {
collectionBehavior |= NSWindowCollectionBehaviorCanJoinAllSpaces;
} else {
}
bool NativeWindowMac::IsVisibleOnAllWorkspaces() {
- return is_visible_on_all_workspaces_;
+ NSUInteger collectionBehavior = [window_ collectionBehavior];
+ return collectionBehavior & NSWindowCollectionBehaviorCanJoinAllSpaces;
}
bool NativeWindowMac::IsWithinDraggableRegion(NSPoint point) const {
menu_bar_autohide_(false),
menu_bar_visible_(false),
menu_bar_alt_pressed_(false),
-#if defined(OS_LINUX)
- is_visible_on_all_workspaces_(false),
-#endif
#if defined(OS_WIN)
is_minimized_(false),
#endif
}
void NativeWindowViews::SetVisibleOnAllWorkspaces(bool visible) {
- is_visible_on_all_workspaces_ = visible;
window_->SetVisibleOnAllWorkspaces(visible);
}
bool NativeWindowViews::IsVisibleOnAllWorkspaces() {
- return is_visible_on_all_workspaces_;
+#if defined(USE_X11)
+ // Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to
+ // determine whether the current window is visible on all workspaces.
+ XAtom sticky_atom = gfx::GetAtom("_NET_WM_STATE_STICKY");
+ std::vector<XAtom> atom_properties;
+ gfx::GetAtomArrayProperty(GetNativeWindow(), "_NET_WM_STATE", &atom_properties);
+ return std::find(atom_properties.begin(),
+ atom_properties.end(), sticky_atom) != atom_properties.end();
+#endif
+ return false;
}
gfx::AcceleratedWidget NativeWindowViews::GetAcceleratedWidget() {
bool IsMenuBarAutoHide() override;
void SetMenuBarVisibility(bool visible) override;
bool IsMenuBarVisible() override;
-
-#if defined(OS_LINUX)
void SetVisibleOnAllWorkspaces(bool visible) override;
bool IsVisibleOnAllWorkspaces() override;
-#endif
gfx::AcceleratedWidget GetAcceleratedWidget();
bool menu_bar_visible_;
bool menu_bar_alt_pressed_;
-#if defined(OS_LINUX)
- bool is_visible_on_all_workspaces_;
-#endif
-
#if defined(USE_X11)
scoped_ptr<GlobalMenuBarX11> global_menu_bar_;
Sets whether the window should be visible on all workspaces.
-**Note:** This API is only available on Mac/Linux.
+**Note:** This API does nothing on Windows.
### BrowserWindow.isVisibleOnAllWorkspaces()
Returns whether the window is visible on all workspaces.
-**Note:** This API is only available on Mac/Linux.
+**Note:** This API always return false on Windows.
## Class: WebContents