diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index b3ac71d210cf..80a7d1347f3e 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -158,13 +158,8 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) { // Then show it. bool show = true; options.Get(switches::kShow, &show); - if (show) { + if (show) Show(); - } else { - // When RenderView is created it sets to visible, this is to prevent - // breaking the visibility API. - web_contents()->WasHidden(); - } } void NativeWindow::SetSize(const gfx::Size& size) { diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index f0a685e4d952..3e8dab2133c9 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -470,8 +470,6 @@ bool NativeWindowMac::IsFocused() { } void NativeWindowMac::Show() { - web_contents()->WasShown(); - // This method is supposed to put focus on window, however if the app does not // have focus then "makeKeyAndOrderFront" will only show the window. [NSApp activateIgnoringOtherApps:YES]; @@ -480,13 +478,11 @@ void NativeWindowMac::Show() { } void NativeWindowMac::ShowInactive() { - web_contents()->WasShown(); [window_ orderFrontRegardless]; } void NativeWindowMac::Hide() { [window_ orderOut:nil]; - web_contents()->WasHidden(); } bool NativeWindowMac::IsVisible() { diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 0fa2a99c27fc..e9db97e195d1 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -343,17 +343,14 @@ bool NativeWindowViews::IsFocused() { } void NativeWindowViews::Show() { - web_contents()->WasShown(); window_->native_widget_private()->ShowWithWindowState(GetRestoredState()); } void NativeWindowViews::ShowInactive() { - web_contents()->WasShown(); window_->ShowInactive(); } void NativeWindowViews::Hide() { - window_->Hide(); web_contents()->WasHidden(); } diff --git a/atom/renderer/lib/override.coffee b/atom/renderer/lib/override.coffee index 5cffdd486d9c..93cf8b8357e8 100644 --- a/atom/renderer/lib/override.coffee +++ b/atom/renderer/lib/override.coffee @@ -122,3 +122,7 @@ window.history.go = (offset) -> sendHistoryOperation 'goToOffset', offset Object.defineProperty window.history, 'length', get: -> getHistoryOperation 'length' + +# Make document.hidden return the correct value. +Object.defineProperty document, 'hidden', + get: -> !remote.getCurrentWindow().isVisible()