summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 19:20:36 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-05 19:20:36 +0000
commit718fb437953c3c47592884deaecd9dd7581fad3d (patch)
tree9126ceafb8d96b98bec7277e6074b790d54995df /chrome/browser/printing
parent2bd2413641ba6a38f4dd498225ab92bd33bd9647 (diff)
downloadchromium_src-718fb437953c3c47592884deaecd9dd7581fad3d.zip
chromium_src-718fb437953c3c47592884deaecd9dd7581fad3d.tar.gz
chromium_src-718fb437953c3c47592884deaecd9dd7581fad3d.tar.bz2
Remove black magic and >100 lines. Unhook a lot of dead code.
Review URL: http://codereview.chromium.org/21057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9237 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r--chrome/browser/printing/page_overlays_unittest.cc5
-rw-r--r--chrome/browser/printing/print_job.cc93
-rw-r--r--chrome/browser/printing/print_job.h25
-rw-r--r--chrome/browser/printing/print_job_unittest.cc81
-rw-r--r--chrome/browser/printing/print_job_worker.h6
-rw-r--r--chrome/browser/printing/print_view_manager.cc139
-rw-r--r--chrome/browser/printing/print_view_manager.h33
-rw-r--r--chrome/browser/printing/printed_document.cc7
-rw-r--r--chrome/browser/printing/printed_pages_source.h5
9 files changed, 73 insertions, 321 deletions
diff --git a/chrome/browser/printing/page_overlays_unittest.cc b/chrome/browser/printing/page_overlays_unittest.cc
index beca2ae..d590f8e 100644
--- a/chrome/browser/printing/page_overlays_unittest.cc
+++ b/chrome/browser/printing/page_overlays_unittest.cc
@@ -35,11 +35,6 @@ const Keys kOverlayKeys[] = {
class PagesSource : public printing::PrintedPagesSource {
public:
- virtual void RenderOnePrintedPage(printing::PrintedDocument* document,
- int page_number) {
- EXPECT_FALSE(true);
- }
-
virtual std::wstring RenderSourceName() {
return L"Foobar Document";
}
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
index 193a3c1..0d999f7 100644
--- a/chrome/browser/printing/print_job.cc
+++ b/chrome/browser/printing/print_job.cc
@@ -18,17 +18,6 @@ using base::TimeDelta;
namespace printing {
-PrintJob::PrintJob(PrintedPagesSource* source)
- : ui_message_loop_(MessageLoop::current()),
- worker_(new PrintJobWorker(this)),
- source_(source),
- is_job_pending_(false),
- is_print_dialog_box_shown_(false),
- is_canceling_(false) {
- DCHECK(ui_message_loop_);
- ui_message_loop_->AddDestructionObserver(this);
-}
-
PrintJob::PrintJob()
: ui_message_loop_(MessageLoop::current()),
worker_(),
@@ -103,38 +92,7 @@ void PrintJob::Observe(NotificationType type,
void PrintJob::GetSettingsDone(const PrintSettings& new_settings,
PrintingContext::Result result) {
- DCHECK(!is_job_pending_);
-
- if (!source_ || result == PrintingContext::FAILED) {
- // The source is gone, there's nothing to do.
- Cancel();
- return;
- }
-
- // Only create a new PrintedDocument if the settings have changed or if
- // there was no printed document.
- if (!document_.get() || !new_settings.Equals(settings_)) {
- UpdatePrintedDocument(new PrintedDocument(new_settings, source_,
- PrintSettings::NewCookie()));
- }
-
- JobEventDetails::Type type;
- if (is_print_dialog_box_shown_) {
- type = (result == PrintingContext::OK) ?
- JobEventDetails::USER_INIT_DONE :
- JobEventDetails::USER_INIT_CANCELED;
- // Dialog box is not shown anymore.
- is_print_dialog_box_shown_ = false;
- } else {
- DCHECK_EQ(result, PrintingContext::OK);
- type = JobEventDetails::DEFAULT_INIT_DONE;
- }
- scoped_refptr<JobEventDetails> details(
- new JobEventDetails(type, document_.get(), NULL));
- NotificationService::current()->Notify(
- NotificationType::PRINT_JOB_EVENT,
- Source<PrintJob>(this),
- Details<JobEventDetails>(details.get()));
+ NOTREACHED();
}
PrintJobWorker* PrintJob::DetachWorker(PrintJobWorkerOwner* new_owner) {
@@ -153,37 +111,6 @@ void PrintJob::WillDestroyCurrentMessageLoop() {
NOTREACHED();
}
-void PrintJob::GetSettings(GetSettingsAskParam ask_user_for_settings,
- HWND parent_window) {
- DCHECK_EQ(ui_message_loop_, MessageLoop::current());
- DCHECK(!is_job_pending_);
- DCHECK(!is_print_dialog_box_shown_);
- // Is not reentrant.
- if (is_job_pending_)
- return;
-
- // Lazy create the worker thread. There is one worker thread per print job.
- if (!worker_->message_loop()) {
- if (!worker_->Start())
- return;
-
- // Don't re-register if we were already registered.
- NotificationService::current()->AddObserver(
- this, NotificationType::PRINT_JOB_EVENT, Source<PrintJob>(this));
- }
-
- int page_count = 0;
- if (document_.get()) {
- page_count = document_->page_count();
- }
-
- // Real work is done in PrintJobWorker::Init().
- is_print_dialog_box_shown_ = ask_user_for_settings == ASK_USER;
- worker_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
- worker_.get(), &PrintJobWorker::GetSettings, is_print_dialog_box_shown_,
- parent_window, page_count));
-}
-
void PrintJob::StartPrinting() {
DCHECK_EQ(ui_message_loop_, MessageLoop::current());
DCHECK(worker_->message_loop());
@@ -258,25 +185,7 @@ void PrintJob::Cancel() {
is_canceling_ = false;
}
-bool PrintJob::RequestMissingPages() {
- DCHECK_EQ(ui_message_loop_, MessageLoop::current());
- DCHECK(!is_print_dialog_box_shown_);
- if (!is_job_pending_ || is_print_dialog_box_shown_)
- return false;
-
- MessageLoop* worker_loop = worker_.get() ? worker_->message_loop() : NULL;
- if (!worker_loop)
- return false;
-
- worker_loop->PostTask(FROM_HERE, NewRunnableMethod(
- worker_.get(), &PrintJobWorker::RequestMissingPages));
- return true;
-}
-
bool PrintJob::FlushJob(int timeout_ms) {
- if (!RequestMissingPages())
- return false;
-
// Make sure the object outlive this message loop.
scoped_refptr<PrintJob> handle(this);
diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h
index dcbe43e..5b38668 100644
--- a/chrome/browser/printing/print_job.h
+++ b/chrome/browser/printing/print_job.h
@@ -38,15 +38,6 @@ class PrintJob : public base::RefCountedThreadSafe<PrintJob>,
public PrintJobWorkerOwner,
public MessageLoop::DestructionObserver {
public:
- // GetSettings() UI parameter.
- enum GetSettingsAskParam {
- DEFAULTS,
- ASK_USER,
- };
-
- // Create a standalone PrintJob. When initializing with this constructor,
- // Initialize() must not be called.
- PrintJob(PrintedPagesSource* source);
// Create a empty PrintJob. When initializing with this constructor,
// post-constructor initialization must be done with Initialize().
PrintJob();
@@ -68,6 +59,7 @@ class PrintJob : public base::RefCountedThreadSafe<PrintJob>,
virtual void Release() {
return base::RefCountedThreadSafe<PrintJob>::Release();
}
+
virtual void GetSettingsDone(const PrintSettings& new_settings,
PrintingContext::Result result);
virtual PrintJobWorker* DetachWorker(PrintJobWorkerOwner* new_owner);
@@ -78,14 +70,6 @@ class PrintJob : public base::RefCountedThreadSafe<PrintJob>,
// DestructionObserver
virtual void WillDestroyCurrentMessageLoop();
- // Initializes the printing context. This can be done synchronously or not. It
- // is fine to call this function multiple times to reinitialize the settings.
- // |parent_window| parameter will be the owner of the print setting dialog
- // box. It is unused when |ask_for_user_settings| is DEFAULTS. No-op if a
- // print job is active.
- void GetSettings(GetSettingsAskParam ask_user_for_settings,
- gfx::NativeView parent_window);
-
// Starts the actual printing. Signals the worker that it should begin to
// spool as soon as data is available.
void StartPrinting();
@@ -99,13 +83,6 @@ class PrintJob : public base::RefCountedThreadSafe<PrintJob>,
// Cancels printing job and stops the worker thread. Takes effect immediately.
void Cancel();
- // Requests all the missing pages in the PrintedDocument. Returns true if at
- // least one page has been requested. Returns false if there was not enough
- // information to request the missing pages, i.e.
- // document()->document_page_count() is not initialized or no page
- // has been requested.
- bool RequestMissingPages();
-
// Synchronously wait for the job to finish. It is mainly useful when the
// process is about to be shut down and we're waiting for the spooler to eat
// our data.
diff --git a/chrome/browser/printing/print_job_unittest.cc b/chrome/browser/printing/print_job_unittest.cc
index 6789dd0..32b9f50 100644
--- a/chrome/browser/printing/print_job_unittest.cc
+++ b/chrome/browser/printing/print_job_unittest.cc
@@ -4,6 +4,7 @@
#include "base/message_loop.h"
#include "chrome/browser/printing/print_job.h"
+#include "chrome/browser/printing/print_job_worker.h"
#include "chrome/browser/printing/printed_pages_source.h"
#include "chrome/common/notification_service.h"
#include "googleurl/src/gurl.h"
@@ -13,9 +14,6 @@ namespace {
class TestSource : public printing::PrintedPagesSource {
public:
- virtual void RenderOnePrintedPage(printing::PrintedDocument* document,
- int page_number) {
- }
virtual std::wstring RenderSourceName() {
return L"";
}
@@ -24,11 +22,52 @@ class TestSource : public printing::PrintedPagesSource {
}
};
-class TestPrintJob : public printing::PrintJob {
+class TestPrintJobWorker : public printing::PrintJobWorker {
+ public:
+ explicit TestPrintJobWorker(printing::PrintJobWorkerOwner* owner)
+ : printing::PrintJobWorker(owner) {
+ }
+ friend class TestOwner;
+};
+
+class TestOwner : public printing::PrintJobWorkerOwner {
public:
- TestPrintJob(printing::PrintedPagesSource* source, volatile bool* check)
- : printing::PrintJob(source), check_(check) {
+ virtual void AddRef() {
+ EXPECT_FALSE(true);
+ }
+ virtual void Release() {
+ EXPECT_FALSE(true);
+ }
+ virtual void GetSettingsDone(const printing::PrintSettings& new_settings,
+ printing::PrintingContext::Result result) {
+ EXPECT_FALSE(true);
+ }
+ virtual printing::PrintJobWorker* DetachWorker(
+ printing::PrintJobWorkerOwner* new_owner) {
+ // We're screwing up here since we're calling worker from the main thread.
+ // That's fine for testing. It is actually simulating PrinterQuery behavior.
+ TestPrintJobWorker* worker(new TestPrintJobWorker(new_owner));
+ EXPECT_TRUE(worker->Start());
+ worker->printing_context().UseDefaultSettings();
+ settings_ = worker->printing_context().settings();
+ return worker;
+ }
+ virtual MessageLoop* message_loop() {
+ EXPECT_FALSE(true);
+ return NULL;
+ }
+ virtual const printing::PrintSettings& settings() const {
+ return settings_;
+ }
+ virtual int cookie() const {
+ return 42;
}
+ private:
+ printing::PrintSettings settings_;
+};
+
+class TestPrintJob : public printing::PrintJob {
+ public:
TestPrintJob(volatile bool* check) : check_(check) {
}
~TestPrintJob() {
@@ -44,22 +83,7 @@ class TestPrintNotifObserv : public NotificationObserver {
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- ASSERT_EQ(NotificationType::PRINT_JOB_EVENT, type.value);
- printing::JobEventDetails::Type event_type =
- Details<printing::JobEventDetails>(details)->type();
- EXPECT_NE(printing::JobEventDetails::NEW_DOC, event_type);
- EXPECT_NE(printing::JobEventDetails::NEW_PAGE, event_type);
- EXPECT_NE(printing::JobEventDetails::PAGE_DONE, event_type);
- EXPECT_NE(printing::JobEventDetails::DOC_DONE, event_type);
- EXPECT_NE(printing::JobEventDetails::JOB_DONE, event_type);
- EXPECT_NE(printing::JobEventDetails::ALL_PAGES_REQUESTED, event_type);
- if (event_type == printing::JobEventDetails::USER_INIT_DONE ||
- event_type == printing::JobEventDetails::USER_INIT_CANCELED ||
- event_type == printing::JobEventDetails::DEFAULT_INIT_DONE ||
- event_type == printing::JobEventDetails::FAILED) {
- MessageLoop::current()->Quit();
- return;
- }
+ EXPECT_FALSE(true);
}
};
@@ -68,17 +92,20 @@ class TestPrintNotifObserv : public NotificationObserver {
TEST(PrintJobTest, SimplePrint) {
// Test the multithreaded nature of PrintJob to make sure we can use it with
// known livetime.
- TestPrintNotifObserv observ;
+
+ // This message loop is actually never run.
MessageLoop current;
+
+ TestPrintNotifObserv observ;
NotificationService::current()->AddObserver(
&observ, NotificationType::ALL,
NotificationService::AllSources());
- TestSource source;
volatile bool check = false;
- scoped_refptr<printing::PrintJob> job(new TestPrintJob(&source, &check));
- job->GetSettings(printing::PrintJob::DEFAULTS, NULL);
+ scoped_refptr<printing::PrintJob> job(new TestPrintJob(&check));
EXPECT_EQ(MessageLoop::current(), job->message_loop());
- current.Run();
+ TestOwner owner;
+ TestSource source;
+ job->Initialize(&owner, &source);
job->Stop();
job = NULL;
EXPECT_TRUE(check);
diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h
index 3e25ec5..5fb5fbd 100644
--- a/chrome/browser/printing/print_job_worker.h
+++ b/chrome/browser/printing/print_job_worker.h
@@ -25,7 +25,7 @@ class PrintJobWorkerOwner;
// PrintJob always outlives its worker instance.
class PrintJobWorker : public base::Thread {
public:
- PrintJobWorker(PrintJobWorkerOwner* owner);
+ explicit PrintJobWorker(PrintJobWorkerOwner* owner);
~PrintJobWorker();
void SetNewOwner(PrintJobWorkerOwner* new_owner);
@@ -58,6 +58,10 @@ class PrintJobWorker : public base::Thread {
// ALL_PAGES_REQUESTED notification once done.
void RequestMissingPages();
+ protected:
+ // Retrieves the context for testing only.
+ PrintingContext& printing_context() { return printing_context_; }
+
private:
// The shared NotificationService service can only be accessed from the UI
// thread, so this class encloses the necessary information to send the
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index c21688f..20e5816 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -26,8 +26,7 @@ namespace printing {
PrintViewManager::PrintViewManager(WebContents& owner)
: owner_(owner),
waiting_to_print_(false),
- inside_inner_message_loop_(false),
- waiting_to_show_print_dialog_(false) {
+ inside_inner_message_loop_(false) {
}
PrintViewManager::~PrintViewManager() {
@@ -42,33 +41,6 @@ void PrintViewManager::Stop() {
TerminatePrintJob(true);
}
-void PrintViewManager::ShowPrintDialog() {
- if (!CreateNewPrintJob(NULL))
- return;
-
- // Retrieve default settings. PrintJob will send back a
- // NOTIFY_PRINT_JOB_EVENT with either INIT_DONE, INIT_CANCELED or FAILED.
- // On failure, simply back off. Otherwise, request the number of pages to
- // the renderer. Wait for its response (DidGetPrintedPagesCount), which will
- // give the value used to initialize the Print... dialog. PrintJob will send
- // back (again) a NOTIFY_PRINT_JOB_EVENT with either INIT_DONE, INIT_CANCELED
- // or FAILED. The result is to call PrintNowInternal or to back off.
- waiting_to_show_print_dialog_ = true;
- print_job_->GetSettings(PrintJob::DEFAULTS, NULL);
-}
-
-bool PrintViewManager::PrintNow() {
- if (!CreateNewPrintJob(NULL))
- return false;
-
- // Retrieve default settings. PrintJob will send back a NOTIFY_PRINT_JOB_EVENT
- // with either DEFAULT_INIT_DONE or FAILED. On failure, simply back off.
- // Otherwise, call PrintNowInternal() again to start the print job.
- waiting_to_print_ = true;
- print_job_->GetSettings(PrintJob::DEFAULTS, NULL);
- return true;
-}
-
bool PrintViewManager::OnRendererGone(RenderViewHost* render_view_host) {
if (!print_job_.get())
return true;
@@ -101,20 +73,11 @@ void PrintViewManager::DidGetPrintedPagesCount(int cookie, int number_pages) {
// Time to inform our print job. Make sure it is for the right document.
if (!document->page_count()) {
document->set_page_count(number_pages);
- if (waiting_to_show_print_dialog_) {
- // Ask for user settings. There's a timing issue since we may not have
- // received the INIT_DONE notification yet. If so, the dialog will be
- // shown in Observe() since the page count arrived before the settings.
- print_job_->GetSettings(PrintJob::ASK_USER,
- ::GetParent(owner_.GetContainerHWND()));
- waiting_to_show_print_dialog_ = false;
- }
}
}
void PrintViewManager::DidPrintPage(
const ViewHostMsg_DidPrintPage_Params& params) {
- DCHECK(!inside_inner_message_loop_);
if (!OpportunisticallyCreatePrintJob(params.document_cookie))
return;
@@ -155,17 +118,6 @@ void PrintViewManager::DidPrintPage(
ShouldQuitFromInnerMessageLoop();
}
-void PrintViewManager::RenderOnePrintedPage(PrintedDocument* document,
- int page_number) {
- // Currently a no-op. Rationale: printing is now completely synchronous and is
- // handled by PrintAllPages. The reason is that PrintPreview is not used
- // anymore and to make sure to not corrupt the screen, the whole generation is
- // done synchronously. To make this work completely asynchronously, a
- // duplicate copy of RenderView must be made to have an "innert" web page.
- // Once this object is created, we'll have all the leasure to do whatever we
- // want.
-}
-
std::wstring PrintViewManager::RenderSourceName() {
std::wstring name(owner_.GetTitle());
if (name.empty())
@@ -207,7 +159,7 @@ void PrintViewManager::OnNotifyPrintJobEvent(
case JobEventDetails::USER_INIT_DONE:
case JobEventDetails::DEFAULT_INIT_DONE:
case JobEventDetails::USER_INIT_CANCELED: {
- OnNotifyPrintJobInitEvent(event_details);
+ NOTREACHED();
break;
}
case JobEventDetails::ALL_PAGES_REQUESTED: {
@@ -238,71 +190,7 @@ void PrintViewManager::OnNotifyPrintJobEvent(
}
}
-void PrintViewManager::OnNotifyPrintJobInitEvent(
- const JobEventDetails& event_details) {
- // Continue even if owner_.render_view_host() is dead because we may already
- // have buffered all the necessary pages.
- switch (event_details.type()) {
- case JobEventDetails::USER_INIT_DONE: {
- // The user clicked the "Print" button in the Print... dialog.
- // Time to print.
- DCHECK_EQ(waiting_to_print_, false);
- DCHECK_EQ(waiting_to_show_print_dialog_, false);
- waiting_to_print_ = true;
- PrintNowInternal();
- break;
- }
- case JobEventDetails::USER_INIT_CANCELED: {
- DCHECK(!waiting_to_show_print_dialog_);
- // The print dialog box has been dismissed (Cancel button or the X).
- TerminatePrintJob(false);
- break;
- }
- case JobEventDetails::DEFAULT_INIT_DONE: {
- // Init(false) returned.
- if (waiting_to_print_) {
- // PrintNow() is pending.
- DCHECK_EQ(waiting_to_show_print_dialog_, false);
- PrintNowInternal();
- } else if (waiting_to_show_print_dialog_ &&
- event_details.document()->page_count()) {
- // Time to ask the user for the print settings.
- print_job_->GetSettings(PrintJob::ASK_USER,
- ::GetParent(owner_.GetContainerHWND()));
- waiting_to_show_print_dialog_ = false;
- } else {
- // event_details.document()->page_count() is false. This simply means
- // that the renderer was slower to calculate the number of pages than
- // the print_job_ to initialize the default settings. If so, the dialog
- // will be shown in DidGetPrintedPagesCount() since the settings arrived
- // before the page count.
- DCHECK_EQ(waiting_to_show_print_dialog_, true);
- }
- break;
- }
- default: {
- NOTREACHED();
- break;
- }
- }
-}
-
bool PrintViewManager::RenderAllMissingPagesNow() {
- if (waiting_to_show_print_dialog_) {
- // TODO(maruel): http://b/1186708 This happens in one of these case:
- // - javascript:window.print();window.close(); which closes the window very
- // fast.
- // - The worker thread is hung, like the network printer failed, the network
- // print server failed or the network cable is disconnected.
- // In the first case we want to wait, but not on the second case.
-
- if (!RunInnerMessageLoop()) {
- // This function is always called from DisconnectFromCurrentPrintJob()
- // so we know that the job will be stopped/canceled in any case.
- return false;
- }
- }
-
if (!print_job_.get() || !print_job_->is_job_pending()) {
DCHECK_EQ(waiting_to_print_, false);
return false;
@@ -356,7 +244,7 @@ void PrintViewManager::ShouldQuitFromInnerMessageLoop() {
bool PrintViewManager::CreateNewPrintJob(PrintJobWorkerOwner* job) {
DCHECK(!inside_inner_message_loop_);
- if (waiting_to_print_ || waiting_to_show_print_dialog_) {
+ if (waiting_to_print_) {
// We can't help; we are waiting for a print job initialization. The user is
// button bashing. The only thing we could do is to batch up the requests.
return false;
@@ -374,12 +262,12 @@ bool PrintViewManager::CreateNewPrintJob(PrintJobWorkerOwner* job) {
// Ask the renderer to generate the print preview, create the print preview
// view and switch to it, initialize the printer and show the print dialog.
DCHECK(!print_job_.get());
- if (job) {
- print_job_ = new PrintJob();
- print_job_->Initialize(job, this);
- } else {
- print_job_ = new PrintJob(this);
- }
+ DCHECK(job);
+ if (!job)
+ return false;
+
+ print_job_ = new PrintJob();
+ print_job_->Initialize(job, this);
NotificationService::current()->AddObserver(
this,
NotificationType::PRINT_JOB_EVENT,
@@ -413,11 +301,9 @@ void PrintViewManager::TerminatePrintJob(bool cancel) {
// We don't need the EMF data anymore because the printing is canceled.
print_job_->Cancel();
waiting_to_print_ = false;
- waiting_to_show_print_dialog_ = false;
inside_inner_message_loop_ = false;
} else {
DCHECK(!inside_inner_message_loop_);
- DCHECK(!waiting_to_show_print_dialog_);
DCHECK(!print_job_->document() || print_job_->document()->IsComplete() ||
!waiting_to_print_);
@@ -450,11 +336,8 @@ void PrintViewManager::PrintNowInternal() {
// print_job_->is_job_pending() to true.
print_job_->StartPrinting();
- if (!print_job_->document() ||
- !print_job_->document()->IsComplete()) {
- // TODO(maruel): Will never happen. This code is about to be deleted.
- NOTREACHED();
- }
+ DCHECK(print_job_->document());
+ DCHECK(print_job_->document()->IsComplete());
}
bool PrintViewManager::RunInnerMessageLoop() {
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index 3cd0272..1392ac57 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -34,14 +34,6 @@ class PrintViewManager : public NotificationObserver,
// Cancels the print job.
void Stop();
- // Shows the "Print..." dialog if none is shown and if no rendering is
- // pending. This is done asynchronously.
- void ShowPrintDialog();
-
- // Initiates a print job immediately. This is done asynchronously. Returns
- // false if printing is impossible at the moment.
- bool PrintNow();
-
// Terminates or cancels the print job if one was pending, depending on the
// current state. Returns false if the renderer was not valuable.
bool OnRendererGone(RenderViewHost* render_view_host);
@@ -55,7 +47,6 @@ class PrintViewManager : public NotificationObserver,
void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params);
// PrintedPagesSource implementation.
- virtual void RenderOnePrintedPage(PrintedDocument* document, int page_number);
virtual std::wstring RenderSourceName();
virtual GURL RenderSourceUrl();
@@ -68,9 +59,6 @@ class PrintViewManager : public NotificationObserver,
// Processes a NOTIFY_PRINT_JOB_EVENT notification.
void OnNotifyPrintJobEvent(const JobEventDetails& event_details);
- // Processes a xxx_INIT_xxx type of NOTIFY_PRINT_JOB_EVENT notification.
- void OnNotifyPrintJobInitEvent(const JobEventDetails& event_details);
-
// Requests the RenderView to render all the missing pages for the print job.
// Noop if no print job is pending. Returns true if at least one page has been
// requested to the renderer.
@@ -132,27 +120,6 @@ class PrintViewManager : public NotificationObserver,
// print settings are being loaded.
bool inside_inner_message_loop_;
- // The object is waiting for some information to call print_job_->Init(true).
- // It is either a DEFAULT_INIT_DONE notification or the
- // DidGetPrintedPagesCount() callback.
- // Showing the Print... dialog box is a multi-step operation:
- // - print_job_->Init(false) to get the default settings. Set
- // waiting_to_show_print_dialog_ = true.
- // - on DEFAULT_INIT_DONE, gathers new settings.
- // - did settings() or document() change since the last intialization?
- // - Call SwitchCssToPrintMediaType()
- // - On DidGetPrintedPagesCount() call, if
- // waiting_to_show_print_dialog_ = true
- // - calls print_job_->Init(true).
- // - waiting_to_show_print_dialog_ = false.
- // - DONE.
- // - else (It may happens when redisplaying the dialog box with settings that
- // haven't changed)
- // - if waiting_to_show_print_dialog_ = true && page_count is initialized.
- // - calls print_job_->Init(true).
- // - waiting_to_show_print_dialog_ = false.
- bool waiting_to_show_print_dialog_;
-
// PrintViewManager is created as an extension of WebContent specialized for
// printing-related behavior. Still, access to the renderer is needed so a
// back reference is kept the the "parent object".
diff --git a/chrome/browser/printing/printed_document.cc b/chrome/browser/printing/printed_document.cc
index bdbdbf0..21535b2 100644
--- a/chrome/browser/printing/printed_document.cc
+++ b/chrome/browser/printing/printed_document.cc
@@ -344,12 +344,7 @@ void PrintedDocument::PrintPage_ThreadJump(int page_number) {
AutoLock lock(lock_);
source = mutable_.source_;
}
- if (source) {
- // Don't render with the lock held.
- source->RenderOnePrintedPage(this, page_number);
- } else {
- // Printing has probably been canceled already.
- }
+ NOTREACHED();
}
}
diff --git a/chrome/browser/printing/printed_pages_source.h b/chrome/browser/printing/printed_pages_source.h
index c8974ed..56ee0a4 100644
--- a/chrome/browser/printing/printed_pages_source.h
+++ b/chrome/browser/printing/printed_pages_source.h
@@ -17,11 +17,6 @@ class PrintedDocument;
// Source of printed pages.
class PrintedPagesSource {
public:
- // Renders a printed page. It is not necessary to be synchronous. It must call
- // document->SetPage() once the source is done rendering the requested page.
- virtual void RenderOnePrintedPage(PrintedDocument* document,
- int page_number) = 0;
-
// Returns the document title.
virtual std::wstring RenderSourceName() = 0;