win: Implement window state events
This commit is contained in:
parent
3c7e5e47b8
commit
28ca883805
2 changed files with 38 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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<WindowStateWatcher> 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.
|
||||
|
|
Loading…
Reference in a new issue