Skip to content
Snippets Groups Projects
Commit e79cf09f authored by thestig@chromium.org's avatar thestig@chromium.org
Browse files

Printing: Get settings on the UI thread on all platforms.

BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6027007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70591 0039d316-1c4b-4281-b951-d872f2087c98
parent 14b717ba
No related merge requests found
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -84,26 +84,14 @@ void PrintJobWorker::GetSettings(bool ask_user_for_settings,
printing_context_->set_use_overlays(use_overlays);
if (ask_user_for_settings) {
#if defined(OS_POSIX)
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &PrintJobWorker::GetSettingsWithUI,
parent_view, document_page_count,
has_selection));
#else
printing_context_->AskUserForSettings(
parent_view,
document_page_count,
has_selection,
NewCallback(this, &PrintJobWorker::GetSettingsDone));
#endif // defined(OS_POSIX)
} else {
#if defined(OS_POSIX)
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &PrintJobWorker::UseDefaultSettings));
#else
UseDefaultSettings();
#endif // defined(OS_POSIX)
}
}
......@@ -122,7 +110,6 @@ void PrintJobWorker::GetSettingsDone(PrintingContext::Result result) {
result));
}
#if defined(OS_POSIX)
void PrintJobWorker::GetSettingsWithUI(gfx::NativeView parent_view,
int document_page_count,
bool has_selection) {
......@@ -139,7 +126,6 @@ void PrintJobWorker::GetSettingsWithUIDone(PrintingContext::Result result) {
message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
this, &PrintJobWorker::GetSettingsDone, result));
}
#endif // defined(OS_POSIX)
void PrintJobWorker::UseDefaultSettings() {
PrintingContext::Result result = printing_context_->UseDefaultSettings();
......
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
......@@ -83,9 +83,9 @@ class PrintJobWorker : public base::Thread {
// context.
void OnFailure();
#if defined(OS_POSIX)
// Asks the user for print settings. Must be called on the UI thread.
// Mac and Linux-only since Windows can display UI from non-main threads.
// Required on Mac and Linux. Windows can display UI from non-main threads,
// but sticks with this for consistency.
void GetSettingsWithUI(gfx::NativeView parent_view,
int document_page_count,
bool has_selection);
......@@ -94,7 +94,6 @@ class PrintJobWorker : public base::Thread {
// object that the print settings are set. This is needed in order to bounce
// back into the IO thread for GetSettingsDone().
void GetSettingsWithUIDone(PrintingContext::Result result);
#endif // defined(OS_POSIX)
// Reports settings back to owner_.
void GetSettingsDone(PrintingContext::Result result);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment