PrintedPageSource has been removed

This commit is contained in:
Samuel Attard 2017-12-18 13:36:07 +11:00 коммит произвёл Aleksei Kuzmin
Родитель 6402b23041
Коммит c3dec709ab
4 изменённых файлов: 7 добавлений и 27 удалений

Просмотреть файл

@ -45,8 +45,7 @@ void HoldRefCallback(const scoped_refptr<PrintJobWorkerOwner>& owner,
} // namespace
PrintJob::PrintJob()
: source_(nullptr),
is_job_pending_(false),
: is_job_pending_(false),
is_canceling_(false),
quit_factory_(this) {
// This is normally a UI message loop, but in unit tests, the message loop is
@ -65,19 +64,17 @@ PrintJob::~PrintJob() {
}
void PrintJob::Initialize(PrintJobWorkerOwner* job,
PrintedPagesSource* source,
const base::string16& name,
int page_count) {
DCHECK(!source_);
DCHECK(!worker_);
DCHECK(!is_job_pending_);
DCHECK(!is_canceling_);
DCHECK(!document_.get());
source_ = source;
worker_ = job->DetachWorker(this);
settings_ = job->settings();
PrintedDocument* new_doc =
new PrintedDocument(settings_, source_, job->cookie());
new PrintedDocument(settings_, name, job->cookie());
new_doc->set_page_count(page_count);
UpdatePrintedDocument(new_doc);
@ -204,12 +201,6 @@ bool PrintJob::FlushJob(base::TimeDelta timeout) {
return true;
}
void PrintJob::DisconnectSource() {
source_ = nullptr;
if (document_.get())
document_->DisconnectSource();
}
bool PrintJob::is_job_pending() const {
return is_job_pending_;
}

Просмотреть файл

@ -27,7 +27,6 @@ class PdfToEmfConverter;
class PrintJobWorker;
class PrintedDocument;
class PrintedPage;
class PrintedPagesSource;
class PrinterQuery;
// Manages the print work for a specific document. Talks to the printer through
@ -45,7 +44,8 @@ class PrintJob : public PrintJobWorkerOwner,
// Grabs the ownership of the PrintJobWorker from another job, which is
// usually a PrinterQuery. Set the expected page count of the print job.
void Initialize(PrintJobWorkerOwner* job, PrintedPagesSource* source,
void Initialize(PrintJobWorkerOwner* job,
const base::string16& name,
int page_count);
// content::NotificationObserver implementation.
@ -80,10 +80,6 @@ class PrintJob : public PrintJobWorkerOwner,
// our data.
bool FlushJob(base::TimeDelta timeout);
// Disconnects the PrintedPage source (PrintedPagesSource). It is done when
// the source is being destroyed.
void DisconnectSource();
// Returns true if the print job is pending, i.e. between a StartPrinting()
// and the end of the spooling.
bool is_job_pending() const;
@ -140,10 +136,6 @@ class PrintJob : public PrintJobWorkerOwner,
content::NotificationRegistrar registrar_;
// Source that generates the PrintedPage's (i.e. a WebContents). It will be
// set back to NULL if the source is deleted before this object.
PrintedPagesSource* source_;
// All the UI is done in a worker thread because many Win32 print functions
// are blocking and enters a message loop without your consent. There is one
// worker thread per print job.

Просмотреть файл

@ -349,7 +349,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(PrintJobWorkerOwner* job) {
return false;
print_job_ = new PrintJob();
print_job_->Initialize(job, this, number_pages_);
print_job_->Initialize(job, RenderSourceName(), number_pages_);
registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
content::Source<PrintJob>(print_job_.get()));
printing_succeeded_ = false;
@ -414,7 +414,6 @@ void PrintViewManagerBase::ReleasePrintJob() {
registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
content::Source<PrintJob>(print_job_.get()));
print_job_->DisconnectSource();
// Don't close the worker thread.
print_job_ = NULL;
}

Просмотреть файл

@ -15,7 +15,6 @@
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "printing/printed_pages_source.h"
struct PrintHostMsg_DidPrintPage_Params;
@ -33,7 +32,6 @@ class PrintQueriesQueue;
// Base class for managing the print commands for a WebContents.
class PrintViewManagerBase : public content::NotificationObserver,
public PrintedPagesSource,
public content::WebContentsObserver {
public:
virtual ~PrintViewManagerBase();
@ -48,7 +46,7 @@ class PrintViewManagerBase : public content::NotificationObserver,
#endif // !DISABLE_BASIC_PRINTING
// PrintedPagesSource implementation.
virtual base::string16 RenderSourceName() override;
base::string16 RenderSourceName();
void SetCallback(const base::Callback<void(bool)>& cb) {
callback = cb;