Commit 368d362d authored by scottmg@chromium.org's avatar scottmg@chromium.org

Use ScopedNestedTaskAllower instead of background thread for print dialog

Tasks need to be processed for painting to occur in other browser
windows while the modal dialog is up in Aura.

R=vitalybuka@chromium.org
BUG=342697,180997,343848

Review URL: https://codereview.chromium.org/164303002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251373 0039d316-1c4b-4281-b951-d872f2087c98
parent 26f74847
...@@ -175,7 +175,6 @@ PrintingContextWin::~PrintingContextWin() { ...@@ -175,7 +175,6 @@ PrintingContextWin::~PrintingContextWin() {
ReleaseContext(); ReleaseContext();
} }
// TODO(vitalybuka): Implement as ui::BaseShellDialog crbug.com/180997.
void PrintingContextWin::AskUserForSettings( void PrintingContextWin::AskUserForSettings(
gfx::NativeView view, int max_pages, bool has_selection, gfx::NativeView view, int max_pages, bool has_selection,
const PrintSettingsCallback& callback) { const PrintSettingsCallback& callback) {
...@@ -238,6 +237,14 @@ void PrintingContextWin::AskUserForSettings( ...@@ -238,6 +237,14 @@ void PrintingContextWin::AskUserForSettings(
dialog_options.Flags |= PD_NOPAGENUMS; dialog_options.Flags |= PD_NOPAGENUMS;
} }
// Note that this cannot use ui::BaseShellDialog as the print dialog is
// system modal: opening it from a background thread can cause Windows to
// get the wrong Z-order which will make the print dialog appear behind the
// browser frame (but still being modal) so neither the browser frame nor
// the print dialog will get any input. See http://crbug.com/342697
// http://crbug.com/180997 for details.
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
HRESULT hr = (*print_dialog_func_)(&dialog_options); HRESULT hr = (*print_dialog_func_)(&dialog_options);
if (hr != S_OK) { if (hr != S_OK) {
ResetSettings(); ResetSettings();
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/bind_helpers.h" #include "base/bind_helpers.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "printing/backend/printing_info_win.h" #include "printing/backend/printing_info_win.h"
#include "printing/printing_test.h" #include "printing/printing_test.h"
#include "printing/printing_context.h" #include "printing/printing_context.h"
...@@ -159,6 +160,7 @@ TEST_F(PrintingContextTest, Base) { ...@@ -159,6 +160,7 @@ TEST_F(PrintingContextTest, Base) {
} }
TEST_F(PrintingContextTest, PrintAll) { TEST_F(PrintingContextTest, PrintAll) {
base::MessageLoop message_loop;
if (IsTestCaseDisabled()) if (IsTestCaseDisabled())
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment