gtk: Add BrowserWindow.setSkipTaskbar API.

This commit is contained in:
Cheng Zhao 2014-06-16 10:29:51 +08:00
parent a8cb839734
commit 70d3365414
12 changed files with 29 additions and 0 deletions

View file

@ -259,6 +259,10 @@ void Window::FlashFrame(bool flash) {
window_->FlashFrame(flash); window_->FlashFrame(flash);
} }
void Window::SetSkipTaskbar(bool skip) {
window_->SetSkipTaskbar(skip);
}
void Window::SetKiosk(bool kiosk) { void Window::SetKiosk(bool kiosk) {
window_->SetKiosk(kiosk); window_->SetKiosk(kiosk);
} }
@ -366,6 +370,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setTitle", &Window::SetTitle) .SetMethod("setTitle", &Window::SetTitle)
.SetMethod("getTitle", &Window::GetTitle) .SetMethod("getTitle", &Window::GetTitle)
.SetMethod("flashFrame", &Window::FlashFrame) .SetMethod("flashFrame", &Window::FlashFrame)
.SetMethod("setSkipTaskbar", &Window::SetSkipTaskbar)
.SetMethod("setKiosk", &Window::SetKiosk) .SetMethod("setKiosk", &Window::SetKiosk)
.SetMethod("isKiosk", &Window::IsKiosk) .SetMethod("isKiosk", &Window::IsKiosk)
.SetMethod("setRepresentedFilename", &Window::SetRepresentedFilename) .SetMethod("setRepresentedFilename", &Window::SetRepresentedFilename)

View file

@ -90,6 +90,7 @@ class Window : public mate::EventEmitter,
void SetTitle(const std::string& title); void SetTitle(const std::string& title);
std::string GetTitle(); std::string GetTitle();
void FlashFrame(bool flash); void FlashFrame(bool flash);
void SetSkipTaskbar(bool skip);
void SetKiosk(bool kiosk); void SetKiosk(bool kiosk);
bool IsKiosk(); bool IsKiosk();
void OpenDevTools(); void OpenDevTools();

View file

