Re-fix Cloud Print dialog coming up behind other windows on Windows.
Add back in the code to bring the dialog to the front, which was accidentally
dropped during a refactoring.
BUG=112011
TEST=Use the --cloud-print-file switch on Windows. Before, the print dialog would come up behind, after this CL, it should pop up in front.
Review URL: https://chromiumcodereview.appspot.com/10642010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143548 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index 7d38636..5a5c157 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -39,6 +39,11 @@
#include "ui/base/l10n/l10n_util.h"
#include "webkit/glue/webpreferences.h"
+#if defined(USE_AURA)
+#include "ui/aura/root_window.h"
+#include "ui/aura/window.h"
+#endif
+
#if defined(OS_WIN)
#include "ui/base/win/foreground_helper.h"
#endif
@@ -682,9 +687,25 @@
delete_on_close,
close_after_signin,
callback);
- browser::ShowWebDialog(modal_parent,
- Profile::FromBrowserContext(browser_context),
- dialog_delegate);
+#if defined(OS_WIN)
+ gfx::NativeWindow window =
+#endif
+ browser::ShowWebDialog(modal_parent,
+ Profile::FromBrowserContext(browser_context),
+ dialog_delegate);
+#if defined(OS_WIN)
+ if (!path_to_file.empty() && window) {
+ HWND dialog_handle;
+#if defined(USE_AURA)
+ dialog_handle = window->GetRootWindow()->GetAcceleratedWidget();
+#else
+ dialog_handle = window;
+#endif
+ if (::GetForegroundWindow() != dialog_handle) {
+ ui::ForegroundHelper::SetForeground(dialog_handle);
+ }
+ }
+#endif
}
void CreateDialogSigninImpl(content::BrowserContext* browser_context,