diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index ae291b997735..583c179f64db 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -145,6 +145,9 @@ NativeWindowViews::NativeWindowViews(content::WebContents* web_contents, menu_bar_autohide_(false), menu_bar_visible_(false), menu_bar_alt_pressed_(false), +#if defined(OS_WIN) + is_minimized_(false), +#endif keyboard_event_handler_(new views::UnhandledKeyboardEventHandler), use_content_size_(false), resizable_(true) { @@ -317,6 +320,13 @@ bool NativeWindowViews::IsMinimized() { void NativeWindowViews::SetFullscreen(bool fullscreen) { window_->SetFullscreen(fullscreen); +#if defined(OS_WIN) + // There is no native fullscreen state on Windows. + if (fullscreen) + NotifyWindowEnterFullScreen(); + else + NotifyWindowLeaveFullScreen(); +#endif } bool NativeWindowViews::IsFullscreen() { @@ -720,6 +730,27 @@ views::NonClientFrameView* NativeWindowViews::CreateNonClientFrameView( #endif } +#if defined(OS_WIN) +bool NativeWindowViews::ExecuteWindowsCommand(int command_id) { + // Windows uses the 4 lower order bits of |command_id| for type-specific + // information so we must exclude this when comparing. + static const int sc_mask = 0xFFF0; + if ((command_id & sc_mask) == SC_MINIMIZE) { + NotifyWindowMinimize(); + is_minimized_ = true; + } else if ((command_id & sc_mask) == SC_RESTORE) { + if (is_minimized_) + NotifyWindowRestore(); + else + NotifyWindowUnmaximize(); + is_minimized_ = false; + } else if ((command_id & sc_mask) == SC_MAXIMIZE) { + NotifyWindowMaximize(); + } + return false; +} +#endif + gfx::ImageSkia NativeWindowViews::GetDevToolsWindowIcon() { return GetWindowAppIcon(); } diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index f15f5cb7ceac..c4e4f0b65698 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -111,6 +111,9 @@ class NativeWindowViews : public NativeWindow, views::ClientView* CreateClientView(views::Widget* widget) override; views::NonClientFrameView* CreateNonClientFrameView( views::Widget* widget) override; +#if defined(OS_WIN) + bool ExecuteWindowsCommand(int command_id) override; +#endif // brightray::InspectableWebContentsDelegate: gfx::ImageSkia GetDevToolsWindowIcon() override; @@ -148,6 +151,10 @@ class NativeWindowViews : public NativeWindow, // Handles window state events. scoped_ptr window_state_watcher_; +#elif defined(OS_WIN) + // Records window was whether restored from minimized state or maximized + // state. + bool is_minimized_; #endif // Handles unhandled keyboard messages coming back from the renderer process.