From: Cheng Zhao Date: Wed, 4 Dec 2013 13:18:53 +0000 (+0800) Subject: win: Implement NativeWindowWin::HasModalDialog(). X-Git-Tag: v0.7.4~1^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=687c9de5d71ce160553106cfeac5016d1efedde3;p=electron.git win: Implement NativeWindowWin::HasModalDialog(). --- diff --git a/browser/native_window_win.cc b/browser/native_window_win.cc index f03d3365..89542297 100644 --- a/browser/native_window_win.cc +++ b/browser/native_window_win.cc @@ -194,6 +194,17 @@ class NativeWindowFramelessView : public views::NonClientFrameView { DISALLOW_COPY_AND_ASSIGN(NativeWindowFramelessView); }; +bool WindowHasModalDialog(HWND parent, HWND except, HWND after = NULL) { + HWND hwnd = ::FindWindowEx(parent, after, NULL, NULL); + if (hwnd != except && + (::GetWindowLong(hwnd, GWL_STYLE) & (WS_VISIBLE | WS_POPUP))) + return true; + else if (hwnd == NULL) + return false; + else + return WindowHasModalDialog(parent, except, hwnd); +} + } // namespace NativeWindowWin::NativeWindowWin(content::WebContents* web_contents, @@ -359,6 +370,11 @@ bool NativeWindowWin::IsKiosk() { return IsFullscreen(); } +bool NativeWindowWin::HasModalDialog() { + return WindowHasModalDialog(GetNativeWindow(), + GetWebContents()->GetView()->GetNativeView()); +} + gfx::NativeWindow NativeWindowWin::GetNativeWindow() { return window_->GetNativeView(); }