Skip to content

Commit

Permalink
Use ScopedNestedTaskAllower instead of background thread for print di…
Browse files Browse the repository at this point in the history
…alog

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
  • Loading branch information
scottmg@chromium.org committed Feb 14, 2014
1 parent 26f7484 commit 368d362
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion printing/printing_context_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ PrintingContextWin::~PrintingContextWin() {
ReleaseContext();
}

// TODO(vitalybuka): Implement as ui::BaseShellDialog crbug.com/180997.
void PrintingContextWin::AskUserForSettings(
gfx::NativeView view, int max_pages, bool has_selection,
const PrintSettingsCallback& callback) {
Expand Down Expand Up @@ -238,6 +237,14 @@ void PrintingContextWin::AskUserForSettings(
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);
if (hr != S_OK) {
ResetSettings();
Expand Down
2 changes: 2 additions & 0 deletions printing/printing_context_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "printing/backend/printing_info_win.h"
#include "printing/printing_test.h"
#include "printing/printing_context.h"
Expand Down Expand Up @@ -159,6 +160,7 @@ TEST_F(PrintingContextTest, Base) {
}

TEST_F(PrintingContextTest, PrintAll) {
base::MessageLoop message_loop;
if (IsTestCaseDisabled())
return;

Expand Down

0 comments on commit 368d362

Please sign in to comment.