Use internal IsVisible method

This commit is contained in:
Kevin Sawicki 2017-02-14 13:14:35 -08:00 committed by Kevin Sawicki
parent db79f4f450
commit 52801c4a41
3 changed files with 8 additions and 10 deletions

View file

@ -205,7 +205,7 @@ NativeWindowViews::NativeWindowViews(
if (parent)
params.parent = parent->GetNativeWindow();
params.native_widget = new AtomDesktopNativeWidgetAura(window_.get(), this);
params.native_widget = new AtomDesktopNativeWidgetAura(window_.get());
atom_desktop_window_tree_host_win_ = new AtomDesktopWindowTreeHostWin(
this,
window_.get(),

View file

@ -7,14 +7,15 @@
namespace atom {
AtomDesktopNativeWidgetAura::AtomDesktopNativeWidgetAura(
views::internal::NativeWidgetDelegate* delegate,
NativeWindowViews* window)
: views::DesktopNativeWidgetAura(delegate),
window_(window) {
views::internal::NativeWidgetDelegate* delegate)
: views::DesktopNativeWidgetAura(delegate) {
}
void AtomDesktopNativeWidgetAura::Activate() {
if (window_->IsVisible())
// Activate can cause the focused window to be blurred so only
// call when the window being activated is visible. This prevents
// hidden windows from blurring the focused window when created.
if (IsVisible())
views::DesktopNativeWidgetAura::Activate();
}

View file

@ -12,15 +12,12 @@ namespace atom {
class AtomDesktopNativeWidgetAura : public views::DesktopNativeWidgetAura {
public:
AtomDesktopNativeWidgetAura(views::internal::NativeWidgetDelegate* delegate,
NativeWindowViews* window);
AtomDesktopNativeWidgetAura(views::internal::NativeWidgetDelegate* delegate);
// internal::NativeWidgetPrivate:
void Activate() override;
private:
NativeWindowViews* window_;
DISALLOW_COPY_AND_ASSIGN(AtomDesktopNativeWidgetAura);
};