Finalized browser-window show & hide events, added tests & fixed os x implementation
This commit is contained in:
parent
c1267b2320
commit
fcc1f4d7ed
4 changed files with 73 additions and 9 deletions
|
@ -428,6 +428,14 @@ void NativeWindow::NotifyWindowFocus() {
|
|||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowFocus());
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowShow() {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowShow());
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowHide() {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowHide());
|
||||
}
|
||||
|
||||
void NativeWindow::NotifyWindowMaximize() {
|
||||
FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnWindowMaximize());
|
||||
}
|
||||
|
|
|
@ -79,6 +79,21 @@ bool ScopedDisableResize::disable_resize_ = false;
|
|||
return self;
|
||||
}
|
||||
|
||||
- (void)windowDidChangeOcclusionState:(NSNotification *)notification {
|
||||
// notification.object is the window that changed its state.
|
||||
// It's safe to use self.window instead if you don't assign one delegate to many windows
|
||||
NSWindow *window = notification.object;
|
||||
|
||||
// check occlusion binary flag
|
||||
if (window.occlusionState & NSWindowOcclusionStateVisible) {
|
||||
// The app is visible
|
||||
shell_->NotifyWindowShow();
|
||||
} else {
|
||||
// The app is not visible
|
||||
shell_->NotifyWindowHide();
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification*)notification {
|
||||
content::WebContents* web_contents = shell_->web_contents();
|
||||
if (!web_contents)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue