Call WasShown when showing window

Otherwise WebContents would be invisible when window is hidden at first
and then show later.

Refs #2879.
This commit is contained in:
Cheng Zhao 2015-09-24 18:15:57 +08:00
parent fc422e5d55
commit da57a3101f
2 changed files with 7 additions and 0 deletions

View file

@ -467,6 +467,8 @@ bool NativeWindowMac::IsFocused() {
} }
void NativeWindowMac::Show() { void NativeWindowMac::Show() {
web_contents()->WasShown();
// This method is supposed to put focus on window, however if the app does not // This method is supposed to put focus on window, however if the app does not
// have focus then "makeKeyAndOrderFront" will only show the window. // have focus then "makeKeyAndOrderFront" will only show the window.
[NSApp activateIgnoringOtherApps:YES]; [NSApp activateIgnoringOtherApps:YES];
@ -475,11 +477,13 @@ void NativeWindowMac::Show() {
} }
void NativeWindowMac::ShowInactive() { void NativeWindowMac::ShowInactive() {
web_contents()->WasShown();
[window_ orderFrontRegardless]; [window_ orderFrontRegardless];
} }
void NativeWindowMac::Hide() { void NativeWindowMac::Hide() {
[window_ orderOut:nil]; [window_ orderOut:nil];
web_contents()->WasHidden();
} }
bool NativeWindowMac::IsVisible() { bool NativeWindowMac::IsVisible() {

View file

@ -338,15 +338,18 @@ bool NativeWindowViews::IsFocused() {
} }
void NativeWindowViews::Show() { void NativeWindowViews::Show() {
web_contents()->WasShown();
window_->native_widget_private()->ShowWithWindowState(GetRestoredState()); window_->native_widget_private()->ShowWithWindowState(GetRestoredState());
} }
void NativeWindowViews::ShowInactive() { void NativeWindowViews::ShowInactive() {
web_contents()->WasShown();
window_->ShowInactive(); window_->ShowInactive();
} }
void NativeWindowViews::Hide() { void NativeWindowViews::Hide() {
window_->Hide(); window_->Hide();
web_contents()->WasHidden();
} }
bool NativeWindowViews::IsVisible() { bool NativeWindowViews::IsVisible() {