@ -176,6 +176,10 @@ void NativeWindow::InitFromOptions(base::DictionaryValue* options) {
if (options->GetBoolean(switches::kFullscreen, &fullscreen) && fullscreen) { if (options->GetBoolean(switches::kFullscreen, &fullscreen) && fullscreen) {
SetFullscreen(true); SetFullscreen(true);
} }
bool skip;
if (options->GetBoolean(switches::kSkipTaskbar, &skip) && skip) {
SetSkipTaskbar(skip);
}
bool kiosk; bool kiosk;
if (options->GetBoolean(switches::kKiosk, &kiosk) && kiosk) { if (options->GetBoolean(switches::kKiosk, &kiosk) && kiosk) {
SetKiosk(kiosk); SetKiosk(kiosk);

View file

@ -127,6 +127,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
virtual void SetTitle(const std::string& title) = 0; virtual void SetTitle(const std::string& title) = 0;
virtual std::string GetTitle() = 0; virtual std::string GetTitle() = 0;
virtual void FlashFrame(bool flash) = 0; virtual void FlashFrame(bool flash) = 0;
virtual void SetSkipTaskbar(bool skip) = 0;
virtual void SetKiosk(bool kiosk) = 0; virtual void SetKiosk(bool kiosk) = 0;
virtual bool IsKiosk() = 0; virtual bool IsKiosk() = 0;
virtual void SetRepresentedFilename(const std::string& filename); virtual void SetRepresentedFilename(const std::string& filename);

View file

@ -366,6 +366,11 @@ void NativeWindowGtk::FlashFrame(bool flash) {
gtk_window_set_urgency_hint(window_, flash); gtk_window_set_urgency_hint(window_, flash);
} }
void NativeWindowGtk::SetSkipTaskbar(bool skip) {
gtk_window_set_skip_taskbar_hint(window_, skip);
gtk_window_set_skip_pager_hint(window_, skip);
}
void NativeWindowGtk::SetKiosk(bool kiosk) { void NativeWindowGtk::SetKiosk(bool kiosk) {
SetFullscreen(kiosk); SetFullscreen(kiosk);
} }

View file

@ -62,6 +62,7 @@ class NativeWindowGtk : public NativeWindow,
virtual void SetTitle(const std::string& title) OVERRIDE; virtual void SetTitle(const std::string& title) OVERRIDE;
virtual std::string GetTitle() OVERRIDE; virtual std::string GetTitle() OVERRIDE;
virtual void FlashFrame(bool flash) OVERRIDE; virtual void FlashFrame(bool flash) OVERRIDE;
virtual void SetSkipTaskbar(bool skip) OVERRIDE;
virtual void SetKiosk(bool kiosk) OVERRIDE; virtual void SetKiosk(bool kiosk) OVERRIDE;
virtual bool IsKiosk() OVERRIDE; virtual bool IsKiosk() OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;

View file

@ -54,6 +54,7 @@ class NativeWindowMac : public NativeWindow {
virtual void SetTitle(const std::string& title) OVERRIDE; virtual void SetTitle(const std::string& title) OVERRIDE;
virtual std::string GetTitle() OVERRIDE; virtual std::string GetTitle() OVERRIDE;
virtual void FlashFrame(bool flash) OVERRIDE; virtual void FlashFrame(bool flash) OVERRIDE;
virtual void SetSkipTaskbar(bool skip) OVERRIDE;
virtual void SetKiosk(bool kiosk) OVERRIDE; virtual void SetKiosk(bool kiosk) OVERRIDE;
virtual bool IsKiosk() OVERRIDE; virtual bool IsKiosk() OVERRIDE;
virtual void SetRepresentedFilename(const std::string& filename) OVERRIDE; virtual void SetRepresentedFilename(const std::string& filename) OVERRIDE;

View file

@ -416,6 +416,9 @@ void NativeWindowMac::FlashFrame(bool flash) {
} }
} }
void NativeWindowMac::SetSkipTaskbar(bool skip) {
}
void NativeWindowMac::SetKiosk(bool kiosk) { void NativeWindowMac::SetKiosk(bool kiosk) {
if (kiosk && !is_kiosk_) { if (kiosk && !is_kiosk_) {
kiosk_options_ = [NSApp currentSystemPresentationOptions]; kiosk_options_ = [NSApp currentSystemPresentationOptions];

View file

@ -395,6 +395,9 @@ void NativeWindowWin::FlashFrame(bool flash) {
window_->FlashFrame(flash); window_->FlashFrame(flash);
} }
void NativeWindowWin::SetSkipTaskbar(bool skip) {
}
void NativeWindowWin::SetKiosk(bool kiosk) { void NativeWindowWin::SetKiosk(bool kiosk) {
SetFullscreen(kiosk); SetFullscreen(kiosk);
} }

View file

@ -71,6 +71,7 @@ class NativeWindowWin : public NativeWindow,
virtual void SetTitle(const std::string& title) OVERRIDE; virtual void SetTitle(const std::string& title) OVERRIDE;
virtual std::string GetTitle() OVERRIDE; virtual std::string GetTitle() OVERRIDE;
virtual void FlashFrame(bool flash) OVERRIDE; virtual void FlashFrame(bool flash) OVERRIDE;
virtual void SetSkipTaskbar(bool skip) OVERRIDE;
virtual void SetKiosk(bool kiosk) OVERRIDE; virtual void SetKiosk(bool kiosk) OVERRIDE;
virtual bool IsKiosk() OVERRIDE; virtual bool IsKiosk() OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE; virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;

View file

@ -24,6 +24,9 @@ const char kMaxHeight[] = "max-height";
const char kResizable[] = "resizable"; const char kResizable[] = "resizable";
const char kFullscreen[] = "fullscreen"; const char kFullscreen[] = "fullscreen";
// Whether the window should show in taskbar.
const char kSkipTaskbar[] = "skip-taskbar";
// Start with the kiosk mode, see Opera's page for description: // Start with the kiosk mode, see Opera's page for description:
// http://www.opera.com/support/mastering/kiosk/ // http://www.opera.com/support/mastering/kiosk/
const char kKiosk[] = "kiosk"; const char kKiosk[] = "kiosk";

View file

@ -24,6 +24,7 @@ extern const char kMaxWidth[];
extern const char kMaxHeight[]; extern const char kMaxHeight[];
extern const char kResizable[]; extern const char kResizable[];
extern const char kFullscreen[]; extern const char kFullscreen[];
extern const char kSkipTaskbar[];
extern const char kKiosk[]; extern const char kKiosk[];
extern const char kAlwaysOnTop[]; extern const char kAlwaysOnTop[];
extern const char kNodeIntegration[]; extern const char kNodeIntegration[];